|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Running two commands at once, but both commands use the same motors.
Quote:
|
|
#2
|
|||||
|
|||||
|
Re: Running two commands at once, but both commands use the same motors.
I'm not exactly sure what you are asking.
|
|
#3
|
||||
|
||||
|
Re: Running two commands at once, but both commands use the same motors.
For example, if the rotate to angle command said the front right wheel should have a speed of -1 it sets the speed. But, what if the drive command tells the same wheel to have a speed of 1 at the same time? Which one has priority?
|
|
#4
|
|||||
|
|||||
|
Re: Running two commands at once, but both commands use the same motors.
Both will attempt to tell it to drive at the different speeds and you will get erratic behavior from the motor, that is why it is a bad idea to have multiple commands attempting the run the same motors.
|
|
#5
|
||||
|
||||
|
Re: Running two commands at once, but both commands use the same motors.
Three things:
1) I assume you have a mecanum drivetrain? (there is no "h" in "mecanum") 2) If you want to drive in a straight line in any particular direction, and simultaneously rotate the bot to a desired angle, you can do that using mecanumDrive_Cartesian. Feed your gyro to the gyroAngle parameter; supply the x and y components of the desired straight-line field-centric motion to the x and y parameters; and feed the output of a closed-loop controller to the rotation parameter. The input to the controller will be your desired angle (setpoint) and your gyro reading (process variable). and finally, and perhaps most importantly: 3) Mechanical workmanship is of paramount importance. Make sure your drivetrain is built and aligned correctly before attempting #2 above. If you're not sure what "built and aligned correctly" means in the context of mecanum drive, I encourage you to ask before proceeding. |
|
#6
|
||||
|
||||
|
Re: Running two commands at once, but both commands use the same motors.
Quote:
2) Yeah, OK. I was thinking about it in a more complicated way i guess. I just really tried to copy-paste from our original rotate to angle command into the drive command and it didn't go so well. I will have to try that. Also, by closed loop, you mean PID? We have not implemented a PID loop into the robot yet, but plan on doing so once we have the basics down. Right now, if the robot overshoots the 0 degrees it rotates to, it just turns in the opposite direction with a slower speed. We have a tolerance of about 2 degrees on it right now which seems good for what we need. 3) Yeah, I get what you mean. We have field-centric drive working on a robot we used last year and then just stripped down to the bare minimum for what we need. The wheels are not perfectly aligned just from usage over the season and unseen measurement error by us. I will fix this issue soon. Thanks a bunch! - Drew (Team 2053 Programmer) |
|
#7
|
||||
|
||||
|
Re: Running two commands at once, but both commands use the same motors.
It doesn't have to be PID. It can be any form of closed loop control that does what you want.
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|