Target Setup and Testing

Setup the Target:

1- ssh to your target or run the following commands on your target directly.

2- make sure libffi is included with your image otherwise copy it over from your sdp

scp ~/qnx710/target/qnx7/x86_64/usr/lib/libffi.so.6 root@<target_ip>:/usr/lib/
ln -s /usr/lib/libffi.so.6 /usr/lib/libffi.so

3- If a /tmp directory does not exist, add one on your target. Please note that this will require having a writable / partition, otherwise you can create another partition and mount it on top of / or /tmp

mkdir /tmp

4- Update system time with ntpdate (on target). Please use the appropriate time server for your region. The following time server is for Canada, but others can be found at https://www.ntppool.org/zone.

ntpdate 0.ca.pool.ntp.org

5- Install pip on your target

python3 -m ensurepip

6- Install python dependencies on your target.

pip3 install -U \
colcon-common-extensions \
importlib-metadata \
importlib-resources \
lark-parser

7- create a directory for ROS2’s installation.

mkdir -p /opt/ros/galactic

8- Get the ip address of your target

ifconfig

9- Check the amount of space available on your target and make sure you have enough space to copy the files over.

df -h

10- Copy ROS 2 to your target.

Note: you will have to replace “your_target_architecture” with your target architecture (e.g: “aarch64le” or “x86_64).

On host:

cd ~/ros2_galactic/install/<your_target_arch>/
tar -czvf ros2_galactic.tar.gz *
scp ros2_galactic.tar.gz root@target_ip_address:/opt/ros/galactic/

On target:

cd /opt/ros/galactic
tar -xzvf ros2_galactic.tar.gz

All the necessary files to run ROS 2 are now on your target.

11- Add the following lines to the end of your /etc/profile file

export COLCON_CURRENT_PREFIX=/opt/ros/galactic
export PYTHONPATH=/opt/ros/galactic/usr/lib/python3.11/site-packages
. /opt/ros/galactic/local_setup.sh

12- Logout and login or reboot. On QNX, a reboot can be done using shutdown.

Test the installation

1- ssh to your target and on one terminal run the following.

ros2 run demo_nodes_cpp talker

2- On another terminal run the following.

ros2 run demo_nodes_py listener

You should see the demos running on both terminals if the installation went successful.