Skip to content

Commit f99f1dd

Browse files
MultyXuAryan-Naveeny-veys
authored
Feature/mid level planner/main (#30)
* draft structure for the mid level planner. * Add high level structure for using MidLevelPlanner in spto_executor * add more info about the map into MidLevelPlanner * add todos after meeting with Aaron and Nathan * test * Figure out the tf for robot pose, map origin, and planed path. [maybe all of them should be in map frame] * clean code, proper transformation between grid index and global pose * wip * projection heuristic * pre-merge commit * after fist test * ugly update but path is correctly passed. Visualization not working, need to figure out. * Path plan is in <robot>/odom frame. Everything plan respect to this frame now. * debugging global point projection * working path plan * Now outputing plan iteratively untill reached goal. If A* fail to find a plan, it will fall back to follow the original high level plan. * Adding flag for fake occupancy and fake path. * cleaned & added projection viz * Visualization working * further clean up and add back informative log messages. * independent fake occupancy and path publisher. Naive map inflation. * Visualizes test path now * Fixed lookahead bug * Heurestic for projection * Code clean up: move occupancy grid outside of mid-level planner * further clean up * Improved heurestic for projection * Documentation * Documentation and better testing * major refactor * furhter bug fix after merge * add parameters to launch file. * After robot test fixes * minor fix * cleanup * Address some of Aaron's comments * viz cleanup * More comments on code. * Bug fix after addressing comments * pre-commit fixed * modifying OccupancyMap lock. * precommit fix * timeout for failing * broken viz * viz update * viz and pre-commit --------- Co-authored-by: Aryan-Naveen <[email protected]> Co-authored-by: Aryan-Naveen <[email protected]> Co-authored-by: Aryan Naveen <[email protected]> Co-authored-by: y-veys <[email protected]>
1 parent 2c3c7ec commit f99f1dd

File tree

10 files changed

+1383
-69
lines changed

10 files changed

+1383
-69
lines changed

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,87 @@ a little plot of the agent moving along a path. Run it with `python -i` so
1919
that the plot stays at the end. If it crashes with an inscrutable error,
2020
you may need to `pip install opencv-python-headless` because of a conflict
2121
between opencv's QT version and matplotlib's QT version.
22+
23+
24+
# Testing Mid-Level Planner in Simulation
25+
26+
You can find the implemented mid-level planner in `robot_executor_interface/src/robot_executor_interface/mid_level_planner.py`.
27+
28+
## Setup and Testing Instructions
29+
30+
The mid-level planner can be tested using the DCIST launch system with fake publishers to simulate robot behavior and occupancy data.
31+
32+
### 1. Launch the DCIST System
33+
34+
First, launch the complete DCIST system in simulation mode:
35+
36+
```bash
37+
ADT4_SIM_TIME=false tmuxp load dcist_launch_system/tmux/autogenerated/spot_prior_dsg-spot_prior_dsg.yaml
38+
```
39+
40+
This will start all the necessary nodes including the spot executor and planning systems.
41+
42+
### 2. Start the Fake Occupancy Publisher
43+
44+
In a separate terminal, launch the fake occupancy publisher to provide simulated occupancy grid data:
45+
46+
```bash
47+
ros2 run spot_tools_ros fake_occupancy_publisher
48+
```
49+
50+
This publishes a test occupancy grid that the mid-level planner uses for obstacle avoidance and path planning.
51+
52+
#### Occupancy Publisher Parameters
53+
54+
You can customize the occupancy grid simulation using the following parameters:
55+
56+
- `--num_obstacles <N>`: Number of simulated obstacles in the occupancy grid (default: 5)
57+
- `--crop_distance <D>`: How far the robot can "see" in meters - areas beyond this distance are marked as unknown (default: 5.0, set to -1 to disable cropping)
58+
- `--resolution <R>`: Map resolution in meters per cell (default: 0.12)
59+
- `--robot_name <NAME>`: Robot name for topic namespacing (default: 'hamilton')
60+
- `--publish_rate <RATE>`: Publishing frequency in Hz (default: 10.0)
61+
62+
**Example with custom parameters:**
63+
```bash
64+
ros2 run spot_tools_ros fake_occupancy_publisher --num_obstacles 10 --crop_distance 8.0
65+
```
66+
67+
This creates a more challenging environment with 10 obstacles and allows the robot to "see" up to 8 meters away.
68+
69+
### 3. Send Path Commands
70+
71+
In another terminal, use the fake path publisher to send waypoint commands to the planner:
72+
73+
```bash
74+
ros2 run spot_tools_ros fake_path_publisher <x> <y>
75+
```
76+
77+
Where `<x>` and `<y>` are the desired target coordinates. For example:
78+
```bash
79+
ros2 run spot_tools_ros fake_path_publisher -6 1
80+
```
81+
82+
### 4. Visualization in RViz
83+
84+
Launch RViz to visualize the planning behavior and monitor the following key topics:
85+
86+
1. **High-level Path**: `/hamilton/omniplanner_node/compiled_plan_viz_out`
87+
- Shows the simulated high-level path from the omniplanner
88+
89+
2. **Mid-Level Planner Output**: `/hamilton/spot_executor_node/mlp_path_publisher`
90+
- Displays the locally planned path from the mid-level planner
91+
- This path incorporates obstacle avoidance and local optimization
92+
93+
3. **Occupancy Grid**: `/hamilton/hydra/tsdf/occupancy`
94+
- Shows the TSDF occupancy map used for planning
95+
- Visualizes obstacles and free space
96+
97+
### Expected Behavior
98+
99+
The mid-level planner should:
100+
- Receive high-level waypoints from the fake path publisher
101+
- Process the occupancy grid from the fake occupancy publisher
102+
- Generate locally optimal paths that avoid obstacles
103+
- Publish the resulting path for execution by the robot controller
104+
105+
This testing setup allows you to validate the mid-level planner's obstacle avoidance, path smoothing, and local optimization capabilities in a controlled simulation environment.

0 commit comments

Comments
 (0)