Saturday, December 5, 2009

Robotics: GARY: Wiimote Controlled Robotics


[ GARY with Eb500 Bluetooth Module and Wiimote ]

This was a project I did a while back. I used my laptops Kingston USB Bluetooth Card and a Eb500 Bluetooth module to interface wireless communication with my robot, GARY.

At first I wrote simple control apps which either had buttons that needed mouse input or utilized the directional arrows on the keyboard to accept commands.

However, as time went by these programs improved. I started using a Wired Xbox 360 controller to send commands to the robot, and then finally it struck me. A Wiimote! I had already used the Wiimote with my computer before this. I wrote a program which used with a DIY Wii sensor bar allowed me to use a Wiimote to control my laptops mouse, including mapping the left, right, and double click actions to various buttons on the controller.

Utilizing the software classes I had already wrote to interface with the Wiimote's Accelerometers I was able to write new software for GARY and my computer to allow the Wiimote to control GARY using my Laptop as a "hub" to boost the signal range of the Bluetooth setup.

To ensure that the motion of the robot would be as smooth as possible I developed "Predicted Acceleration Curves" for each of the robots two drive motors.


[ Predicted Acceleration Curves ]

Note:
  • Curves for the left motor displayed with solid lines, the right motor with dashed.
  • Red lines are for the Wiimotes X Axis, and control forwards/backwards motion.
  • Blue lines are for the Wiimotes Y Axis, and control left/right motion.
  • The Wiimote's Accelerometers (Graph X Axis) Go from -100% to 100%.
  • The Robot's two drive motors (Graph Y Axis) Accept speed values from 650 to 850, where 750 is stationary.
By using these curves at run time the robot was able to generate the correct speeds for each of its motors to ensure smooth motion. This is done by solving each of the four curves for the value given by the Wiimotes Accelerometers, then averaging each side. eg. Averaging the motion and turn curve values for the left side yields the final speed for the left motor; and averaging the motion and turn curve values for the right side yields the final speed for the right motor.

Here is a video of the software and robot in action.

Enjoy!



No comments: