Skip to content

Commit f5bf87e

Browse files
committed
updated and completely rewrote readme
added details to readme
1 parent 19fe9d9 commit f5bf87e

5 files changed

Lines changed: 285 additions & 399 deletions

File tree

AUTONOMY_STACK_README.md

Lines changed: 90 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@ The autonomy stack uses environment variables for easy configuration:
99
| Variable | Purpose | Example |
1010
|----------|---------|---------|
1111
| `ROBOT_CONFIG_PATH` | Robot-specific configuration | `mechanum_drive`, `unitree/unitree_g1` |
12-
| `MAP_PATH` | Map directory for localization | `/path/to/maps/warehouse` |
12+
| `MAP_PATH` | Map **file prefix** for localization | `/home/user/maps/warehouse/map` |
1313

1414
**Setting Robot Configuration:**
1515
```bash
1616
export ROBOT_CONFIG_PATH="mechanum_drive" # or "unitree/unitree_g1" or "unitree/unitree_b1"
1717
```
1818

19-
**Setting Map Directory (for Localization Mode):**
19+
**Setting Map (for Localization Mode):**
2020
```bash
21-
export MAP_PATH="/path/to/your/maps/warehouse" # Automatically enables localization mode
21+
export MAP_PATH="/home/user/maps/warehouse/map" # Enables localization mode
2222
```
23-
When `MAP_DIR` is set, the system automatically:
23+
When `MAP_PATH` is set, the system automatically:
24+
2425
- Enables localization mode for SLAM (uses pre-built map)
25-
- Loads `$MAP_PATH.pcd` for SLAM
26-
- Loads `$MAP_PATH_tomogram.pickle` for PCT route planner
27-
- Falls back to SLAM/mapping mode if `MAP_PATH` is not set
26+
- Loads `$MAP_PATH.pcd` (or legacy `.txt`) for SLAM
27+
- Loads `$MAP_PATH_tomogram.pickle` for the PCT route planner
28+
29+
If `MAP_PATH` is not set, the system runs in SLAM/mapping mode and the PCT planner runs in SLAM mode.
2830

2931
**Typical Workflow:**
3032
```bash
@@ -34,10 +36,33 @@ export ROBOT_CONFIG_PATH="mechanum_drive"
3436

3537
# For navigating in a known environment
3638
export ROBOT_CONFIG_PATH="mechanum_drive"
37-
export MAP_DIR="/home/user/maps/warehouse"
39+
export MAP_PATH="/home/user/maps/warehouse/map"
3840
./system_real_robot_with_route_planner.sh
3941
```
4042

43+
### Map Storage (SLAM + PCT)
44+
45+
Recommended map layout:
46+
47+
```text
48+
/home/user/maps/warehouse/
49+
├── map.pcd
50+
└── map_tomogram.pickle
51+
```
52+
53+
Set:
54+
55+
```bash
56+
export MAP_PATH="/home/user/maps/warehouse/map"
57+
```
58+
59+
To generate the tomogram from a PCD:
60+
61+
```bash
62+
source install/setup.bash
63+
ros2 run pct_planner pcd_to_tomogram.py /home/user/maps/warehouse/map.pcd -o /home/user/maps/warehouse/map_tomogram.pickle
64+
```
65+
4166
## ROS Topics
4267

4368
### Input Topics (Commands)
@@ -50,6 +75,15 @@ export MAP_DIR="/home/user/maps/warehouse"
5075
| `/joy` | `sensor_msgs/Joy` | Joystick input |
5176
| `/navigation_boundary` | `geometry_msgs/PolygonStamped` | Set navigation boundaries |
5277
| `/added_obstacles` | `sensor_msgs/PointCloud2` | Virtual obstacles |
78+
| `/speed` | `std_msgs/Float32` | Desired speed input used by the base autonomy controller (m/s) |
79+
| `/stop` | `std_msgs/Int8` | Safety stop input: `>=1` forces stop; `>=2` also forces yaw-rate stop |
80+
| `/clicked_point` | `geometry_msgs/PointStamped` | RViz “Publish Point” input (used by PCT tools/visualizer) |
81+
82+
### Internal Control Topics
83+
84+
| Topic | Type | Description |
85+
|-------|------|-------------|
86+
| `/slow_down` | `std_msgs/Int8` | Slowdown level used by the base autonomy controller (0–3) |
5387

5488
### Output Topics (Status)
5589

@@ -60,8 +94,17 @@ export MAP_DIR="/home/user/maps/warehouse"
6094
| `/terrain_map` | `sensor_msgs/PointCloud2` | Local terrain map |
6195
| `/terrain_map_ext` | `sensor_msgs/PointCloud2` | Extended terrain map |
6296
| `/path` | `nav_msgs/Path` | Local path being followed |
63-
| `/cmd_vel` | `geometry_msgs/Twist` | Velocity commands to motors |
97+
| `/cmd_vel` | `geometry_msgs/TwistStamped` | Velocity commands to motors |
6498
| `/goal_reached` | `std_msgs/Bool` | True when goal reached, false when cancelled/new goal |
99+
| `/global_path` | `nav_msgs/Path` | Global path from route planner (PCT planner) |
100+
| `/tomogram` | `sensor_msgs/PointCloud2` | Tomogram visualization (PCT planner) |
101+
| `/tomogram_debug_grid` | `nav_msgs/OccupancyGrid` | Debug occupancy grid (PCT planner) |
102+
103+
### Services
104+
105+
| Service | Type | Description |
106+
|---------|------|-------------|
107+
| `/build_tomogram` | `std_srvs/Trigger` | Build tomogram from `/explored_areas` (PCT planner in SLAM mode) |
65108

66109
### Map Topics
67110

@@ -86,153 +129,70 @@ ros2 topic pub /way_point geometry_msgs/msg/PointStamped "{
86129
ros2 topic pub /cancel_goal std_msgs/msg/Bool "data: true" --once
87130
```
88131

132+
### Stop the Robot (Safety Stop)
133+
134+
```bash
135+
# 1 = stop translation, 2 = also stop rotation
136+
ros2 topic pub /stop std_msgs/msg/Int8 "data: 2" --once
137+
```
138+
89139
### Monitor Robot State
90140
```bash
91141
ros2 topic echo /state_estimation
92142
```
93143

94-
## Configuration Parameters
95-
96-
### Vehicle Parameters (`localPlanner`)
97-
98-
| Parameter | Default | Description |
99-
|-----------|---------|-------------|
100-
| `vehicleLength` | 0.5 | Robot length (m) |
101-
| `vehicleWidth` | 0.5 | Robot width (m) |
102-
| `maxSpeed` | 0.875 | Maximum speed (m/s) |
103-
| `autonomySpeed` | 0.875 | Autonomous mode speed (m/s) |
104-
105-
### Goal Tolerance Parameters
106-
107-
| Parameter | Default | Description |
108-
|-----------|---------|-------------|
109-
| `goalReachedThreshold` | 0.3-0.5 | Distance to consider goal reached (m) |
110-
| `goalClearRange` | 0.35-0.6 | Extra clearance around goal (m) |
111-
| `goalBehindRange` | 0.35-0.8 | Stop pursuing if goal behind within this distance (m) |
112-
| `omniDirGoalThre` | 1.0 | Distance for omnidirectional approach (m) |
113-
114-
### Obstacle Avoidance
115-
116-
| Parameter | Default | Description |
117-
|-----------|---------|-------------|
118-
| `obstacleHeightThre` | 0.1-0.2 | Height threshold for obstacles (m) |
119-
| `adjacentRange` | 3.5 | Sensor range for planning (m) |
120-
| `minRelZ` | -0.4 | Minimum relative height to consider (m) |
121-
| `maxRelZ` | 0.3 | Maximum relative height to consider (m) |
122-
123-
### Path Planning
124-
125-
| Parameter | Default | Description |
126-
|-----------|---------|-------------|
127-
| `pathScale` | 0.875 | Path resolution scale |
128-
| `minPathScale` | 0.675 | Minimum path scale when blocked |
129-
| `minPathRange` | 0.8 | Minimum planning range (m) |
130-
| `dirThre` | 90.0 | Direction threshold (degrees) |
131-
132-
### Control Parameters (`pathFollower`)
133-
134-
| Parameter | Default | Description |
135-
|-----------|---------|-------------|
136-
| `lookAheadDis` | 0.5 | Look-ahead distance (m) |
137-
| `maxAccel` | 2.0 | Maximum acceleration (m/s²) |
138-
| `slowDwnDisThre` | 0.875 | Slow down distance threshold (m) |
144+
## Route Planner Notes (FAR vs PCT)
139145

140-
### SLAM Blind Zones (`feature_extraction_node`)
146+
The stack supports two global route planners:
141147

142-
| Parameter | Mecanum | Description |
143-
|-----------|---------|-------------|
144-
| `blindFront` | 0.1 | Front blind zone (m) |
145-
| `blindBack` | -0.2 | Back blind zone (m) |
146-
| `blindLeft` | 0.1 | Left blind zone (m) |
147-
| `blindRight` | -0.1 | Right blind zone (m) |
148-
| `blindDiskRadius` | 0.4 | Cylindrical blind zone radius (m) |
148+
- **FAR planner** (default)
149+
- **PCT planner** (optional)
149150

150-
## Operating Modes
151+
When using the PCT planner:
151152

152-
### Mode Control
153-
- **Joystick L2**: Hold for autonomy mode
154-
- **Joystick R2**: Hold to disable obstacle checking
153+
- **Service**: `/build_tomogram` (`std_srvs/Trigger`) builds a tomogram in SLAM mode from `/explored_areas`.
154+
- **Output**: `/global_path` (`nav_msgs/Path`) planned global path.
155+
- **Debug**: `/tomogram`, `/tomogram_debug_grid`.
155156

156-
### Speed Control
157-
The robot automatically adjusts speed based on:
158-
1. Obstacle proximity
159-
2. Path complexity
160-
3. Goal distance
157+
See `src/route_planner/PCT_planner/README.md` for details and dependencies.
161158

162-
## Tuning Guide
159+
## SLAM / Localization Notes
163160

164-
### For Tighter Navigation
165-
- Decrease `goalReachedThreshold` (e.g., 0.2)
166-
- Decrease `goalClearRange` (e.g., 0.3)
167-
- Decrease `vehicleLength/Width` slightly
161+
### Localization Mode (MAP_PATH)
168162

169-
### For Smoother Navigation
170-
- Increase `goalReachedThreshold` (e.g., 0.5)
171-
- Increase `lookAheadDis` (e.g., 0.7)
172-
- Decrease `maxAccel` (e.g., 1.5)
163+
Set `MAP_PATH` to a file prefix to enable localization:
173164

174-
### For Aggressive Obstacle Avoidance
175-
- Increase `obstacleHeightThre` (e.g., 0.15)
176-
- Increase `adjacentRange` (e.g., 4.0)
177-
- Increase blind zone parameters
178-
179-
## Common Issues
180-
181-
### Robot Oscillates at Goal
182-
- Increase `goalReachedThreshold`
183-
- Increase `goalBehindRange`
165+
```bash
166+
export MAP_PATH="/home/user/maps/warehouse/map"
167+
```
184168

185-
### Robot Stops Too Far from Goal
186-
- Decrease `goalReachedThreshold`
187-
- Decrease `goalClearRange`
169+
This causes:
188170

189-
### Robot Hits Low Obstacles
190-
- Decrease `obstacleHeightThre`
191-
- Adjust `minRelZ` to include lower points
171+
- SLAM to load: `/home/user/maps/warehouse/map.pcd` (or legacy `.txt`)
172+
- PCT planner to load: `/home/user/maps/warehouse/map_tomogram.pickle`
192173

193-
## SLAM Configuration
174+
### Launch Argument Overrides
194175

195-
### Localization Mode
176+
SLAM (explicit map path):
196177

197-
**Method 1: Environment Variable (Recommended)**
198-
```bash
199-
export MAP_DIR="/path/to/maps/warehouse"
200-
./system_real_robot_with_route_planner.sh
201-
```
202-
This automatically:
203-
- Enables `local_mode=true`
204-
- Loads map from `$MAP_DIR/map.pcd`
205-
- Loads tomogram from `$MAP_DIR/map.pickle` (for PCT planner)
206-
207-
**Method 2: Launch Arguments (Override)**
208178
```bash
209179
ros2 launch arise_slam_mid360 arize_slam.launch.py \
210180
local_mode:=true \
211-
relocalization_map_path:=/path/to/map.pcd \
181+
relocalization_map_path:=/home/user/maps/warehouse/map.pcd \
212182
init_x:=0.0 init_y:=0.0 init_yaw:=0.0
213183
```
214184

215-
**Method 3: RViz Re-localization**
216-
1. Launch with a map loaded (using either method above)
217-
2. In RViz, click "2D Pose Estimate" button
218-
3. Click and drag on the map to set new initial pose
219-
4. SLAM will automatically reset and re-localize
185+
PCT planner (explicit tomogram path):
220186

221-
### Map File Structure
222-
When using `MAP_DIR`, organize files as:
223-
```
224-
$MAP_DIR/
225-
├── map.pcd # SLAM point cloud map (required)
226-
└── map.pickle # PCT planner tomogram (required for route planning)
187+
```bash
188+
ros2 launch pct_planner pct_planner.launch.py \
189+
local_mode:=true \
190+
tomogram_path:=/home/user/maps/warehouse/map_tomogram.pickle
227191
```
228192

229-
### Supported Map Formats
230-
- **SLAM**: `.pcd` (Point Cloud Data) or `.txt` (legacy text format)
231-
- **PCT Planner**: `.pickle` (tomogram file)
193+
### RViz Re-localization
232194

233-
### Mapping Performance
234-
```yaml
235-
mapping_line_resolution: 0.1 # Decrease for higher quality
236-
mapping_plane_resolution: 0.2 # Decrease for higher quality
237-
max_iterations: 5 # Increase for better accuracy
238-
```
195+
1. Launch with a map loaded (MAP_PATH or explicit launch args)
196+
2. In RViz, click **2D Pose Estimate**
197+
3. Click/drag to set the initial pose
198+
4. SLAM will reset and re-localize

0 commit comments

Comments
 (0)