View Single Post
  #5   Spotlight this post!  
Unread 24-04-2010, 12:22
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: Joystick Assigning/ Change to Tank Drive

Just to add clarification to what byteit said, about the leftStick.GetY();

For the tank drive function accepts 2 float values.

What you said, is myRobot->TankDrive(stick,stick2); This is passing the 2 joysticks themselves, which would not work. Instead, you should pass their Y Values.

leftStick.GetY() returns a float value from -1(all the way foward) to 1 (all the way backwards).

So in order to drive the robot, (assuming everything else is correct) you would do this:

myRobot.TankDrive( leftStick.GetY(), rightStick.GetY() );

Note: You may need to make one of those values negative (put a "-" infront of one, such as -leftStick.GetY()) so the robot will drive straight when pushed full fowards, not turn.
Reply With Quote