Our team has been trying to work with motion profiling on our new Falcon 500 motors.
First, we looked up example LabVIEW code for motion profiling with talons, and read the manual.
Then we generated a csv file with Path Planner. We generated a path that would move the bot about 5ft. Then we exported a csv file in this order:
position left, velocity left, duration left, position right, velocity right, duration right. GitHub - mjansen4857/pathplanner: A simple yet powerful motion profile generator for FRC robots
-Then we put the example code that sets the motion profile paths in begin. We set the code that runs the motion profile in periodic tasks.
(Ill post screen shots below so you can look closer)
The motion profile starts when we just press down a button. There is also identical code for both sides of the robot. (Left and Right).
So far when we ran the code, only the left side of our robot’s wheels would move, and it didn’t seem to stop when we ran the motion profile.
We aren’t sure where the problem is in our code, so any sort of help would be appreciated!
If you need any more details on how we coded our motion profiling, feel free to ask.
Make sure encoder values are at zero when MP start. Bad starting encoder values can make the motor run continuously.
Use a “one shot button” to start the MP. If you are just feeding a button value into “runMotionProfile” then you are probably starting it multiple times as you press the button.
Have you set your PID values for your left and right motors? If all the PIDs are zero then the motor won’t move.
Is the example above only half of your code? Meaning - are you doing the exact same thing for the right side motion profile? We are trying to do something very similar, and we’re finding that we cannot Start Motion Profile for our two sides and get consistent results. One side will run to completion of the profile, and the other will underrun (with dynamic results similar to what you have described). The “successful” side will alternate randomly from left to right. We’ve also tried delaying the start of the second Motion Profile but that doesn’t improve reliability. If we only Start Motion Profile for one side then it will run thru the complete profile with 100% repeatability, so I’m pretty darn confident it’s not a closed-loop tuning issue; it seems more like a CAN bus communications issue I suppose.
ETA: the documentation (at least for LabVIEW teams) for the SRX (Falcon) seems to have really gone down hill. The only detailed info I can find on how Motion Profiling is supposed to work is from 2016-2018 and it’s almost irrelevant in 2020 due to all the changes. /rant
ETA2: I’ve dug into the CTRE-provided “remote closed loop” example on GitHub. I’m sure if we spent 1/2 a day on it we could adopt a variant of it, but jeez that’s not trivial to implement. We’ve been doing motion profiling using LabVIEW since 2010 so we were hoping that switching to a Falcon-based equivalent would be easier to implement - not harder. I guess we’re going to have to go back to that for Week 1. /rant