View Single Post
  #5   Spotlight this post!  
Unread 05-04-2012, 16:45
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,062
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Arcade Drive with Speed PID?

Quote:
Originally Posted by mikets View Post
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.



Last edited by Ether : 05-04-2012 at 18:49.
Reply With Quote