TalonSRX Motion Trajectory Profiling


#1

Hello! Were trying to program motion profiling using path trajectories. We’ve been trying to use the robotpy-ctre library, that contains the *WPI_TalonSRX * class - which we use to declare the TalonSRX motor controller.

We saw inside the documentation that robotpy-ctre library contains the *BaseMotorController * class, that should contain functions such as pushMotionProfileTrajectory(trajPt) that should push the motion profile trajectory into the high-buffer. This way the trajectory should finally reach the Talon, after processing the motion profile buffer using the processMotionProfileBuffer() function.

This should all theoretically work, but we’ve noticed that most of these functions are not implemented and just raise NotImplementedError. Are those functions going to be implemented in the near future, or are they deprecated? If so, are there any other alternatives? We’ve also looked at pathfinder for robotpy but knowing that using motion profiling trajectories with the TalonSRX has a faster updating rate of 1ms as opposed to the average and mostly uneven 15ms of the roboRIO - it’s not a viable alternative for us.
Thanks in advance!


#2

That all should work, I believe that I used them last season. Are you running on the sim? CTRE stuff is not very well supported in sim, especially most features of the Talon SRX.

Second, if you use TimedRobot (now the default for 2019) as your base class, the main loop will run at 20 ms. You can use the PIDController class or implement your own control loops using Notifier to get higher speeds (though 1kHz is excessive, especially on the roboRIO.)

Third, 50 Hz (20ms) is not that slow of a control loop. Just saying. Many teams have implemented great auto modes with a worse controller (cRIO.)


#3

There is an open issue for implementing the motion profiling functionality in simulation. Contributions welcome. https://github.com/robotpy/robotpy-ctre/issues/51


#4

As the others said, all of the functionality of the CTRE motor controllers is implemented for the RoboRIO, but some of it doesn’t work in simulation yet.

Thanks for the feedback! I’ve added a bug to remind us to add a more informational message for next season: https://github.com/robotpy/robotpy-ctre/issues/78


#5

In case it’s not a sim error, we had the same problem last season using an early version of the phoenix framework. Something about they hadn’t fully implemented all the features in the first release. I’d suggest that you check the firmware on the talons, rio and computer is the latest version.
Using python however I’m not sure how much help this is as we program in Java. I still recommend updating the firmware on the talon tho.