Link Search Menu Expand Document

ROS2 Installation on VOXL 2

VOXL2 SDK 1.1 and Above will contain the debians onboard for ROS2 Foxy (base) to be installed on disk (NOTE: If a user wishes to use a newer version, they must leverage docker). In order to install on disk, a user must run the following on their command line:

apt-get install voxl-ros2-foxy -y

NOTE: An internet connection is NOT required to install this package.

Environment Setup Script

Once the ROS2 environment has been installed, the user can source the required bash script in order to have all the proper paths setup for ros2 foxy to run. This can be done by running: source /opt/ros/foxy/setup.bash

If you wish to add this to your bashrc file so you don’t need to rerun this each time you adb shell or ssh into the VOXL 2, run the following: echo 'source /opt/ros/foxy/setup.bash' >> ~/.bashrc

MPA-TO-ROS2

Once the installation of ros2 has been done, the user can then install voxl-mpa-to-ros2 - which is a ros2 node that will convert the following from MPA to ROS2 messages:

  1. IMU data
  2. Camera Images (Hires, tracking, and stereo)
  3. Point Cloud Information
  4. 6DOF VIO data

In order to install it, run the following on your command line:

apt-get install voxl-mpa-to-ros2 -y

Once this is installed, you will need to configure the package accordingly, which can be done by running on the command line (NOTE: This configuration WILL need internet!!!):

apt-get install python3-pip -y && voxl-configure-mpa-to-ros2

This will automatically place the right lines into your bashrc to tell the system where the voxl-mpa-to-ros2 executables are!

NOTE: Make sure before you run the code, you either source your bashrc via source ~/.bashrc OR you reboot your VOXL 2. Once this is done, in order to run voxl_mpa_to_ros2, run:

ros2 run voxl_mpa_to_ros2 voxl_mpa_to_ros2_node

MPA to ROS app is now running

Found new interface: hires_small_color
Found new interface: stereo_front
Found new interface: stereo_rear
Found new interface: tracking
Found new interface: imu_apps
Found new interface: imu_apps_raw

NOTE: In order to see the interfaces above, the user must ensure the voxl SDK services are running as well. For example, if you wish to see IMU data in ROS2, the user must have voxl-imu-server enabled and running.

List Topics

In a new shell, run the following:

voxl2:~$ ros2 topic list
/hires_small_color
/imu_apps
/stereo_front/left
/stereo_front/right
/tracking
/voa_pc_out

All topic outputs and ROS2 msgs formats

Topics:

/hires_large_color - sensors_msg/msg/Image
/hires_large_encoded - sensors_msg/msg/Image
/hires_large_grey - sensors_msg/msg/Image
/hires_small_color - sensors_msg/msg/Image
/hires_small_encoded - sensors_msg/msg/Image
/hires_small_snapshot - sensors_msg/msg/Image
/stereo - sensors_msg/msg/Image
/tracking - sensors_msg/msg/Image
/imu_apps - sensor_msgs/msg/Imu
/qvio - geometry_msgs/msg/PoseStamped / nav_msgs/msg/Odometry
/qvio_overlay - sensors_msg/msg/Image
/tof_conf - sensors_msg/msg/Image
/tof_depth - sensors_msg/msg/Image
/tof_ir - sensors_msg/msg/Image
/tof_pc - sensors_msg/msg/PointCloud2
/voa_pc_out - sensors_msg/msg/PointCloud2
/vvhub_body_wrt_fixed - geometry_msgs/msg/PoseStamped / nav_msgs/msg/Odometry
/vvhub_boxy_wrt_local - geometry_msgs/msg/PoseStamped / nav_msgs/msg/Odometry
/tflite_data - voxl_msgs/msg/Aidetection

NOTE: The way mpa_to_ros2 is programmed, topics only get published when something is subscribed to the topic. Otherwise it will just be advertised!

Voxl2 MicroDDS Communication with PX4

Users on SDK 1.1 and above will have the ability to install voxl-microdds-agent which runs a dds agent middle-ware that can communicate with the px4 instance running onboard. This can be installed via:

apt install -y voxl-microdds-agent && voxl-configure-microdds

Once this is setup and running (can be checked with a voxl-inspect-services), the user now has the ability to probe px4 via ros2. The topics that you can interface with are the following:

/fmu/in/obstacle_distance
/fmu/in/offboard_control_mode
/fmu/in/onboard_computer_status
/fmu/in/sensor_optical_flow
/fmu/in/telemetry_status
/fmu/in/trajectory_setpoint
/fmu/in/vehicle_attitude_setpoint
/fmu/in/vehicle_command
/fmu/in/vehicle_mocap_odometry
/fmu/in/vehicla_rates_setpoint
/fmu/in/vehicle_trajectory_bezier
/fmu/in/vehicle_trajectory_waypoint
/fmu/in/vehicle_visual_odometry
/fmu/out/failsafe_flags
/fmu/out/position_setpoint_triplet
/fmu/out/sensor_combined
/fmu/out/timesync_status
/fmu/out/vehicle_attitude
/fmu/out/vehicle_control_mode
/fmu/out/vehicle_gps_position
/fmu/out/vehicle_local_position
/fmu/out/vehicle_odometry
/fmu/out/vehicle_status

Running a figure 8 via ros2, microdds, and px4

With microdds agent running and the client running on px4, we now have the ability to send setpoints in via the dds bridge and ros2. This feature is already implemented with the voxl-mpa-to-ros2 code base. In order to run this, the user must run:

ros2 run voxl_offboard_figure8 voxl_offboard_figure8

Using a Bernoulli’s Lemniscate, we calculate the position, velocity, and acceleration along the path, and package those up into a trajectory_setpoint ros2 message, when then gets published to px4 to execute the path!

In order to run this demo, ensure that you have the parameter offboard_mode set to off in the voxl-vision-hub.conf file. Then restart voxl-vision-hub via systemctl restart voxl-vision-hub