Skip to content

Add motor control docs#33

Open
ArchdukeTim wants to merge 5 commits into
frcsoftware:mainfrom
ArchdukeTim:tim/motorControl
Open

Add motor control docs#33
ArchdukeTim wants to merge 5 commits into
frcsoftware:mainfrom
ArchdukeTim:tim/motorControl

Conversation

@ArchdukeTim

Copy link
Copy Markdown
Contributor

No description provided.

@Daniel1464 Daniel1464 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good!

Comment thread src/content/docs/misc/motor_control.mdx Outdated
## Open- and Closed-loop mechanisms

The manner in which you control a mechanical mechanism can be split into two categories: open-loop, and closed-loop.
Open-loop refers to a mechanism that uses no measurement to correct the output of the motor.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A short example would be good here - like:

"Open-loop refers to a mechanism that uses no measurement to correct the output of the motor: like setting voltage or throttle".

Comment thread src/content/docs/misc/motor_control.mdx Outdated

The manner in which you control a mechanical mechanism can be split into two categories: open-loop, and closed-loop.
Open-loop refers to a mechanism that uses no measurement to correct the output of the motor.
Closed-loop mechanisms use measurements, such as an encoder reading, to adjust the output of a motor to get closer to a target setpoint.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add "For example, PID control." at the end

Comment thread src/content/docs/misc/motor_control.mdx Outdated
## Open Loop Control

Some mechanisms don't require the precision that is gained through closed-loop control.
Intake rollers, for example, are commonly controlled simply by running the motor at a set duty-cycle.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably better to define what duty cycle means before using the term.

Also, 2027 wpilib uses throttle as the term(in MotorController.setThrottle), so it might be better to use that instead

Comment thread src/content/docs/misc/motor_control.mdx Outdated

The two most common open-loop setpoint types are duty-cycle and voltage.

Duty-cycle is a percentage of input voltage coming from the robot's battery.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nitpick, but the definitions are a bit circular here since you reference voltage when defining duty cycle, and reference duty cycle when defining voltage. You could say:

"voltage is a measure of the electrical output to the motor. If motor A is set to 12 volts and motor B to 6 volts, motor A will eventually reach a speed twice as fast as motor B. "

"duty cycle/throttle measures the proportion of a motor's maximum possible voltage output. This depends on the battery voltage..."

Comment thread src/content/docs/misc/motor_control.mdx Outdated
#### Measuring your mechanism

The feedback sensor in position-controlled mechanisms is commonly an encoder, a small electronic device that can measure rotation.
Another option is a potentiometer, which is similar to an encoder, but analog, and may have limited travel distance.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anyone uses potentiometers anymore, so idk if this is necessary

@samfreund samfreund force-pushed the main branch 9 times, most recently from b5680fd to 6ca05c8 Compare June 25, 2026 06:58
@Adrianamm Adrianamm moved this to In progress in FRC Software Jun 26, 2026
@samfreund samfreund force-pushed the main branch 7 times, most recently from ea813ca to f514f00 Compare June 30, 2026 04:58

@roboteer5291 roboteer5291 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the content on this page is solid. However, I think the flow of the page and the ordering has a lot to be desired, especially with wherever it ends up in the course, and what of this would've already been discussed.

I also think some discussion of motor dynamics, current, torque, etc. would be very beneficial for some of this (particularly for velocity FF and why setting a constant voltage makes a motor spin a certain speed eventually).

Also, idk what ide you're using, but see if you could download a spellcheck plugin. There's a good amount of typos in this, that I didn't want to manually request a change on all of them and I probably wouldn't catch them all anyways.

# Controlling mechanisms with motors

With the introduction of the brushless era of motors in FRC, motors have become the dominant choicewhen it comes to controlling robot degrees of freedom, compared to servos or pneumatics.
Brushless motors have incredible size to performance ratios, and the smart motor controllers that accompany them make it easy to control a variety of mechanisms.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intro section necessary? I'm not sure it's necessary to refer to pre-covid pneumatics usage. The discussion of performance also isn't really relevant, as it's basically just the standard at this point.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block diagram feels misleading due to the lack of plant in here. Take a look at this figure from the controls engineering in frc book (note that the figure numbering is a bit different than in the wpilib docs).

Image

This section will cover the most common types of software controllers for motors in FRC.

## Motor Controllers
Not to be confused with hardware motor controllers like the REV Spark Max or CTRE TalonFX, a software motor controller is a function that converts a setpoint input to a motor output.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is really a standard term. At least, not something I've heard referred to like this before. This just feels very confusing to introduce a duplicate term that really only is used here

The two most common open-loop setpoint types are duty-cycle and voltage.

Duty-cycle is a percentage of input voltage coming from the robot's battery to the motor controller.
WPILib refers to this percentage as throttle.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate explanation of throttle from above

By attaching the encoder to the final shaft of a rotating mechanism, such as an arm, you can treat the encoder reading as _absolute_, requiring no homing sequence or specific power-on location.


### Closed-Loop Velocity Control

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section should probably be above closed-loop position so that it's physically closer to closed-loop velocity


### Closed-Loop Position Control

Position control is the most common closed-loop control scheme in FRC.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this sentence is unnecessary. It really only makes sense if you go "I want closed loop control", then as "hmm what should I do, position or velocity?" and then decide position. Making the sentence go the other direction "If you need to control the position of a mechanism, closed-loop control is how you do that" (word it better of course), the sentence makes more sense in context.

In years when you have to shoot multiple game pieces one after another, like in 2026 Rebuilt, closed-loop control can help your flywheel recover between shots in a way that open-loop alone cannot.


## Choosing a control scheme

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize header

## Open- and Closed-loop Controllers
The types of controllers that you can create can be split into two categories: open-loop, and closed-loop.
Open-loop refers to a mechanism that have only a single input, the setpoint.
Open-loop controllers will often, but not always, utilize a mathematical model of the motor and mechanism to make an educated estimate of how the motor should act in order to reach the setpoint.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially RE the comment about the open-loop section being titled better below, this line adds confusion.

Not to be confused with hardware motor controllers like the REV Spark Max or CTRE TalonFX, a software motor controller is a function that converts a setpoint input to a motor output.
In the simplest case, the input _is_ the output, such as when using voltage or throttle (duty-cycle) control.

A more complex example would multiply the setpoint, say a flywwhel rpm, by some constant to convert to volts for the motor.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is putting the cart before the horse. Using the example of FF before any of that is introduced doesn't make much sense.


The simplest open-loop mechanisms require almost no configuration in code, since you don't need to configure gear ratios or feedback gains.

The two most common open-loop setpoint types are duty-cycle and voltage.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This discussion of duty cycle vs position really needs to be the first thing discussed on this page because how you actually make the motor spin and the concepts behind that is the root of everything else on this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants