Troubleshooting
What to check when a YAMS mechanism does not build, does not move, or moves the wrong way.
Find what you see, then work down its list. The first check is the most likely cause.
It does not build
SmartMotorController, Arm or another YAMS class cannot be found
YAMS is not installed. Install it as in Create a project and install YAMS.
Both YAMS vendordeps are installed. Install only one: Commands v2 or Commands v3. Remove the other from the
vendordepsfolder.The import is from the wrong command framework. Commands v2 code imports
yams.commands2, and Commands v3 code importsyams.commands3.
SparkMax, TalonFX or another vendor class cannot be found
The vendor's own library is not installed. YAMS drives the vendor's objects, so install REVLib, Phoenix 6 or the other vendor library too. See Install your motor controller's library.
It crashes when the code starts
Read the first error in the Driver Station or the simulation console. YAMS names the setting that is missing and the method that sets it.
Arm starting angle is empty
Add withStartingPosition(...) to the SmartMotorControllerConfig.
Arm starting angle is outside hard limits
Make the starting position fall between the ArmConfig hard limits.
Arm Length is empty, Arm lower hard limit is empty
Add withLength(...) and withHardLimits(...) to the ArmConfig. The simulation needs them.
An elevator, pivot or flywheel error
The same idea: the error names the method to add.
I can't find the mechanism on the dashboard
It is not under
SmartDashboard. The simulated mechanism is at NetworkTables > Mechanisms > name > mechanism, where name is the name given to the mechanism config'swithTelemetry, such asArm.The motor's values are at
NT:/Mechanisms/<mechanism name>/<motor name>/, such asNT:/Mechanisms/Arm/ArmMotor/.Nothing publishes until the mechanism's
updateTelemetry()runs. Commands v2: check that the subsystem'speriodic()calls it. Commands v3: check that the mechanism'speriodic()calls it, and thatRobot.robotPeriodic()calls the mechanism'speriodic(). See Step 2: The arm.
It does not move in simulation
The robot is disabled. Press Teleoperated in the Sim GUI.
The controller is not on port 0. Drag it from System Joysticks to Joystick[0].
Commands v3: the wrong op mode is selected. Pick
ExampleTeleop, where the buttons are bound.Commands v3: the mechanism's simulation never runs. Check that
Robot.simulationInit()starts it withstartSimulation(...).Commands v2: check that
simulationPeriodic()in the subsystem calls the mechanism'ssimIterate().The setpoint is outside the soft limits. The closed loop holds a setpoint at the nearest soft limit, so a target past the limit never moves the mechanism further.
It moves, but not as it should
It falls, or a flywheel coasts down, while the robot is disabled
That is expected. A disabled robot's motors get no power, so the simulation gives them 0 V. When you enable, the closed loop starts from wherever the mechanism ended up.
It sags below its setpoint, or an elevator drifts down
kGis 0. Tune it as in Step 5: Tune it.
It stops short of its setpoint (a flywheel never reaches speed)
kPis too low, or a flywheel has nokV. A velocity loop needskVto do most of the work.
It swings back and forth, or rings around the setpoint
kPis too high. Lower it by about a third, then add a littlekDif it still overshoots.
It moves the wrong way, or runs straight into a hard stop
The motor direction is wrong. Check it with the robot disabled as in Step 6: Run it on the robot, and set
withMotorInverted(true)if positive is the wrong way.
It goes the wrong distance
The gearing does not match the mechanism. List each stage from the motor outward, as in Step 1.
For an elevator or a wheel, the circumference is wrong. See How do I find my mechanism's circumference?
Angles are off by the same amount every time
The mechanism was not at its starting position when the code started. Rest it there before the code starts, or change
withStartingPositionto where it really rests.
A command that should end never ends
run(...)never ends on its own: it holds the setpoint until another command takes over. UserunTo(...)with a tolerance to end once the mechanism gets there.The
runTo(...)tolerance is too tight, or the setpoint is past a soft limit, so the mechanism never gets close enough. Widen the tolerance, or move the setpoint inside the limits.
Live tuning does nothing
AdvantageScope's tuning mode is off. Turn it on with the sliders icon beside the search box.
The
Live Tuningcommand is not running. It is atNT:/Tuning/<subsystem or mechanism name>/Live Tuning, such asNT:/Tuning/ArmSubsystem/Live Tuning. Start it again after pressing any of the mechanism's buttons, which take over from it.The value was typed under
NT:/Mechanisms. Type values underNT:/Tuning.NT:/Mechanismsonly shows what the mechanism is doing.The motor's telemetry is not
TelemetryVerbosity.HIGH.The config has no subsystem (
new SmartMotorControllerConfig(this)orwithSubsystem(...), Commands v2) or mechanism (new SmartMotorControllerConfig(this)orwithMechanism(...), Commands v3), so YAMS has nothing to register theLive Tuningcommand with.The values were lost after a restart. Copy them into your code, as in Step 5.
See Live tuning for more.
On the real robot
Nothing moves, and the Driver Station shows a CAN error
The CAN ID in the code does not match the motor controller. Check it in the vendor's tool (REV Hardware Client or Phoenix Tuner X).
Two devices share an ID, or the CAN wiring is loose.
The robot browns out, or the mechanism slows down under load
The current limits are too high. See Limiting power consumption.
The motor is hot. Watch
motor/temperature; a hot motor backs off and looks like a gain problem.
It worked in simulation but not on the robot
The real robot uses
withClosedLoopControllerandwithFeedforward. The simulation uses thewithSim...versions. Tune the robot separately, as in Step 6.
When tuning does not help
Some mechanisms cannot be tuned, because the motor does not have enough torque for the job. No gain fixes that, and it is worth recognizing early so you stop chasing numbers.

Raising kP does nothing, because the motor was already at full voltage with the smaller gain.

An arm needs the most torque when it is level and almost none when it is upright. An underpowered arm therefore looks fine at some setpoints and hopeless at others. If it only misbehaves near level, suspect torque before you suspect the gains.

A flywheel has a top speed set by the motor, the gearing and the battery voltage. Below it everything works, and the closer the setpoint gets to it the longer the spin up takes. Above it, no gain will ever get there. Remember that the battery sags under load, so the top speed in a match is lower than on a fresh battery on the bench.
It works at low setpoints
This is what makes an underpowered mechanism hard to spot. It tunes well on the easy moves, and then the same gains fail on the hard ones:
Elevator
Short moves, slow profiles, an empty carriage
Long fast moves, or carrying a game piece
Arm
Setpoints near upright
Setpoints near level, where gravity pulls hardest
Flywheel
Low speeds
Speeds near the motor's top speed, and recovery between shots
When that happens, do not retune for the hard case. Look at motor/outputVoltage during the move that fails. If it is at the maximum, the gains are not the problem.
How to recognize an underpowered mechanism
Watch (NT:/Mechanisms)
What you see
motor/outputVoltage
Pinned at the maximum for most of the move, not just at the start.
current/stator
Sitting on the stator current limit.
mechanism/position or measurement/position
The same slow curve whatever you set kP to, and it may stop short of the setpoint.
mechanism/velocity or measurement/velocity
Far below the profile's closedloop/setpoint/velocity, however the profile is set.
motor/temperature
Climbing quickly while the mechanism holds a position.
What to do about it
The fix is mechanical or electrical, not a gain:
More gear reduction. The most common fix. It trades top speed, which you are not reaching anyway, for torque.
More motors, or a stronger motor.
Take load off the motor: a lighter mechanism, a counterweight, or a constant force spring on an elevator.
Check the current limit. A stator limit set too low makes a capable motor look underpowered. Raise
current/limit/statorand see whether the move changes. See How do I limit power consumption?.Check for binding. Disable the robot and move the mechanism by hand through its whole travel.
Ask for less. Lower the motion profile's
maxVelocityandmaxAccelerationto what the motor can deliver.
It gets slower every time
An overworked motor heats up, and a hot motor is weaker. The first few moves look fine, then each one takes a little longer, until the mechanism stops reaching its setpoint at all.

Watch (NT:/Mechanisms)
What you see
current/stator
Higher on every repeat of the same move, until it sits on the limit.
motor/temperature
Climbing steadily and not coming back down between moves.
mechanism/velocity or measurement/velocity
The peak speed of the same move dropping over time.
mechanism/position or measurement/position
Arriving later each time, then stopping short.
Last updated
Was this helpful?
