Skip to content

Clarify PID & FF slot usage in motor configuration #6

@SarperMakas

Description

@SarperMakas

Currently in Closed Loop Control the motor configuration sets PID values for both position and velocity as follows:

/*
 * Configure the closed loop controller. We want to make sure we set the
 * feedback sensor as the primary encoder.
 */
motorConfig.closedLoop
    .feedbackSensor(FeedbackSensor.kPrimaryEncoder)
    // Set PID values for position control. We don't need to pass a closed loop
    // slot, as it will default to slot 0.
    .p(0.1)
    .i(0)
    .d(0)
    .outputRange(-1, 1)
    // Set PID values for velocity control in slot 1
    .p(0.0001, ClosedLoopSlot.kSlot1)
    .i(0, ClosedLoopSlot.kSlot1)
    .d(0, ClosedLoopSlot.kSlot1)
    .velocityFF(1.0 / 5767, ClosedLoopSlot.kSlot1)
    .outputRange(-1, 1, ClosedLoopSlot.kSlot1);

It seems that slot 0 is intended only for position control and slot 1 only for velocity control. This could cause confusion for users who might think both slots can be used interchangeably for different control modes.

The same code snippet is also shown in the official documentation: REV Robotics Closed Loop Control Getting Started
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions