SPARK MAX Smart Motion in LabVIEW

I am having a hard time finding any LabVIEW examples or documentation for the Smart Motion feature of the SPARK MAX. Smart Motion is included in the list on REV’s Code Examples page, but there is no example in the github repository. Does anyone have any LabVIEW examples or documentation for how Smart Motion works?

There are some examples built into the SPARK MAX pallet in LabVIEW. If you go to REV Robotics --> SPARK MAX --> Examples there is a Smart Motion example including some dials and instructions you can use for tuning.

image

This is what it looks like after I added this to Periodic Tasks.vi

You can use some of the gains from here as a starting point

Ah! Thanks for the quick reply! I was looking in the wrong place.

So how does this Smart Motion feature relate to velocity closed-loop control and position closed-loop control?

Am I right to say that Smart Motion is better suited for controlling a mechanism rather than a drivetrain?

And do you have any examples or documentation for how these are used? -
image

The documentation is also built in, the same way that the WPILib VIs are documented. While on the block diagram, press ‘Ctrl-H’ then hover over the VI (either in the pallet or on the block diagram).

We use those VIs in the example, which should help show them in context.

Yes, and it is designed for position control. Specifically it is well suited for any (linear) ‘single input single output’ system. Arms, elevators, swerve steering axis, etc.

The drivetrain itself is a ‘multi-input multi-output’ system, and are typically better suited by using a central processor to coordinate the two sides using other sensor feedback such as gyros. Each side of the drivetrain can use the onboard Velocity PID for its own speed.

That makes sense. Thanks, Will.

I see the Set PIDF, Configure Smart Motion, Get Sensor Velocity, Get Sensor Position, Set Applied Output, and Set Output Advanced VIs in the Smart Motion example, but I do not see the Smart Motion VIs I posted above. Am I missing something?

A search of all functions does not even return the “Spark MAX Configure Smart Motion” VI.

Are you asking where to find the VIs in the pallet, or how they are used in the VI? Not every VI there is used in that example. The one ‘Config Smart Motion’ is a shortcut for the other VIs (you’ll see that cluster input contains most of the relevant parameters).

Here is the location in the pallet
image

I’m realizing that the ‘Spark MAX Configure Smart Motion’ VI is not in the pallet. We will add that to our issue tracker and get that fixed. For now you can copy is from the example and just delete the rest of it.

Sorry, when you said “We use those VIs in the example”, I thought you meant that you used the Smart Motion VIs shown in my image in the example.

Thanks for the clarification!

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