Sambot - MeArm, servos, the Babelboard and Jetson Nano
Jud McCranie CC BY 3.0 via Wikimedia Commons |
I've wanted to revisit those early AI applications for a while, and I recently decided to put a new spin on an old idea.
I want to build a robot that plays Checkers (that's draughts to us Brits) using a real board, a robot arm and a Jetson Nano using a Raspberry Pi camera.
The game play could be done using a variant of Samuel's approach, a Neural network, or a combination of the two. If AlphaGo can master Go playing against itself it shouldn't be too hard for a pair of Machine Learning programs to maser draughts!
First, though, I need to build a controllable arm that can pick up and move the pieces and a computer vision system that can recognise the location of the peices on the board.
I'm up to my eyes in projects and work at the moment, but I have justified making a start on the robot arm because it ties in nicely with a current priority. It's a chance to explore and explain how to do Physical Computing with the Jetson Nano.
Jetson Nano |
Recently I've been making use of the Grove system from Seeed studio, and I've built a series of low-cost boards to let me use the Grove components with the Pi, the Nano and Adafruit Feathers. I call them babelboards.
They are the hardware hacker's equivalent of Douglas Adam's babelfish. They allow lots of different hardware components to talk to each other using the I2C protocol.
Nano with minimal babelboard |
I've had a MeArm robotic arm waiting for me to assemble it for ages, and today I made a start. I'll talk more about that in a later post, but today I will focus on getting the Nano to control the MeArm's four servos.
The Grove servo controller uses the PCA9685. That's the same chip that Adafruit use in their servo controllers, and they have a Python library to control it.
Better still, Adafruit have ported their Blinka library to the Pi and the Nano so you can use their family of CircuitPython libraries on the Pi and the Nano as well as the Adafruit CircuitPython boards. Awesome!
I installed the software following the instructions on the Adafruit website, by invoking
pip3 install adafruit-circuitpython-servokit --user
Since some of the Adafruit code uses gpio as well as I2C, I made sure I could access them all from my user account, and then rebooted to make the changes take effect:
sudo groupadd -f -r gpio
sudo usermod -a -G gpio $USER
sudo usermod -a -G i2c $USER
sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/
sudo reboot
Next I connected a servo to the servo controller, and ran some sample code from the Adafruit website:
import time
from adafruit_servokit import ServoKit
kit = ServoKit(channels=16)
kit.servo[0].angle = 180
time.sleep(1)
kit.servo[0].angle = 0
And lo - the servo moved!
In the next post I'll give more details about the Babelboards and how to build them.
If you want to keep an eye on what I'm up to, I'm @rareblog on Twitter.
Hey, might you be able to help me with connecting some other Grove Sensors to the Jetson Nano with a Grove Base HAT? I've been having trouble doing so, without out much useful help online.
ReplyDeleteAre you still having problems? If so, can you tell me which sensors you're trying to connect? I'll help if I can.
ReplyDelete