Warehouse sim running - but not yet working.

This commit is contained in:
2026-05-07 22:07:02 +00:00
parent d3c3d03ae7
commit c1319a6357
12 changed files with 1161 additions and 10 deletions
+83 -6
View File
@@ -180,7 +180,67 @@ The sensor activates automatically when a subscriber connects and deactivates wh
---
## Launch arguments
## Simulation (Gazebo)
The simulation runs inside the **devcontainer** — not as a Docker Compose service. The devcontainer already has the display socket, GPU access, and host networking that Gazebo requires. Docker Compose is used only for deployment to the physical robot.
Build the ROS workspace inside the devcontainer (once, or after source changes):
```bash
cd /home/ws
colcon build --packages-select raspbot_v2 --symlink-install
source install/setup.bash
```
### Launching
```bash
# Gazebo only — robot spawned, no SLAM or navigation
ros2 launch raspbot_v2 sim_launch.py
# Gazebo + SLAM (building a map) + RViz
ros2 launch raspbot_v2 sim_launch.py use_slam:=true use_rviz:=true
# Full stack — SLAM + Nav2 autonomous navigation + RViz
ros2 launch raspbot_v2 sim_launch.py use_slam:=true use_nav2:=true use_rviz:=true
# Use a custom world file
ros2 launch raspbot_v2 sim_launch.py world:=/path/to/my_world.sdf
```
### Launch arguments
| Argument | Default | Description |
|---|---|---|
| `world` | `worlds/empty_world.sdf` | Path to the Gazebo world SDF |
| `use_slam` | `false` | Run slam_toolbox in async mapping mode |
| `use_nav2` | `false` | Run the Nav2 navigation stack |
| `use_rviz` | `true` | Open RViz2 with the pre-configured layout |
| `wheel_base` | `0.14` | Wheel separation (m) — match the motor controller value |
### Configuration files
| File | Purpose |
|---|---|
| `config/slam_toolbox.yaml` | SLAM mode, map resolution, scan topic, frame IDs |
| `config/nav2_params.yaml` | BT navigator, DWB local planner, costmaps, AMCL, recovery behaviours |
| `config/controllers.yaml` | ros2_control — joint_state_broadcaster and pan_tilt_controller with PID gains |
| `config/rviz2_config.rviz` | Pre-configured displays: Map, RobotModel, LaserScan, Camera, TF, path plans |
| `worlds/empty_world.sdf` | Flat ground plane with lighting — add walls and furniture as needed |
### Relationship to the hardware launch
`sim_launch.py` and `robot.launch.py` use the same URDF and the same `raspbot_v2` package. The difference is what drives the joints:
| | Simulation | Hardware |
|---|---|---|
| Drive | `gz-sim-diff-drive-system` plugin | `motor_controller_node` via I²C |
| Pan/tilt | `gz_ros2_control` + `pan_tilt_controller` | `camera_orientation_node` via I²C |
| Clock | Gazebo simulated time (`use_sim_time: true`) | System clock |
---
## Hardware launch arguments
Launch arguments can be appended when running the container manually:
@@ -208,18 +268,35 @@ docker run --rm \
```
robot/
├── Dockerfile # Two-stage build: colcon compile → clean runtime image
├── Dockerfile # Two-stage build: colcon compile → clean runtime image
├── src/
│ └── raspbot_v2/
│ ├── package.xml
│ ├── setup.py
│ ├── launch/
│ │ ── robot.launch.py # Starts all three nodes together
│ │ ── robot.launch.py # Hardware — starts all nodes on the physical robot
│ │ └── sim_launch.py # Simulation — Gazebo + optional SLAM/Nav2/RViz
│ ├── urdf/
│ │ ├── raspbot_v2.urdf.xacro # Top-level — includes all sub-files
│ │ ├── robot_base.xacro # Chassis, wheels, diff-drive plugin
│ │ ├── pan_tilt.xacro # Pan/tilt mount, joints, ros2_control block
│ │ ├── camera.xacro # Camera link, optical frame, Gazebo sensor
│ │ ├── lidar.xacro # Lidar link, Gazebo gpu_lidar sensor
│ │ ├── sonar.xacro # Ultrasonic link, Gazebo narrow-lidar approximation
│ │ └── raspbot_v2.ros2_control.xacro # gz_ros2_control plugin
│ ├── config/
│ │ ├── controllers.yaml # ros2_control — joint_state_broadcaster + pan_tilt_controller
│ │ ├── slam_toolbox.yaml # SLAM mode, map resolution, scan topic, frame IDs
│ │ ├── nav2_params.yaml # BT navigator, DWB planner, costmaps, AMCL, recovery
│ │ └── rviz2_config.rviz # Pre-configured displays: Map, RobotModel, LaserScan, Camera
│ ├── worlds/
│ │ └── empty_world.sdf # Flat ground plane with lighting
│ └── raspbot_v2/
│ ├── motor_controller_node.py
│ ├── camera_orientation_node.py
── ultrasonic_node.py
└── raspbot_v2_interface/ # Vendored Yahboom hardware library
── ultrasonic_node.py
│ └── led_node.py
└── raspbot_v2_interface/ # Vendored Yahboom hardware library
└── Raspbot_Lib/
└── Raspbot_Lib.py # I²C driver (smbus, bus 1, addr 0x2B)
└── Raspbot_Lib.py # I²C driver (smbus, bus 1, addr 0x2B)
```