Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Silly question about controlling motors (http://www.chiefdelphi.com/forums/showthread.php?t=111894)

ZeroCoder 23-01-2013 17:30

Silly question about controlling motors
 
So I'm using the RobotDrive class and two Jaguar motor controllers to control out robot. In tank drive mode, I'm periodically calling RobotDrive.tankDrive(leftJoystick, rightJoystick).

My problem is that the direction of the motors is inverted with respect to the joystick axis. In other words, if I push the joysticks forward, the robot goes backwards, and vise versa. I know I can just invert the motors in the code, but my OCDness is telling me that it should be working correctly by default.

The left joystick is properly corresponding to the left motor controller and the same goes for the right side. Basically, if I push the left stick forward, I get a negative voltage reading on the output of the left jaguar. If I push the left stick backwards, I get a positive voltage reading on the jaguar output.

Any ideas what could be causing this?

Mark McLeod 23-01-2013 17:34

Re: Silly question about controlling motors
 
It's an industry standard that's tripping you up.
Joysticks came from the flight simulator genre where forward on the stick puts the nose of the aircraft down or (-1), up is pull back (+1).


How about doing to the Setup tab on the Driver Station and reversing the order of joystick 1 and joystick 2?

ZeroCoder 23-01-2013 18:10

Re: Silly question about controlling motors
 
Quote:

Originally Posted by Mark McLeod (Post 1220696)
How about doing to the Setup tab on the Driver Station and reversing the order of joystick 1 and joystick 2?

Wouldn't that make the left stick control the right side and the right stick control the left side?

Mark McLeod 23-01-2013 18:19

Re: Silly question about controlling motors
 
Yea, that was pretty silly. I was thinking about something else entirely and crossed wires.
That would work, but it would change which end was the front of the robot.

Turning the joysticks around to face the back of the plane would work :)

omalleyj 24-01-2013 10:47

Re: Silly question about controlling motors
 
Quote:

Originally Posted by ZeroCoder (Post 1220694)
I know I can just invert the motors in the code, but my OCDness is telling me that it should be working correctly by default.

Any ideas what could be causing this?

The RobotDrive code has no way to know whether your motors and transmissions end up with the wheels spinning forward for positive or not. I suspect that it defaults to the kit-bot orientation to make things easy on new teams.

The first thing I have the students do when we code the drivetrain is put the chassis on blocks and see what happens this year. :)

omalleyj 24-01-2013 10:57

Re: Silly question about controlling motors
 
BTW, When I wonder what the heck is going on in wpilibj, I find looking at the source code is enlightening/interesting/scary depending on the day.

I recommend you opening wpilibj as a project and browsing through the RobotDrive.tankDrive source, or whatever other classes and methods you are using. It doesn't always help but sometimes it can be a real benefit.

Good luck!


All times are GMT -5. The time now is 10:08.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi