Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   RobotPy doesn't PWM? (http://www.chiefdelphi.com/forums/showthread.php?t=133044)

team-4480 17-01-2015 12:10

RobotPy doesn't PWM?
 
Hi! We have our robot driving with robotpy! But we have a major problem. The robot doesn't slow down when we set it to .125 or something like that. Code: http://pastebin.com/PqNEPmY5. Any help will be greatly appreciated! Thanks a bunch in advance!

RufflesRidge 17-01-2015 12:41

Re: RobotPy doesn't PWM?
 
I don't know Python, but I can tell you what the issue is based on WPILib. The code you have posted will construct two speed controllers, set their outputs to .125, construct a Robot Drive out of those speed controllers, then in Teleop set their outputs based on the joystick value.

Reading the above,you may notice that setting their outputs to .125 there doesn't really accomplish much.

If you want to scale your joystick values, you need to get the joystick values (using getX and getY) scale them, then pass them into an alternate version of the ArcadeDrive method that takes doubles as parameters.

team-4480 17-01-2015 13:05

Re: RobotPy doesn't PWM?
 
Quote:

Originally Posted by RufflesRidge (Post 1429615)
I don't know Python, but I can tell you what the issue is based on WPILib. The code you have posted will construct two speed controllers, set their outputs to .125, construct a Robot Drive out of those speed controllers, then in Teleop set their outputs based on the joystick value.

Reading the above,you may notice that setting their outputs to .125 there doesn't really accomplish much.

If you want to scale your joystick values, you need to get the joystick values (using getX and getY) scale them, then pass them into an alternate version of the ArcadeDrive method that takes doubles as parameters.

So I exchanged the old arcadedrive for "self.robot_drive.arcadeDrive(self.stick.getX(),se lf.stick.getY())" but it still doesn't slow down.

RufflesRidge 17-01-2015 13:09

Re: RobotPy doesn't PWM?
 
Quote:

Originally Posted by team-4480 (Post 1429633)
So I exchanged the old arcadedrive for "self.robot_drive.arcadeDrive(self.stick.getX(),se lf.stick.getY())" but it still doesn't slow down.

Closer, but that's still missing the "scale them" part. Try arcadeDrive(.125*self.stickgetX(),.125*self.stick. getY()). That should scale the joystick values down by a factor of 8 (what it looks like you were trying to do) before passing them to the arcadeDrive method.

team-4480 17-01-2015 14:29

Re: RobotPy doesn't PWM?
 
Quote:

Originally Posted by RufflesRidge (Post 1429636)
Closer, but that's still missing the "scale them" part. Try arcadeDrive(.125*self.stickgetX(),.125*self.stick. getY()). That should scale the joystick values down by a factor of 8 (what it looks like you were trying to do) before passing them to the arcadeDrive method.

Thanks! It worked!


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