|
| 1 | +# Imperative Path Planner (iPlanner) |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +iPlanner is a local path planning package that uses front depth image and imperative learning. |
| 6 | + |
| 7 | +**Keywords:** Navigation, Local Planning, Imperative Learning |
| 8 | + |
| 9 | +### License |
| 10 | + |
| 11 | +This code is released under the MIT License. |
| 12 | + |
| 13 | +**Author: Fan Yang<br /> |
| 14 | +Maintainer: Fan Yang, [email protected]** |
| 15 | + |
| 16 | +The iPlanner package has been tested under ROS Noetic on Ubuntu 20.04. This is research code, and any fitness for a particular purpose is disclaimed. |
| 17 | + |
| 18 | +<p align="center"> |
| 19 | + <img src="img/example.jpg" alt="Method" width="70%"/> |
| 20 | +</p> |
| 21 | + |
| 22 | +## Installation |
| 23 | + |
| 24 | +#### Dependencies |
| 25 | + |
| 26 | +To run iPlanner, you need to install [PyTorch](https://pytorch.org/). We recommend using [Anaconda](https://docs.anaconda.com/anaconda/install/index.html) for installation. Check the official website for installation instructions for Anaconda and PyTorch accordingly. |
| 27 | + |
| 28 | +Then, please follow the instructions to install the necessary packages listed in the |
| 29 | + |
| 30 | + requirements.txt |
| 31 | + |
| 32 | +#### Simulation Environment Setup |
| 33 | + |
| 34 | +Please refer to the Autonomous Exploration Development Environment repository for setting up the Gazebo simulation Environment: [Website](https://www.cmu-exploration.com/), switch to the branch **rgbd_camera**. |
| 35 | + |
| 36 | +#### Building |
| 37 | + |
| 38 | +To build the repository and set up the right Python version for running, use the command below: |
| 39 | + |
| 40 | + catkin build iplanner_node -DPYTHON_EXECUTABLE=$(which python) |
| 41 | + |
| 42 | +The Python3 should be the Python version you set up before with Torch and PyPose ready. If using the Anaconda environment, activate the conda env and check |
| 43 | + |
| 44 | + which python |
| 45 | + |
| 46 | + |
| 47 | +## Training |
| 48 | +Go to the **iplanner** folder |
| 49 | + |
| 50 | + cd <your_imperative_planenr_path>/iplanner |
| 51 | + |
| 52 | +#### Pre-trained Network and Training Data |
| 53 | +Download the pre-trained network weights **plannernet.pt** [here](https://drive.google.com/file/d/1UD11sSlOZlZhzij2gG_OmxbBN4WxVsO_/view?usp=share_link) and put it into the **models** folder. Noted this pre-trained network has not been adapted to real-world data. |
| 54 | + |
| 55 | +You can also collect data yourself either inside the simulation environment or in the real-world. Launch the **data_collect_node** |
| 56 | + |
| 57 | + roslaunch iplanner_node data_collector.launch |
| 58 | + |
| 59 | +Provide the information for the necessary topics listed in **config/data_params.yaml**. The collected data will be put into the folder **data/CollectedData**, and generate folders for different environments that you can specify in **config/data_params.yaml** under **env_name**. |
| 60 | + |
| 61 | +For each of the environments, the data contains the structure of: |
| 62 | + |
| 63 | + Environment Data |
| 64 | + ├── camera |
| 65 | + | ├── camera.png |
| 66 | + │ └── split.pt |
| 67 | + ├── camera_extrinsic.txt |
| 68 | + ├── cloud.ply |
| 69 | + ├── color_intrinsic.txt |
| 70 | + ├── depth |
| 71 | + | ├── depth.png |
| 72 | + │ └── split.pt |
| 73 | + ├── depth_intrinsic.txt |
| 74 | + ├── maps |
| 75 | + │ ├── cloud |
| 76 | + │ │ └── tsdf1_cloud.txt |
| 77 | + │ ├── data |
| 78 | + │ │ ├── tsdf1 |
| 79 | + ├── data |
| 80 | + │ │ └── tsdf1_map.txt |
| 81 | + │ └── params |
| 82 | + │ └── tsdf1_param.txt |
| 83 | + └── odom_ground_truth.txt |
| 84 | + |
| 85 | +You can download the example data we provided using the Google Drive link [here](https://drive.google.com/file/d/1bUN7NV7arMM8ASA2pTJ8hvdkc5N3qoJw/view?usp=sharing). |
| 86 | + |
| 87 | +#### Generating Training Data |
| 88 | + |
| 89 | +Navigate to the iplanner folder within your project using the following command: |
| 90 | + |
| 91 | + cd <<YORU WORKSPACE>>/src/iPlanner/iplanner |
| 92 | + |
| 93 | +Run the Python script to generate the training data. The environments for which data should be generated are specified in the file **collect_list.txt**. You can modify the data generation parameters in the **config/data_generation.json** file. |
| 94 | + |
| 95 | + python data_generation.py |
| 96 | + |
| 97 | +Once you have the training data ready, use the following command to start the training process. You can specify different training parameters in the **config/training_config.json** file. |
| 98 | + |
| 99 | + python training_run.py |
| 100 | + |
| 101 | +## Run iPlanner ROS node |
| 102 | + |
| 103 | +Launch the simulation environment without the default local planner |
| 104 | + |
| 105 | + roslaunch vehicle_simulator simulation_env.launch |
| 106 | + |
| 107 | +Run the iPlanner ROS node without visualization: |
| 108 | + |
| 109 | + roslaunch iplanner_node iplanner.launch |
| 110 | + |
| 111 | +Or run the iPlanner ROS node with visualization: |
| 112 | + |
| 113 | + roslaunch iplanner_node iplanner_viz.launch |
| 114 | + |
| 115 | +### Path Following |
| 116 | +To ensure the planner executes the planned path correctly, you need to run an independent controller or path follower. Follow the steps below to set up the path follower using the provided launch file from the iplanner repository: |
| 117 | + |
| 118 | +Download the default iplanner_path_follower into your workspace. Navigate to your workspace's source directory using the following command: |
| 119 | + |
| 120 | + cd <<YOUR WORKSPACE>>/src |
| 121 | + |
| 122 | +Then clone the repository: |
| 123 | + |
| 124 | + git clone https://github.com/MichaelFYang/iplanner_path_follow.git |
| 125 | + |
| 126 | +Compile the path follower using the following command: |
| 127 | + |
| 128 | + catkin build iplanner_path_follow |
| 129 | + |
| 130 | +Please note that this repository is a fork of the path following component from [CMU-Exploration](https://www.cmu-exploration.com/). You are welcome to explore and try different controllers or path followers suitable for your specific robot platform. |
| 131 | + |
| 132 | +### Waypoint Navigation |
| 133 | +To send the waypoint through Rviz, please download the rviz waypoint plugin. Navigate to your workspace's source directory using the following command: |
| 134 | + |
| 135 | + cd <<YOUR WORKSPACE>>/src |
| 136 | + |
| 137 | +Then clone the repository: |
| 138 | + |
| 139 | + git clone https://github.com/MichaelFYang/waypoint_rviz_plugin.git |
| 140 | + |
| 141 | +Compile the waypoint rviz plugin using the following command: |
| 142 | + |
| 143 | + catkin build waypoint_rviz_plugin |
| 144 | + |
| 145 | + |
| 146 | +### SmartJoystick |
| 147 | + |
| 148 | +Press the **LB** button on the joystick, when seeing the output on the screen: |
| 149 | + |
| 150 | + Switch to Smart Joystick mode ... |
| 151 | + |
| 152 | +Now the smartjoystick feature is enabled. It takes the joystick command as motion intention and runs the iPlanner in the background for low-level obstacle avoidance. |
| 153 | + |
| 154 | +## Config files |
| 155 | + |
| 156 | +The params file **`data_params.yaml`** is for data collection |
| 157 | + |
| 158 | +* **vehicle_sim.yaml** The config file contains: |
| 159 | + - **`main_freq`** The ROS node running frequency |
| 160 | + - **`odom_associate_id`** Depending on different SLAM setup, the odometry base may not be set under robot base frame |
| 161 | + |
| 162 | +The params file **`vehicle_sim.yaml`** is for iPlanner ROS node |
| 163 | + |
| 164 | +* **vehicle_sim.yaml** The config file contains: |
| 165 | + - **`main_freq`** The ROS node running frequency |
| 166 | + - **`image_flap`** Depending on the camera setup, it may require to flip the image upside down or not |
| 167 | + - **`crop_size`** The size to crop the incoming camera images |
| 168 | + - **`is_fear_act`** Using the predicted collision possibility value to stop |
| 169 | + - **`joyGoal_scale`** The max distance of goal sent by joystick in smart joystick model |
| 170 | + |
| 171 | + |
| 172 | +## Reference |
| 173 | + |
| 174 | +If you utilize this codebase in your research, we kindly request you to reference our work. You can cite us as follows: |
| 175 | + |
| 176 | +- Yang, F., Wang, C., Cadena, C., & Hutter, M. (2023). iPlanner: Imperative Path Planning. Robotics: Science and Systems Conference (RSS). Daegu, Republic of Korea, July 2023. |
| 177 | + |
| 178 | +## Author |
| 179 | + |
| 180 | +This codebase has been developed and maintained by [Fan Yang ](https://github.com/MichaelFYang). Should you have any queries or require further assistance, you may reach out to him at [email protected] |
0 commit comments