Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   How to use a fifth drive motor with RobotPy? (http://www.chiefdelphi.com/forums/showthread.php?t=133136)

team-4480 18-01-2015 17:17

How to use a fifth drive motor with RobotPy?
 
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/wikipedi...77_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

Re: How to use a fifth drive motor with RobotPy?
 
To do this you will need to do the following:

Initialize the new motor controller object in robotInit():
Code:

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():
Code:

self.slide_motor.set(self.joystick.getX())
I hope this works for you!

team-4480 18-01-2015 18:34

Re: How to use a fifth drive motor with RobotPy?
 
Quote:

Originally Posted by x86_4819 (Post 1430284)
To do this you will need to do the following:

Initialize the new motor controller object in robotInit():
Code:

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():
Code:

self.slide_motor.set(self.joystick.getX())
I hope this works for you!

So then for the side motors, it would be
Code:

self.side_motor.set(self.joystick.getY())
? We will try it Monday!


All times are GMT -5. The time now is 02:45.

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