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);

talon.set(ControlMode.PercentOutput,0.2);

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:
https://readthedocs.org/projects/phoenix-documentation/downloads/pdf/latest/

It is also here:
https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html

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

2 Likes

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:

https://www.ctr-electronics.com/downloads/api/java/html/classcom_1_1ctre_1_1phoenix_1_1motorcontrol_1_1can_1_1_base_motor_controller.html#a33eed3eb1be4209228bf8881dd59ba9d

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.

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