ligerbots / Steamworks2017Robot

LigerBots robot code for FIRST Robotics Competition Steamworks
MIT License
2 stars 1 forks source link

Driving by more complex paths #15

Closed xeniarose closed 7 years ago

xeniarose commented 7 years ago

Last year auto driving consisted of straight-line driving for long distances and in-place turns. This is slow. We could improve driving by generating and following more complex paths that allow the robot to drive forward and turn at the same time.

Here's relevant Cheesy Poofs code: https://github.com/Team254/FRC-2016-Public/blob/master/src/com/team254/lib/util/AdaptivePurePursuitController.java

cbf66 commented 7 years ago

So as far as I can tell, the Cheesy Poof's implementation of this does not take advantage of the Talon SRX's support for Motion Profiles The Cheesy Poof's seem to have rolled their own version of this. But I don't see any reason why we can't use their AdaptivePursuitController.java class, virtually as is, but feed the generated trajectory points to the Talon SRX's motion profile buffer. Note that this will require a control loop running much faster than the robot's normal 50 Hz. CTRE recommends 200HZ:

"A conservative approach is to call the routine twice as fast as the MP. For example, if the MP uses 10ms trajectory points, therefore the notifier task that calls processMotionProfileBuffer() is set to fire every 5ms to ensure it has sufficient opportunity to funnel trajectory points into the Talon.

Typically, this can be done by creating a thread or task that calls the processMotionProfileBuffer()member function of the CANTalon object."

But as far as I can tell, the Cheesy Poofs "Looper" class, operates at only 100Hz (line 46 through 49 in Drive.java). I'm a little surprised that they don't have some provision for having loops at different polling rates, so I presume I've missed something here.

xeniarose commented 7 years ago

Currently, the day-old implementation of Catmull-Rom splines / path following is working pretty well