![]() |
Tank Drive is backwards
Ok, I have a strange issue that makes me think that my joysticks Y axies are 'inverted'. Here's the deal, I'm driving with code like this:
m_robotDrive->TankDrive(LeftJoystick, RightJoystick); I know that my left and right joysticks are defined correctly because the buttons of each control the desired actions. However, the drive train output isn't correct. When I press forward on the left joystick, the left hand jaguar leds turn RED and the left motors run backwards. Similarly, when I move the right joystick forward, the right side motors run backwards and the leds are again RED. Moving the joysticks backward, cause the respective motors to run forward and the jaguar LEDs turn GREEN. Now, obviously I could rewire the motors to get the robot to travel in the correct direction. But shouldn't the LEDs be GREEN for FORWARD and RED for REVERSE? |
Re: Tank Drive is backwards
The Y axis value for a standard joystick is indeed "inverted" from what most non-pilots would expect. Forward is negative.
|
Re: Tank Drive is backwards
the colors mean nothing. it basically means the flow of electricity.
you shouldn't judge the movement of the robot by the colors. i would change the power to the motors that way when u run autonomous, you have code like... myRobot.Drive(1.0,1.0);//for forward instead of myRobot.Drive(1.0,-1.0);// for forward this makes it easier from a coding standpoint |
Re: Tank Drive is backwards
Quote:
myRobot.TankDrive(1.0,1.0);//for forward instead of myRobot.TankDrive(-1.0,-1.0);// for forward |
Re: Tank Drive is backwards
Quote:
But obivously, we want our drivers to push the stick (yoke) forward to drive the robot forward. So, full forward on the stick is -1.0 on the Y-axis? OK, then robotDrive.SetLeftRightMotorSpeeds(-1.0, -1.0) is supposed to drive the robot forward? It just seems counter intuitive to me, but I've recently rejoined the team after a two year absence - so my thinking may be a bit "old school". |
Re: Tank Drive is backwards
Quote:
So, please correct me if I'm wrong.. If we used the RobotDrive class, we have to think of "forward" as the "negative" direction? Sounds just like the economony? :) |
Re: Tank Drive is backwards
I think I'm going to try something like this later today:
Code:
|
Re: Tank Drive is backwards
The invert is the answer. Forget about the colors. If you add 1 gear the direction is reversed. Add 2 reversed again.
The Joystick is -1 for full forward. It does not make sense except at a binary level reverse has (-1) more bits on than forward. |
Re: Tank Drive is backwards
here is exactly what i did.
Joystick leftstick; Joystick rightstick; Victor *left; Victor *right; left = new Victor(4,1); right = new Victor(4,2); float leftdrive = leftstick.Get();//do the same with the right and you can change the joystick values to make say halfspeed by dividing by 2 left->Set(leftdrive); |
Re: Tank Drive is backwards
You can do it either by telling RobotDrive to "invert" the motors, or using whatabouteve's example. I personally prefer the latter because it allows your program to very easily hook into your drive code(i.e.you don't have to re-do your ramping system for when the robot is running on camera tracking)
|
Re: Tank Drive is backwards
Couldn't you also do the following:
drive = new RobotDrive(1, 2); float leftSpeed = -leftStick.Get(); float rightSpeed = -rightStick.Get(); drive->TankDrive(leftSpeed, rightSpeed); That's similar to what I've done at the moment. It's not as "proper" as SetInvertedMotor, but it appears to work. |
Re: Tank Drive is backwards
I would just go with taking the joysticks and flipping them backwards
|
Re: Tank Drive is backwards
You could always reverse the wiring on your bot so that it matches up with the joysticks. That would probably be the easiest solution and the best if you're really short on time. But if you have time before your next competition and can edit your code, multiply the values of the y-axis of the joysticks by -1 whenever you input them. That should fix your problem without adding too much extra code.
|
Re: Tank Drive is backwards
Quote:
|
Re: Tank Drive is backwards
Quote:
|
| All times are GMT -5. The time now is 11:25. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi