We've hacked together a C# program 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")

(ps: Its a Visual Studio 2005 project - We can post a copy once its been cleaned up.)

## No comments:

## Post a Comment