FIRST-Team-2557-The-SOTABots / FRC_Robot2.0

Deprecated
1 stars 0 forks source link

Curved trajectory paths #30

Open Philanatidae opened 6 years ago

Philanatidae commented 6 years ago

When this was attempted before, it didn't work that well. This may have been due to the PID values for the motion profiling not yet being fully tuned (jittery and the bot didn't follow the path straight). They have been now, the path following is pretty smooth on both the comp bot and practice bot. Curved paths weren't attempted after this because of the time crunch before Auburn.

The code for this was written before (see this version of MotionProfileCommand.java, though with the un-tuned PIDVA values so that will need to be updated) but it was changed before Auburn to just handle straight paths (single follower w/ gyro correction). After browsing Chief Delphi I found this post by Jaci. Her idea is to combine the left and right trajectories with gyro correction to minimize errors when the robot is following the path (it also explains the PIDVA values that MotionProfileCommand.java uses). Her code may need to be thought through to work correctly on the practice & comp bots.

It would be a great advantage for later competitions if it can be pulled off. Instead of slowing to a stop before the scale and turning 45°, the path can be modified to just end facing 45° towards the scale (currently this takes 10 seconds to do, which is 2/3 of the auto time). This allows for extra time to turn and pick up a second cube, or quicken the left side of the switch when in the mid placement, for example.

If there is extra time after the current autos have been fleshed out (that is first priority, perhaps before the District Championship or Houston would be a good milestone) curved paths could be attempted again. It would, at the very least, be a good project to attempt during 2019 pre-season if it doesn't happen this season.

(full thread on Chief Delphi)

liloheinrich commented 6 years ago

I’ll make another motion profile command that has the right and left followers and incorporate the code to use the gyro shown on Jaci’s github at https://github.com/JacisNonsense/Pathfinder/wiki/Pathfinder-for-FRC---Java

Philanatidae commented 6 years ago

That sounds good. She suggests that Kp for the PIDVA values be quite high; when we tried this during the week I was there, this resulted in jerky movement. That is most likely due to the robot outpacing the path, which can be fixed by lowering Kp. I think on the day before the comp we tuned it to around 0.4? It needs to be the highest without jerkiness, accuracy doesn't matter so much so long as it has precision (same place each time).

If the turning still doesn't work, make sure that the maximum acceleration is used in the trajectory config. Since the left/right drive change their velocity, it needs to do this as fast as possible to actually follow the path. If the acceleration is too low, the bot won't react very well to the path.