|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||||
|
|||||
|
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? Last edited by Mark McLeod : 23-01-2013 at 17:48. |
|
#3
|
|||
|
|||
|
Re: Silly question about controlling motors
Wouldn't that make the left stick control the right side and the right stick control the left side?
|
|
#4
|
|||||
|
|||||
|
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 ![]() Last edited by Mark McLeod : 24-01-2013 at 10:49. |
|
#5
|
|||
|
|||
|
Re: Silly question about controlling motors
Quote:
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. ![]() |
|
#6
|
|||
|
|||
|
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! |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|