How do I activate S-Curve for TalonSRX

TalonSRX is controlled by CAN from Java.
How do I activate S-Curve?

The current code.

TalonSRX talon =new TalonSRX(0);


This should likely be posted under one of the programming subforums instead of here. Maybe a Mod can move it for you.

But in order to answer the question, you’ll need to provide a lot more information. Specifically, please define what you mean by “s-curve”. If referencing a specific feature of some component, please link to relevant documentation for that feature. If you’re referring to some programming paradigm/software design concept or software control system, then a link to something describing that would help as well.

It sounds like you are asking about utilizing motion profiling with the Talon. I believe, specifically, he’s asking about trapezoidal versus s-curve using motion magic. This was added in week 6 of 2019.

There is some information here:

It is also here:

In the future, please take the time to read the documentation on your hardware.


Thank you very much. Do I need an encoder in this case?

It’s dependent on what exactly “this case” is.

Most forms of closed-loop control involve a sensor to provide feedback.

An encoder is a very common choice for many FRC applications.

TL;DR: Maybe.

Almost certainly, although I’ve used Motion Magic without an encoder before just to make a simple movement smoother.

I want to slow down the drive to prevent sudden acceleration, but can I do without an encoder?

I think what you’re looking for is open loop ramping:

Basically this just means if you input 0 motor power in one step and full power a half second later, the motor controller will slowly increase the power to full over however long you specify rather than sharply accelerating.