EasyStack Docs

EasyCRServoGroup

Esta página ainda não foi traduzida. Mostrando a versão em inglês.

The EasyCRServoGroup class allows you to bundle multiple EasyCRServo instances together and control them as if they were a single continuous rotation servo. It is perfect for heavy multi-servo mechanisms like a dual-motor intake or a multi-servo flywheel.

This class uses a strict Leader-Follower architecture. The Leader servo (the first one added to the group) receives all the complex configuration (PID, Feedforward, Velocity estimation, Positional tracking). Once the Leader calculates the required motor power during an update, that exact power is instantly copied and applied to all the Followers.

#Creating an EasyCRServoGroup

To create a group, initialize your individual EasyCRServo instances and pass them to the constructor. The first servo passed becomes the Leader.

Java
EasyCRServo leftIntake = new EasyCRServo(hardwareMap, "leftIntake");
EasyCRServo rightIntake = new EasyCRServo(hardwareMap, "rightIntake").setInverted(true);

// Group them together (leftIntake is the Leader)
EasyCRServoGroup dualIntake = new EasyCRServoGroup(leftIntake, rightIntake);

Note: You cannot pass null as the leader or as any of the followers. Doing so will throw an IllegalArgumentException.

#Unified Open-Loop Control

For basic continuous rotation, you can send power commands directly to the group. The command will be applied to every servo simultaneously.

Java
duallntake.setPower(1.0);   // Spins all servos at full speed
duallntake.stop();      // Sets power to 0.0 for all servos

#Closed-Loop Configuration (Leader-Driven)

Because all advanced control (RPM velocity, Positional locking, Motion Profiling) relies on the Leader, you only need one encoder connected to the mechanism.

When you call any closed-loop configuration method on the EasyCRServoGroup, it automatically routes that configuration exclusively to the Leader servo.

Java
// Configures the velocity model for the Leader
duallntake.setMaxRpm(150.0)
         .setMinPower(0.05);

// Configures positional PID using a single encoder attached to the Leader
dualIntake.setPositionalControl(myEncoder, new PIDCoefficients(0.05, 0.0 0.0), 5.0, AngieUnit.DEGREES);

// Sets the target angle for the mechanism (Sent to the Leader)
duallntake.setTargetAngle(90.0);

#The Update Loop and Power Copying

Just like a single EasyCRServo, you must call update() in your main loop if you are using Velocity Control, Positional Control, or Motion Profiling.

When you call update() on the group, it tells the Leader to run its control loops and calculate its new required power. The group then automatically grabs that calculated power and forces all Followers to run at that exact same power level (copyPower()).

Java
// Inside your TeleOp or Auto loop:
dualIntake.update(); // Leader calculates PID, Followers copy the resulting power

If you are using a Motion Profile, use the overloaded update:

Java
dualIntake.update(profilePos, profileVel, profileAccel); // Leader calculates PID, Followers copy the resulting power

#Unified Hardware Configuration

Basic hardware settings and limits are broadcasted to every servo in the group simultaneously.

Java
// Inverts every servo in the group
dualIntake.reverse();

// Expands the PWM range for all servos
dualIntake.setPwmRange(PwmPresets.FULL_RANGE);

// Customizes caching tolerance for all servos
dualIntake.setCachingTolerance(0.005);

// Disables or enables the PWM signal (limp mode) for all servos
dualIntake.disable();
dualIntake.enable();

#Reading Data

When you request data from the group (like speed, estimated RPM, or angle), it will always return the data measured and calculated by the Leader servo.

Java
// Returns the RPM of the Leader
double currentSpeed = dualIntake.getRpm();

// Returns the current angle read by the Leader's encoder
double currentAngle = dualIntake.getAngle();

// Checks if the Leader has reached the target
if (dualIntake.isAtTarget()) {
    // Mechanism has arrived
}

Última atualização 2026-11-16

EasyStack - FTC Java library

This site records page views of visitors to understand how the documentation is used. Nothing is sold or shared with third parties.