Main repo for the ROS side of Project Phoenix
All dependencies for phnx are described in cmake and package files. This means that if you are missing a package somewhere, it will error for you.
To ensure you have all source nodes, be sure to vcs import pheonix.repos in your workspace /src.
Make sure to then Rosdep all these source nodes to drag in all binary dependencies.
If using Webots, you must install webots separately.
- Install ROS2 Humble, and ROS2 tools
- Install
sudo apt install python3-vcstool&sudo apt install python3-rosdep2- These are tools for importing/managing the other repositories for Phoenix and the dependencies for Phoenix, respectively
- Install Webots
- You can most likely skip this step, since attempting a sim launch without Webots installed will prompt an offer to install the correct version; however, if this does not work, please install it manually
- Create your ros workspace, a dir of
<ws_name>/src - In
src, clone this repo with Git - Still in
src, runcat Phoenix/phoenix.repos | vcs importto import source dependencies- This takes a list of repositories from the phoenix.repos file, and pipes it into the vcs import command, which will clone those repositories into your workspace
- Cd to the workspace root (the one that should have
scrin it), and runrosdep install --from-paths src --ignore-src -r -yto install binary dependencies- This may take a while, try to make sure you have a reasonable internet connection
- Remember to source ROS2 before building
source /opt/ros/humble/setup.bashand and to your bashrc with 'echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc' - Still in workspace root, run
colcon buildto build the workspace.- If using clang in your IDE,
run
colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON(this command takes care of depthai errors) - If using the compile commands, they are often created in build. Move it to the workspace root, and import it into your IDE tooling.
- If using clang in your IDE,
run
- Make sure your user is a part of the unix
dialoutgroup. This allows for it to connect to USB devices. In addition, make sure you have set the udev rules for the OAK-d camera, to allow for it to connect.
The repo should now be built, and launch-able in sim or on the kart.
Note: If you want to run Phoenix via your PC then connect via ssh using following commamnd
ssh isc@<hostname or IP address>
- This can't be done over the main university network, make sure you are connected to the same router as the onboard PC if you intend to SSH into it
- If you want to also have some windows/gui applications carry over, add the
-Xflag for x11 forwarding (linux devices only) - for more SSH help, try
man ssh
By default, webots will be launched:
ros2 launch phoenix_gazebo common.launch.py
ros2 launch phoenix_robot common.launch.py
This will spawn the autonomy stack, connecting to sensors and the CAN bus. This boots into teleop mode, so it will not output outputs of the autonomous stack (although it will be running).
Because this is designed to be headless on the kart, it's intended for this computer to be debugged over Wi-Fi. While this could be done with an adhoc network, we've found its best to just connect everything to a router, and connect to that for extra range.
By connecting with this network, one can share ROS2 instances, allowing for remote debugging and controls.
To achieve this, use the Ubiquiti Bullet AC's that are set up for long-distance teleop with the kart. You should get decent throughput out to >200m (highly dependent on environment, such as obstacles and noise. Mileage will vary!)
Once connected, run:
ros2 launch phoenix_robot utilibot.launch.py
This will launch all nodes relating to teleop and visualization that would exist in sim, but don't run on the headless kart. Because this ROS network is shared with the kart, this allows us to debug and control it.
Finally, pressing the teleop toggle switch on the controller will allow the autonomous stack to drive the kart. Toggling it again will swap back to teleop. This can be used as a sort of soft stop. Rviz can be used to view kart state.
If you want to just test the kart in a minimal teleop setup, you can use:
ros2 launch phoenix_robot teleop_only_kartside.launch.py
This file should be launched on a computer connected to the kart, similar to above. This can be autobooted, or just a laptop connected to the kart that will also run the utilitbot launch.
The file above needs to have both the interface board and both cameras connected. These are just used for their IMU.
If desired, you can just use the encoder alone by adding encoder_only.