Robot: Yahboom ROSMASTER R2
Computer: Jetson Xavier NX
ROS: ROS1 Melodic (Python 2.7)
Workspace:
/home/jetson/ROS/R2/yahboomcar_ws
Symlink:
/home/jetson/yahboomcar_ws
This README explains every phase of running the ROSMASTER R2 — from manual joystick driving to closed-loop autonomous Pure Pursuit racing using:
- AMCL localization
- FTG safety
twist_muxarbitration- Deadman button (Y)
The workflow mirrors how an F1TENTH racecar is operated.
- Safety First
- Big Picture (How Motion Flows)
- Rules You Must Follow
- Environment Setup (Always Do This)
- Phase 1 – Manual Drive (Teleop Only)
- Phase 2 – Mapping (Cartographer)
- Phase 3 – Localization (AMCL Only)
- Phase 4 – Record a Lap (Rosbag)
- Phase 5 – Raceline Generation (Offline)
- Phase 6 – Visualize Raceline in RViz
- Phase 7 – Autonomous Driving (Pure Pursuit + FTG Safety)
- Race Day Launch Order (Fast)
- Pure Pursuit Tuning Table
- Troubleshooting Decision Tree
- AMCL ON vs OFF Rules
- Put the robot on a stand for first tests
- Keep a finger near the power switch
- Start slow
- Never test near people, pets, stairs, or traffic
Joystick -> /cmd_vel_teleop ┐
Pure Pursuit -> /cmd_vel_auto ├─> twist_mux -> /cmd_vel -> Motor Driver
FTG Safety -> /cmd_vel_safety ┘
- FTG Safety
- Pure Pursuit (only when A button held)
- Teleop joystick (always allowed)
- ❌ Mapping and localization never run together
- ❌ Pure Pursuit never runs during mapping
- ✅ RViz is viewer only
- ✅ When changing phases: STOP old nodes first → START new ones
Run in every new terminal:
source /opt/ros/melodic/setup.bash
source ~/ROS/R2/yahboomcar_ws/devel/setup.bashVerify motors, joystick, LiDAR, and twist_mux.
roslaunch yahboomcar_nav laser_bringup.launch- Cartographer
- AMCL
- Pure Pursuit
- Fixed Frame:
odom - Add: LaserScan (
/scan), TF, RobotModel
rostopic hz /scan
rostopic echo -n 1 /cmd_velRobot must drive using the joystick.
Create a map.
- AMCL
- Pure Pursuit
roslaunch yahboomcar_nav yahboomcar_map.launch map_type:=cartographer- Fixed Frame:
map - Add: Map, LaserScan, TF, RobotModel
mkdir -p ~/maps
rosrun map_server map_saver -f ~/maps/home2Stop mapping after saving.
Robot knows where it is on the saved map.
- Cartographer
roslaunch r2_amcl_localization amcl_only.launch map:=/home/jetson/maps/home2.yaml- Fixed Frame:
map - Add: Map, LaserScan, TF, RobotModel
- Use 2D Pose Estimate once
rostopic echo -n 1 /amcl_poseRecord a clean lap for raceline generation.
- Bringup
- LiDAR
- AMCL
- Pure Pursuit
mkdir -p ~/bags
rosbag record -O ~/bags/amcl_lap_01.bag /amcl_pose /tf /tf_static /scan /mapDrive one smooth lap, then stop with Ctrl+C.
Convert bag → raceline YAML.
mkdir -p ~/paths
rosrun r2_raceline_pp bag_to_raceline_yaml_amcl.py --bag /home/jetson/bags/amcl_lap_01.bag --pose /amcl_pose --out /home/jetson/paths/raceline_amcl_01.yaml --frame_id map --every 1 --min_dist 0.02 --resample 0.05 --close_loopnano ~/paths/raceline_amcl_01.yamlframe_id: map- Last waypoint must equal first waypoint (loop closure)
Terminal 1 — Sensors
roslaunch yahboomcar_nav laser_bringup.launchTerminal 2 — AMCL
roslaunch r2_amcl_localization amcl_only.launch map:=/home/jetson/maps/home2.yamlTerminal 3 — Raceline → Path
roslaunch r2_raceline_pp raceline_to_path.launch raceline:=/home/jetson/paths/raceline_amcl_01.yamlTerminal 4 — Safety Mux
roslaunch r2_estop_joy safety_mux.launchTerminal 5 — Pure Pursuit
roslaunch r2_raceline_pp pure_pursuit.launch raceline:=/home/jetson/paths/raceline_amcl_01.yamlroslaunch r2_raceline_pp amcl_raceline_rviz_fixed.launchEnable button: Y (index 4 → /pp_enable)
File:
r2_raceline_pp/config/pure_pursuit.yaml
Rules:
- Oscillation → increase lookahead
- Corner cutting → decrease lookahead
- Overshoot → lower speed
laser_bringup.launchamcl_only.launchraceline_to_path.launchsafety_mux.launchpure_pursuit.launch- Hold A → GO
| Speed (m/s) | Lookahead (m) | Use Case | If Wrong |
|---|---|---|---|
| 0.20 | 0.35–0.45 | First test / stand | Twitchy or wide |
| 0.30 | 0.45–0.60 | Slow indoor | Oscillation |
| 0.40 | 0.60–0.80 | Normal indoor | S-wiggle |
| 0.50 | 0.80–1.00 | Fast indoor | Under-steer |
| 0.60 | 1.00–1.20 | Only if AMCL solid | Unstable |
Rules:
- More speed = more lookahead
- Tight loop → cap lookahead, slow down
- Open loop → 1.0–1.5 m works
- Check teleop
- Check A button
- Check PP output
- Check
twist_muxoutput
- Verify YAML path loaded
- Check waypoint count
- Verify RViz topic
- Use PoseWithCovariance
- Check
/amcl_poseHz
- Increase lookahead
- Reduce speed
- Increase resample spacing
- Decrease lookahead
- Slow down
- Increase lookahead
- Check steering limits
- Wait for stability
- Set 2D Pose
- Then record
rosnode list | grep twist_muxKill one.
| Phase | AMCL |
|---|---|
| Manual Drive | OFF |
| Mapping | OFF |
| Localization | ON |
| Bag Recording | ON |
| Pure Pursuit | ON |
You now have a full, repeatable, F1TENTH-style Pure Pursuit workflow for the ROSMASTER R2.