# Velocity Control Mode

Velocity Control uses the PID controller to run the motor at a set speed in RPM (or configured conversion factor units).

{% hint style="success" %}
Want to control the acceleration of your velocity controller? See [MAXMotion Velocity Control](/revlib/spark/closed-loop/maxmotion-velocity-control.md) for an improved version of Velocity Control with more features and control.
{% endhint %}

It is called in the same way as Position Control:

{% tabs %}
{% tab title="Java" %}

```java
m_controller.setSetpoint(setPoint, ControlType.kVelocity);
```

API Docs: [setSetpoint](https://codedocs.revrobotics.com/java/com/revrobotics/spark/sparkclosedloopcontroller#setSetpoint\(double,com.revrobotics.spark.SparkBase.ControlType\))
{% endtab %}

{% tab title="C++" %}

```cpp
using namespace rev::spark;

m_controller.SetSetpoint(setPoint, SparkBase::ControlType::kVelocity);
```

API Reference: [SetSetpoint](https://codedocs.revrobotics.com/cpp/classrev_1_1spark_1_1_spark_closed_loop_controller#aefb8aa2d8ea8533a8e726f58c58facc9)
{% endtab %}
{% endtabs %}

{% hint style="danger" %}
Velocity Control mode will turn your motor continuously. Be sure your mechanism does not have any hard limits for rotation.
{% endhint %}

{% hint style="info" %}
Velocity Loop constants are often of a very low magnitude, so if your mechanism isn't behaving as expected, try *decreasing* your gains.
{% endhint %}

<figure><img src="/files/qT0YBtmRzZvUzdHzo1GA" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.revrobotics.com/revlib/spark/closed-loop/velocity-control-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
