C# “Software Joystick”

We’ve hacked together a C# program in Visual Studio 2005  that writes motor commands like #+20-15; (motor 1 200 forward, motor 2 150 reverse). The serial port has Xbee connected to it. The only tricky part was the motor equations below.
double radians = Math.Atan2(dy, dx);radians = radians + Math.PI / 2;
m1 = (int)(Math.Abs(dx) * Math.Sin(radians) + Math.Abs(dy) * Math.Cos(radians));
m2 = (int)(Math.Abs(dy) * Math.Cos(radians) – Math.Abs(dx) * Math.Sin(radians));
(Equations from David “Wild Shot”)
Eventually we abandon the idea of control with a PC and created our own remote control with a second Arduino Duemilanove, XBee shield, XBee and Wii nunchuck. Thanks to ThingM (http://thingm.com/ and fungizmos.com (http://store.fungizmos.com/) getting the Wii nunchuck was easier to get working then getting the old-school PC joystick that we tried too.  
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: