View Full Version : How to use a fifth drive motor with RobotPy?
team-4480
18-01-2015, 17:17
Hi! We hit a problem with our robot code. We got it to drive with a normal chassis that has one motor on each side like a tank. But now we want to use our new Omni wheels(http://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Yhst-33833170891817_1977_3727729.jpg/300px-Yhst-33833170891817_1977_3727729.jpg) with one motor on each side and then one in the middle perpendicular to the other motors so we can strafe sideways. Anyways, our problem is how do we set the fifth motor(The one perpendicular to the side motors) to be the x-axis on the controller. We also need the side motors to only be able to go forward or backward(y-axis). We are using a joystick for the controls. Thanks a bunch in advance!
x86_4819
18-01-2015, 18:27
To do this you will need to do the following:
Initialize the new motor controller object in robotInit():
self.slide_motor = wpilib.Talon(INSERT_PORT_NUMBER_HERE)
If your motor controller is something other than a Talon, you will need to adjust accordingly.
Use the x-axis of the Joystick to control the motor in teleopPeriodic():
self.slide_motor.set(self.joystick.getX())
I hope this works for you!
team-4480
18-01-2015, 18:34
To do this you will need to do the following:
Initialize the new motor controller object in robotInit():
self.slide_motor = wpilib.Talon(INSERT_PORT_NUMBER_HERE)
If your motor controller is something other than a Talon, you will need to adjust accordingly.
Use the x-axis of the Joystick to control the motor in teleopPeriodic():
self.slide_motor.set(self.joystick.getX())
I hope this works for you!
So then for the side motors, it would be self.side_motor.set(self.joystick.getY())? We will try it Monday!
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.