|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: 95's Pre-season drive base done!
Hello I'm Grayson! On this project I helped out a little bit with a lot of different parts, including machining, CADing, and assembly. My main contribution was putting together most of the left (I think) drive pod and doing the chains (which took me longer than I care to admit
) |
|
#2
|
||||
|
||||
|
Re: 95's Pre-season drive base done!
As far as controlling that setup with a PID, I would use two separate PIDs for each side of the drive train, and control them via speed. Also, because you will be changing the setpoint a lot, I'd remove the derivative term from the equation, because that's just going to provide a large unintended movement every time you quickly move the joysticks.
Also, be sure to reset your integral term every time target speed = 0 and current speed = 0 (or close to it), or else after a bit of driving your robot, it will begin to overshoot your speed every time. As far as gear changes go, I'd have it default to low gear and if speed >= n ft/s, shift to high gear, and change the PI controller values, and joystick_input_to_target_speed_conversion algorithm accordingly. And that's not to say you can't use a position mode during autonomous, but for teleop, that becomes very weird because you need to integrate change in distance based on the joystick values, which will tend to lead to a lot of overshoot. |
|
#3
|
||||
|
||||
|
Re: 95's Pre-season drive base done!
Actually, after thing about it, what I said probably would not work well at all, mainly because PID controllers don't work well when using speed as a set-point for something that isn't a flywheel.
However, you may be able to do something like this.(pardon my python-esque syntax, I'm not a C++ or Java programmer) c is a constant set to make the robot not try to turn at say 13.5FPS at full turn. if steering_axis_last != 0 AND steering_axis = 0 left_encoder.resetdistance() right_encoder.resetdistance()if steering_axis == 0: left_error = ((left_encoder_distance + right_encoder_distance)/2 - left_encoder_distance) + (throttle_axis* robot_max_speed * dt) right_error = ((left_encoder_distance + right_encoder_distance)/2 - right_encoder_distance) + (throttle_axis* robot_max_speed * dt)else: left_error = left_encoder_distance + (throttle_axis* robot_max_speed * dt) + (steering_axis * c * robot_max_speed) if left_error > robot_max_speed * dt left_error = robot_max_speed * dt if left_error < -(robot_max_speed * dt) left_error = -(robot_max_speed * dt) right_error = right_encoder_distance + (throttle_axis* robot_max_speed * dt) - (steering_axis * c * robot_max_speed) if right_error > robot_max_speed * dt right_error = robot_max_speed * dt elif right_error < -(robot_max_speed * dt) left_motor = p_constant*left_error + i_constant*left_errorright_error = -(robot_max_speed * dt) right_motor = p_constant*right_error + i_constant*right_error steering_axis_last = steering_axis |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|