Teleoperation Control

Master manual control and understand motion control systems


Tutorial Overview

🎯 Learning Objectives

By the end of this tutorial, you will:

  • βœ… Understand teleoperation architecture

  • βœ… Master joystick control techniques

  • βœ… Implement keyboard teleoperation

  • βœ… Create custom control interfaces

  • βœ… Understand velocity ramping and safety systems

  • βœ… Tune motion control parameters

  • βœ… Debug control issues

  • βœ… Compare different control methods

⏱️ Time Required

  • Reading & Theory: 20 minutes

  • Joystick Control Practice: 25 minutes

  • Keyboard Implementation: 30 minutes

  • Custom Control: 25 minutes

  • Parameter Tuning: 20 minutes

  • Total: ~120 minutes

πŸ“š Prerequisites

  • βœ… Completed ROS2 Communication & Tools

  • βœ… Can visualize robot in RViz

  • βœ… Understand topics and services

  • βœ… Comfortable with command line

  • βœ… Basic Python knowledge (for custom control)

πŸ› οΈ What You'll Need

  • βœ… Beetlebot (powered, fully charged)

  • βœ… Laptop with ROS2 Jazzy

  • βœ… Wireless controller (Cosmic Byte Nexus)

  • βœ… USB keyboard

  • βœ… Open space (3m Γ— 3m minimum)

  • βœ… RViz for visualization


Part 1: Teleoperation Architecture

Understanding the Control Chain

Complete signal flow:


Key Nodes Explained

1. joy_node (ROS2 standard)

  • Reads USB controller via Linux input system

  • Publishes raw button/axis data

  • Topic: /joy

  • Rate: ~50-100 Hz (when buttons pressed)

2. lyra_teleop_node (Beetlebot-specific)

  • Maps joystick axes to velocities

  • Handles deadman switch (LB button)

  • Publishes velocity commands

  • Topic: /cmd_vel_joy

3. cmd_vel_mux (multiplexer)

  • Combines multiple velocity sources:

    • /cmd_vel_joy (joystick - highest priority)

    • /cmd_vel_nav (autonomous navigation)

    • /cmd_vel (keyboard/external)

  • Joystick always wins (safety!)

  • Output: /cmd_vel

4. lyra_cmd_vel_gate_node (safety)

  • Checks if robot is ARMED

  • Applies velocity limits

  • Emergency stop logic

  • Topic: /cmd_vel_safe

5. lyra_node (motor control)

  • Velocity ramping (smooth acceleration)

  • PID control for each wheel

  • Sends commands to STM32

  • Receives encoder feedback


Velocity Ramping Deep Dive

Critical feature: Beetlebot doesn't jump to commanded velocity instantly!

How it works:

Ramp rate: 8 RPM per control cycle

  • Control frequency: 20 Hz (every 50ms)

  • Total ramp time: ~1 second (0 β†’ max speed)

  • Equivalent linear acceleration: ~1.09 m/sΒ²


CRITICAL: Emergency Stop Behavior

LB button (deadman switch) has special behavior:

While LB held: Smooth ramping (as described above)

LB released: ⚠️ IMMEDIATE STOP

  • No ramping! Motors stop instantly

  • Robot disarms (requires re-pressing LB to move again)

  • Safety feature: operator must maintain control

Why immediate stop on LB release?

  • Deadman switch must be instant (safety requirement)

  • Operator losing control = robot must stop NOW

  • Cannot wait 1 second for ramp-down

Example scenario:


Part 2: Mastering Joystick Control

Controller Layout Review

Cosmic Byte Nexus controller:

Beetlebot mapping:

  • LB (Left Bumper): ARM/Deadman switch (MUST hold!)

  • Left Stick Y-axis: Forward/backward speed

  • Right Stick X-axis: Turning (left/right)

  • RB (Right Bumper): Turbo mode (2Γ— speed)

  • Other buttons: Currently unused


Basic Control Techniques

Exercise 6.1: Smooth Acceleration

Task: Feel the velocity ramping

What you learned:

  • Ramping makes motion smooth and predictable

  • LB release = emergency stop (no ramp)

  • Robot feels professional (not jerky like toy robots)


Advanced Driving Patterns

Exercise 6.2: Precision Maneuvering

Task 1: Straight line

Task 2: 90Β° turn

Task 3: Figure-8 pattern

Task 4: Parallel parking


Exercise 6.3: Turbo Mode

RB button doubles max speed (safety feature disabled!)

Task: Compare normal vs turbo


Understanding Joystick Dead Zones

Problem: Joystick resting position isn't exactly centered

  • Reads ~0.02 instead of 0.00

  • Would cause slow creep

Solution: Dead zone

  • Values < threshold treated as zero

  • Typical: Β±5% dead zone

Check dead zone:


Part 3: Keyboard Teleoperation

Using Built-in Keyboard Teleop

Standard ROS2 tool:

Try driving patterns:


Creating Custom Keyboard Control

More ergonomic layout: WASD + arrow keys

Script:

Run custom teleop:

Drive with WASD keys!


Exercise 6.4: Compare Control Methods

Task: Drive same path with different control methods

Path: 2m Γ— 2m square

Method 1: Joystick

  • Time yourself

  • Count how many "corrections" needed

  • Rate smoothness (1-10)

Method 2: Standard keyboard (i/j/k/l)

  • Time yourself

  • Count corrections

  • Rate smoothness

Method 3: Custom keyboard (WASD)

  • Time yourself

  • Count corrections

  • Rate smoothness

Analysis:

  • Which was fastest?

  • Which was smoothest?

  • Which required most corrections?

  • Which did you prefer?

Typical results

Joystick:

  • Fastest (analog control)

  • Smoothest (continuous input)

  • Fewest corrections

  • Best for general driving

Keyboard:

  • Slower (discrete steps)

  • Less smooth (on/off inputs)

  • More corrections needed

  • Good for precise positioning (step-by-step)

  • 500ms safety timer will make it jerky as it auto disarms and rearms

Best practice: Joystick for driving, keyboard for quick testing


Part 4: Understanding /cmd_vel Topic

Twist Message Structure

Topic: /cmd_vel Type: geometry_msgs/msg/Twist

Message definition:

For Beetlebot (differential drive):


Publishing Manual Commands

Test commands via command line:

⚠️ Important: These are single commands! Robot executes then stops.

For continuous motion:


Exercise 6.5: Command Line Control Patterns

Task: Drive patterns using only CLI

Pattern 1: Drive 1 meter forward

Pattern 2: Turn 180Β°

Pattern 3: Circle (radius 1m)


Part 5: Safety Systems

ARM/DISARM Mechanism

Purpose: Prevent accidental motion

ARM = Motors enabled

  • Can respond to /cmd_vel commands

  • Joystick LB button pressed

  • Or service call: /lyra/arm

DISARM = Motors disabled

  • Ignores /cmd_vel commands (for safety)

  • Joystick LB button released

  • Or service call: /lyra/disarm

  • Or timeout: No cmd_vel for 500ms


Check ARM Status


Manual ARM/DISARM


Command Timeout Safety

Built-in safety: If no cmd_vel received for 500ms β†’ DISARM

Test:

Why? Safety! If controller disconnects or node crashes, robot stops.


Emergency Stop

Immediately stop robot:

When to use:

  • Robot behaving unexpectedly

  • About to collide

  • Software error

  • Any emergency situation


Velocity Limits (Safety Gate)

Safety gate node enforces maximum speeds:

Even if cmd_vel requests faster, these limits are enforced!

Example:


Part 6: Motion Control Parameters

Key Parameters

Location: /lyra_node parameters

Critical parameters:


Tuning Max Speed

Change maximum velocity:


Tuning Turn Rate


Exercise 6.6: Speed Tuning Experiment

Task: Find your preferred speed settings

Test 1: Conservative (beginner-friendly)

Test 2: Moderate (default)

Test 3: Aggressive (advanced)

Record your preferences!


Making Parameter Changes Permanent

Problem: Parameters reset on reboot

Solution: Edit config file


Part 7: Debugging Control Issues

Problem: Robot Doesn't Respond to Commands

Systematic debug process:

If still not working: ⚑ Power cycle robot


Problem: Robot Moves When Joystick Centered

Cause: Joystick dead zone too small or joystick drift

Debug:


Problem: Jerky Motion

Possible causes:

  1. Low battery

  1. Network latency

  1. Wheel obstruction

    • Check wheels spin freely

    • Remove any debris

  2. Parameter issues


Problem: Robot Drifts to One Side

Causes:

  1. Uneven floor (robot is fine, floor is tilted)

  2. Wheel diameter mismatch (calibration needed)

  3. Motor power imbalance (one motor weaker)

Test on flat surface first!

If problem persists:


Part 8: Advanced Control Techniques

Ackermann-Style Control (Simulated)

Beetlebot is differential drive, but can simulate car-like steering:

Create car-style control node:

Script:

Try car-style control!


Velocity Smoothing Script

Further smooth joystick input (beyond hardware ramping):


Part 9: Performance Metrics

Measure Control Latency

How long from button press to robot motion?

Test setup:


Measure Control Accuracy

How closely does robot follow commands?


Part 10: Knowledge Check

Concept Quiz

  1. What happens when you release the LB button?

  2. What's the purpose of velocity ramping?

  3. Why does joystick override autonomous navigation?

  4. What does /cmd_vel_safe do that /cmd_vel doesn't?

  5. If robot won't move, what's the first thing to check?


Hands-On Challenge

Task: Create autonomous square driver

Requirements:

  1. Python script that drives 1m Γ— 1m square

  2. No joystick input (purely programmatic)

  3. ARMs robot at start

  4. Uses /cmd_vel topic

  5. Accurate timing for sides and turns

  6. Stops and disarms at end

Bonus:

  • Add parameter for square size

  • Visualize in RViz during execution

  • Measure final position error


Part 11: What You've Learned

βœ… Congratulations!

You now understand:

Control Architecture:

  • βœ… Complete teleoperation signal chain

  • βœ… Joy β†’ Teleop β†’ Mux β†’ Safety Gate β†’ Motor Control

  • βœ… ARM/DISARM mechanism

  • βœ… Emergency stop systems

Velocity Ramping:

  • βœ… Smooth acceleration (8 RPM/cycle)

  • βœ… LB release = immediate stop (no ramp)

  • βœ… Benefits for hardware and odometry

Control Methods:

  • βœ… Joystick (analog, smooth)

  • βœ… Keyboard (discrete, precise)

  • βœ… Programmatic (/cmd_vel topic)

  • βœ… Custom control interfaces

Safety Systems:

  • βœ… Deadman switch (LB button)

  • βœ… Command timeout (500ms)

  • βœ… Velocity limits (safety gate)

  • βœ… Emergency stop service

Practical Skills:

  • βœ… Driving techniques (straight, turns, patterns)

  • βœ… Parameter tuning (speed, turn rate)

  • βœ… Debugging control issues

  • βœ… Creating custom teleop nodes


Next Steps

🎯 You're Now Ready For:

Immediate Next: β†’ Sensor Fusion with EKF - Combine wheel odom + IMU for better accuracy

Navigation: β†’ SLAM Mapping - Build maps while driving β†’ Autonomous Navigation - Let robot drive itself

Advanced Control:

  • Path following algorithms

  • Obstacle avoidance behaviors

  • Multi-robot coordination


Quick Reference

Essential Control Commands


Joystick Button Reference

Control
Function
Notes

LB

ARM / Deadman

MUST hold to move

Left Stick Y

Forward/Backward

Push up = forward

Right Stick X

Turn Left/Right

Push left = turn left

RB

Turbo Mode

2Γ— speed (use carefully!)

Release LB

Emergency Stop

Immediate stop, disarm


Completed Teleoperation Control! πŸŽ‰

β†’ Continue to Sensor Fusion with EKF β†’ Or return to Tutorial Index


Last Updated: January 2026 Tutorial 6 of 11 - Intermediate Level Estimated completion time: 120 minutes

Last updated