Theme
Stage 3 · lesson 3 of 7 · 30 min

Drive it yourself

You will: Move the arm by hand, and feel how its controllers behave.

Builds on A simulator that runs in CI.

Read nothing for ten minutes. Drive the arm into the bench.

  arm      1..9 select joint   , jog down   . jog up   tab next   h home
  gripper  [ open   ] close
  speed    - smaller steps   + larger steps

Three things are worth noticing while you do.

Every keystroke is a position, not a velocity. A jog sends the arm controller a short trajectory to a new target, a third of a second long, and the controller holds that target when it gets there. Let go of the key and nothing more is sent, so the arm stays where it is. Kill the teleop mid-jog and the arm finishes the step it was given and holds. That is the property you want from anything that moves: silence is safe. A robot driven by velocity has to build that property in, with a watchdog that brakes when commands stop; an arm driven by position targets has it by construction.

Jogging clamps at the joint limit, and says so. The teleop reads those limits from the description the robot is actually running, not a copy of its own. Change the limits, relaunch, and the clamp moves.

Jogs add up from the last target, not from where the arm is. Each step is added to the position the teleop last commanded, not to the one the arm reports. Add to the measured position instead and every step fights the controller's small tracking error, and the arm creeps rather than moves. The gripper keys are clamped too, between the jaw's named closed and open positions from the profile rather than its joint limits. In the simulator a joint parked exactly on its hard stop can stay there, because the physics engine stops driving a joint that is on a limit.

One more thing is invisible but worth knowing: this teleop exists because the stock ones do not fit. ROS's standard keyboard teleop drives only a mobile base, and knows nothing about an arm's joints or limits. This one asks the arm controller which joints it drives, and the description what their limits are, so it names no joint of its own. It still has drive keys, for robots with a base. On the SO-101 they say there is no base, rather than publishing to a topic nobody listens to — a silent failure the next lesson shows you how to see.

In the simulation

The keys of make drive, and its rules: a jog adds to the last target, stops at the limit and says so, and the jaw moves in quarters. Click the 3D view first, so the keys go to it. On a touch screen, the buttons in the joints panel are the same keys.

Kinematic: joints move at their real speed limit, but there is no gravity, no load and no physics. That is what the steps below are for.

The SO-101 loads as you reach it.

In this lesson

  1. Press + (or the step's + button) until the step is the largest, 4 of 4.
  2. Press 1 to select shoulder_pan, then hold . (or hold its + button) until it will not go further.
  3. Press h (or the home button) to home the arm.
  4. Open the jaw with [ (or the jaw's + button), all four quarters of its travel.
  5. Press w, the drive-forward key (or the base's ▲ button).
  6. Drive the arm into the bench. The lab colours the part red; the real arm would stall against it.

Do it

  1. Start the robot if it is not running.

    make play
    
  2. In a second terminal, start the teleop, and keep that terminal focused.

    make drive
    

    Expect: joints: shoulder_pan, shoulder_lift, elbow_flex, wrist_flex, wrist_roll, read from the controller, then the key map and a status line.

  3. Press 1 to select shoulder_pan, press + three times for the largest step, then hold . until it will not go further.

    Expect: The status line climbs about 11.5° a step and stops at +110.0 deg, with shoulder_pan at its limit. RViz shows the arm swung round to its right.

  4. Press h to home the arm, then [ twice and ] twice to open and close the jaw.

    Expect: homing, and the arm back upright. The jaw opens and closes in quarters of its travel.

  5. Press w, the drive-forward key.

    Expect: no base on this robot: nothing listens on /base_controller/cmd_vel. Nothing is published.

  6. Jog a joint, and press Ctrl-C while it is moving. Look at RViz.

    Expect: The arm finishes that one small step and holds. Nothing keeps moving after the teleop is gone.

You will know it worked when: Jogging a joint stops at its limit with a message, and killing the teleop mid-jog leaves the arm holding still.

When it goes wrong

Keys do nothing.

Why: The teleop reads the terminal it runs in.

Fix: Click into that terminal before pressing keys.

The teleop says it has no joint states.

Why: joint_state_broadcaster failed to activate.

Fix: make stop && make play on a quieter machine, and confirm all three controllers.

"teleop needs a terminal".

Why: It was started without one, from a script or with docker compose exec -T. It reads single keystrokes, which needs a real terminal.

Fix: Run make drive from an interactive terminal.

A jog moves the arm a little, then it drifts back.

Why: Something else is commanding the arm too: a scenario or a second teleop, each sending its own targets.

Fix: Run one thing that commands the arm at a time. ros2 topic info /arm_controller/joint_trajectory shows how many publishers there are.

Terms

Position command
A command that says where a joint should be, rather than how fast it should move. Losing the next one leaves the joint where the last one put it.
Command watchdog
A controller behaviour that stops a robot when commands stop arriving. Needed by anything commanded by velocity, such as a mobile base.
Teleoperation
Driving a robot directly by a human, here from a keyboard.

Every term in the course: glossary.

Check yourself

Answer in your head first, then open it.

Why is it safe for the teleop to crash in the middle of a jog?

Each jog is a position target with an end. The controller finishes it and holds there; it is not waiting for a stream that has stopped. A velocity command is the opposite: lose the stream and the robot keeps going until a watchdog notices.

Where does the teleop get the joint limits it clamps to?

From the robot description the running robot publishes, so they are always the limits actually in force.

Why does a jog add to the last commanded position rather than the measured one?

The measured position always lags the command a little. Adding each step to it means every step starts by undoing part of the last one, and the arm creeps instead of moving a fixed amount per keystroke.

Stretch

Find the jog step sizes and how long each jog's trajectory lasts, and work out the speed one step asks for at the largest size. Then find the joints' velocity limit in the running description, and compare.

Hint

JOG_STEPS and _send_arm in src/threevn_control/threevn_control/teleop.py; the limits with `make urdf 2>/dev/null | grep "

One way to do it

The largest step is 0.2 rad over 0.35 s: about 0.57 rad/s. The description's limit is velocity="1.7434" on every joint, the servo's 4.71 rad/s no-load speed derated to 37%, so one step is well inside it. Holding the key is different: key repeat sends steps faster than they finish, the target runs ahead of the arm, and each new trajectory asks for more speed. Something has to say no, and it should not be the teleop. Tier 5 is about where that refusal lives.

Going deeper