I’ve “finished” a “functional” rc car, basically rebuilding the toy car I took apart months earlier but with in a more fine tuned but limited fashion. Currently it can drive (servo steering and motor control) under the direction of an Xbox 360 controller but it’s total range of motion is ~7 inches since it is still tethered to the power supply (and Beaglebone-USB-Computer).
In order to enable that functionality I made quite a bit of progress on the car and I’m nearing completion of the working, driving car (albeit dependent on a power supply and tethered to a computer). Electronics need to be moved onto more permanent circuit boards (probably 1980’s style through-hole point-to-point perfboard) and the autonomous portion can start to take shape.
Steering limit switches
Earlier I built the servo steering mechanism. One problem I ran into was centering the servo. I neither could nor wanted to depend on a perfect physical mount especially since the linkage between the servo arm and the steering rack was loose anyway (to make it more durable). My solution was to mount switches on the steering rack that pressed when the steering turned to the farthest position either left or right.
Right now I’ve been too lazy to program interrupts into my teleop script but the steering program uses the switches on initialization to find the far left and right positions as well was averaging them to find the center.
Later I plan on using interrupts make sure the steering doesn’t go too far to either side during operation because the servo could get displaced after initialization. The “live” interrupts also ensure that the car has the fullest range of motion.
Motor control
I am also using PWM control to vary the speed of the motor controller (much like how you control the brightness of the LED). By turning the motor on and off faster than the response time of the circuit, I can change the effective voltage applied to the motor.
ROS Code
After connecting my Xbox controller with the BBB, I hacked together a ROSNode for teleop control of the Beaglecar. I used the left joystick’s x/horizontal axis to steer and the right joystick’s y/vertical axis to control motor speed.
The code can also be found on my Github
Next steps
Setting up the teleop was fun but it was severely limited by the 8 inch long jumper cables I used to power the BBB and the car. I’m working on moving things off the breadboard and start soldering onto perfboards or maybe even etched pcb’s (probably not). After things are separated I can work on mounting them to the car and using battery power. Then I’ll have all the functionality of the original car + limited range (Xbox controller cord)! Eventually I will add in wireless capabilities (wifi or bluetooth or cheap fm transmitter?) and the actual autonomous driving portion.