![]() That is precisely what kF does – it is a gain that is multiplied by the goal velocity, resulting in a corresponding output to achieve that velocity. Motion magic generates a trajectory that contains a desired velocity over time, and based on the system (motor, gear ratio, etc) we know how to figure out what output produces that desired velocity. That is, 100% output gives you full speed, 50% output gives you half speed, etc.įor motion magic (and generally any sort of motion profiling in FRC), we want to take advantage of this fact. What’s the purpose of having both? First, it’s important to note that for DC motors, the output speed of the motor at steady-state is roughly proportional to the applied output from the speed controller. arbitraryFeedForward is set every time a new command is sent to the motor, whereas kF is a gain you can set). There are also a few implementation differences (i.e. The functional difference between kF and arbitraryFeedForward is that kF is multiplied by the goal velocity before it is added to the final output, while arbitraryFeedForward is added directly to the output. Output = kP*error+kD*d_error+kI*i_error+kF*goal_velocity+arbitraryFeedForward The output from the controller to the motors with motion magic can be expressed roughly as: This means that the feedback gains can be much higher without inducing a lot of oscillation and unwanted behavior. In summary, by adding kF (veloctity-proportional feedforward), the output from the feedback term becomes very small compared to the total output. You just have to modulate the throttle and brake ever so slightly as to stay right beside your friend. With kF, you’ve now been given an electric bike, so most of the effort required is eliminated. You have to exert a lot of effort to keep up with your friend and prevent a gap from forming. Your friend is riding a bike, and you are trying to stay beside them. Now the closed loop has to do more work to keep the mechanism on the generated trajectory. You are skipping step 2 by setting the kF gain to zero. Motion Magic takes your current position, current velocity, goal position, velocity constraints and acceleration constraints, and determines a smooth profile for your mechanism to follow. Here’s a rough explanation of how Motion Magic works: With Motion Magic, you should be utilizing both feedforward and feedback. Rather, it is real-time motion profiling, where your mechanism is following a trajectory. Motion Magic is not traditional PID on position. MotionMagic PID Tuning Questions Programming both are using this targetPosition motion magic approach: ![]() We have a lift subsystem, which is the arm, and a wrist subsystem. Here’s our code if you’d like to take a look. With this approach, the closed loop is always running and all is well. We have buttons that, when pressed, change the targetPosition to a different value, then the loop detects this and recalls motion magic. A loop runs to see if targetPosition has changed, if so, it recalls the method to set motion magic. set() method to go to the targetPosition. The way I build the overall system was to have a variable called targetPosition and a method that runs the motion magic. Then, you can add the feedforward to help overcome gravity. ![]() You can add kD to dampen it a bit, but we didn’t have to (we geared 300:1 with lots of friction in our reduction). Add to it until it gets there without oscillation. So, first we set feedforward as 0 and set the kP gain so that the arm moves to the position. Well, feed forward will help, but your PID can be set so it works without it, and then you can add the feedforward to help it. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |