Newcastle Racing AI module for path planning.
To start working on this project, clone this repository.
git clone --recurse-submodules https://github.com/NewcastleRacingAI/nrai_pathplanning.git
cd nrai_pathplanningnrai_pathplanning
├── resource
│ └── nrai_pathplanning # File marking the ros package name
├── src
│ └── nrai_pathplanning
│ ├── ros.py # Ros node
│ ├── ... # Main code
│ └── __init__.py
├── test # Tests
├── package.xml # Ros2 package configuration
├── setup.cfg # Ros2 python paths
└── setup.py # Python configuration- To add python dependencies add them to the
setup.pyfile - To add ros2 depedencies add them to the
package.xmlfile
Despite being part of the nrai collection of packages created by the Newcastle Racing AI group, this package can also be used in standalone mode, which does not require a ROS installation.
As a preliminary optional step, consider creating a virtual envirnoment with any tool you commonly use
python3 -m venv .venv
source .venv/bin/activate # On Linux
.venv/script/activate # On WindowsThen, use pip to install the package locally in edit mode (-e)
pip3 install -e .[standalone]
Note
If you are having issues during the installation, consider removing the -e flag, or adding the --user flag.
All changes you make to the package will be effective immediately, without the need of reinstalling it (provided you are using the -e flag).
When in standalone mode, the package provides a specialized entrypoint
python3 -m nrai_pathplanning <path to rosbag>The entrypoint expects a rosbag2 file. In simple terms, a recording of the messages exchanged by the topics in a ROS network.
If no other arguments are provided, the entrypoint will list all the topics in the rosbag
python3 -m nrai_pathplanning <path to rosbag>To list all the messages in a specific topic, use the --list-messages argument
python3 -m nrai_pathplanning <path to rosbag> --topic <topic name> Note that this operation may take a while if the rosbag is large, and the output may be very long.
To playback the rosbag, use the --play argument
python3 -m nrai_pathplanning <path to rosbag> --playAll the messages in the rosbag will be processed in order and sent through the process_msg function in the nrai_pathplanning.__main__ file.
The function will then filter only the topics it is interested in, and call the appropriate processing functions from the nrai_pathplanning.code module.
Then, it is up to you to modify those functions to implement your own path planning algorithms.
flowchart LR
bag[Rosbag2 file]
subgraph nrai_pathplanning
direction TB
p[process_msg]
po[process_pose]
im[process_imu]
end
bag --> p
p --> po
p --> im