Looping through a CSV file for Motion Profiling with The TalonSRX

True with robotics “It never ends”. I have started to attempt to figure out the TalonSRX motionProfiling. One thing I have notice so far is that looping through the CSV file can take a considerable amount of time specially if processing for two motors on drivetrain.

What are some strategies to speed up this process?

I hope my interpretation of the manual here next and what I believe maybe a solution comes across coherently…

Referring to the archived MP manual https://github.com/CrossTheRoadElec/Phoenix-Documentation/blob/master/Legacy/Talon%20SRX%20Motion%20Profile%20Reference%20Manual.pdf

The Section that is tripping me up is here:

6.7.2.Checking the Motion Profile Status – Java
See Section 5.2 for example function call. Checking the status is necessary for…
• Determining that a sufficient number of trajectory points are in the MPB before activating
the MPE.
• Determining when the MPE is in enable/disable/hold, after robot application has
changed the desired state using set().
• Confirming MPE is in disable/hold before calling the clear and push routines for buffering
trajectory points for the next motion profile. It is important to confirm that MPE is no
longer interacting with MPB, before inserting new points into the MPB.

My understanding is the _talon.pushMotionProfileTrajectory(point) pushes points into “Toplevel” or API-level buffer and can hold 2048 points (this is the CSV LOOP)

The MPB can hold up to 128 trajectory points

My understanging is the _talon.processMotionProfileBuffer() must stream the API-level buffer to the MPB keeping the buffer full for the Executer.

Can I continue to add points to the API-level buffer after the MPE is enabled? Bullet point #3 on 6.7.2 states the “MPE must be NOT Enabled”. Or is adding points to the currently running API-level buffer ok but if there is a new profile que’ed up in the robot we must wait untill the talon is done before starting the new profile.

If its ok to read the CSV file and push points into the API-level buffer then creating a new processes for this task would allow the robot to start the MPE after processing enough points. 6.5.1 leads me to believe I can periodically call pushMotionProfileTrajectory () to stream the profile into the API as long as I don’t exceed 2048 points buffered as the MPE and _talon.processMotionProfileBuffer() work to run the motor.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.