> For the complete documentation index, see [llms.txt](https://docs.uninterruptedexception.team/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uninterruptedexception.team/utils/motor/motorgroup.md).

# MotorGroup

{% hint style="warning" %}
Only use motor groups with a six-wheel drivetrain. Using it with mecanum would get rid of the whole point of mecanum: strafing
{% endhint %}

<h2 align="center">Creating a MotorGroup</h2>

Create a MotorGroup by doing the following:

```
DcMotorEx motor1, motor2;
MotorGroup groupName;

// In my class content:
myGroup = new MotorGroup(
    motor1, // leader
    motor2, // follower
    DcMotorEx.Direction.FORWARD, // leader direction
    DcMotorEx.Direction.FORWARD // follower direction
    // Reverse the motor by changing the direction to REVERSE
);
```

For an example, see [Subsystems/Drivetrain.java](https://github.com/Gamemanuel/FTCCodingTemplates/blob/main/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Subsystems/Drivetrain.java).

<h2 align="center">Functions:</h2>

### `setPower()`

Has 1 argument: power (a double) which is the power it will set to both motors. The range is 1 to -1 (just like setting a regular motor).

### `getPower()`

Gets the power of the MotorGroup through the Leader.

### `setMode()`

Sets the [RunMode](https://ftctechnh.github.io/ftc_app/doc/javadoc/com/qualcomm/robotcore/hardware/DcMotor.RunMode.html) of the motorGroup.

### `setPositionType()`

Sets the behavior for how MotorGroup gets encoder position.\
See [PositionType](/utils/motor/positiontype.md).

### `getPosition()`

The position of the MotorGroup. Dependent on [PositionType](/utils/motor/positiontype.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.uninterruptedexception.team/utils/motor/motorgroup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
