Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Arcade Drive with Speed PID? (http://www.chiefdelphi.com/forums/showthread.php?t=105104)

Tanaythan 26-03-2012 23:35

Arcade Drive with Speed PID?
 
Hi all,

My team has decided that we want to use Speed PID because they think it will be better for fine tuning on the bridge. However, the only problem I see with it is that we have to use Arcade Drive because our driver prefers it over anything else. We use the CAN Speed settings on our jaguars to indicate our velocity and we are wondering if we can use RobotDrive with the Speed PID. Note we are also using Master/ Slave mode. Do we have to come up with our own algorithm to do Arcade Drive in master slave mode or can we just use some of the Robot Drive functions given to us?

Tommy.Brown 04-04-2012 12:45

Re: Arcade Drive with Speed PID?
 
From my experience, it will be most effective in the long run to completely create your own form of the drive code, it can still take in the inputs from the joysticks as Arcade Drive does, however you can take the values and figure out a PID setpoint and run the PID algorithm to calculate your motor speeds.

Joystick->PID->SpeedController

If you need any help with any of this I am very experienced with writing custom drive codes for robots, feel free to send me a message if you need help...

Ether 04-04-2012 13:16

Re: Arcade Drive with Speed PID?
 

C pseudocode for arcade



mikets 05-04-2012 15:17

Re: Arcade Drive with Speed PID?
 
Quote:

Originally Posted by rawrxp (Post 1149907)
Hi all,

My team has decided that we want to use Speed PID because they think it will be better for fine tuning on the bridge. However, the only problem I see with it is that we have to use Arcade Drive because our driver prefers it over anything else. We use the CAN Speed settings on our jaguars to indicate our velocity and we are wondering if we can use RobotDrive with the Speed PID. Note we are also using Master/ Slave mode. Do we have to come up with our own algorithm to do Arcade Drive in master slave mode or can we just use some of the Robot Drive functions given to us?

By Speed PID, do you mean using the CAN Jaguar kSpeed control mode? If so, you should be able to use RobotDrive::ArcadeDrive with speed control mode. According to the code, you should be able to call RobotDrive::SetMaxOutput to set the maximum speed of your robot and then just feed RobotDrive::ArcadeDrive with your joystick values that's in the range of -1.0 to 1.0, the SetLeftRightMotorOutputs() code in RobotDrive will scale your -1.0 to 1.0 range to your -maxOutput to maxOutput range which is your speed range.

Ether 05-04-2012 16:45

Re: Arcade Drive with Speed PID?
 
Quote:

Originally Posted by mikets (Post 1154617)
By Speed PID, do you mean using the CAN Jaguar kSpeed control mode? If so, you should be able to use RobotDrive::ArcadeDrive with speed control mode. According to the code, you should be able to call RobotDrive::SetMaxOutput to set the maximum speed of your robot and then just feed RobotDrive::ArcadeDrive with your joystick values that's in the range of -1.0 to 1.0, the SetLeftRightMotorOutputs() code in RobotDrive will scale your -1.0 to 1.0 range to your -maxOutput to maxOutput range which is your speed range.

If no rotation is being commanded and the vehicle is traveling in a straight line, you could do that.

Otherwise, it wouldn't work very well.

The input commands to an arcade algorithm are vehicle forward speed and vehicle rotational speed.

The arcade algorithm performs a reverse kinematic calculation on those commands to determine the necessary left and right wheel speeds to give the commanded vehicle motion.

The signals from the 2 wheel encoders are left and right wheel speed.

In order to obtain a usable process variable to do what you have suggested, you would have to reverse-engineer the PID's reverse kinematic calculation to obtain a forward kinematic calculation, which you would then apply to the encoder signals to obtain estimated vehicle forward speed which could be used as a process variable.

It would probably be a lot easier and cleaner to just write your own arcade code, and close the loop on left and right wheel speeds directly.



bob.wolff68 05-04-2012 18:32

Re: Arcade Drive with Speed PID?
 
Ether,

Your website link didn't work for me last time nor this time. Any thoughts? Anyone else unable to click to those links?

bob

Ether 05-04-2012 18:51

Re: Arcade Drive with Speed PID?
 
Quote:

Originally Posted by bob.wolff68 (Post 1154694)
Ether,

Your website link didn't work for me last time nor this time. Any thoughts? Anyone else unable to click to those links?

bob

Thanks for letting me know.

I just added a "www" to the link. Let me know if that fixes it.

If not, I'll find a different web host.



bob.wolff68 05-04-2012 20:16

Re: Arcade Drive with Speed PID?
 
No go. Didn't help. :-(

bob

Ether 05-04-2012 22:03

Re: Arcade Drive with Speed PID?
 
Quote:

Originally Posted by bob.wolff68 (Post 1154722)
No go. Didn't help. :-(

bob

OK, I uploaded to CD media:

http://www.chiefdelphi.com/media/papers/2661




All times are GMT -5. The time now is 12:57.

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