ROS1 and ROS2 Setup for ROS2AR
Table of contents
- 1 Table of contents
- 2 Running ROS1 kinetic in Docker
- 3 ROS2 Setup
- 4 Running ROS1-ROS2 Docker and the ar_monitor snap package
- 5 Installing and running ar_monitor package with snap
Installing ROS1
For ros melodic follow the instructions from this page: http://wiki.ros.org/melodic/Installation/Ubuntu
For ros kinetic follow the instructions from this page: http://wiki.ros.org/kinetic/Installation/Ubuntu
For ros melodic on Raspberry pi 4 follow the instructions from this page: Standalone ROS Setup
Installing the prebuilt ar_monitor package
Download the package:
You can download our package binary package from Bitbucket repo:
For ros melodic: ros-melodic-ar-monitor.deb
For ros kinetic: ros-kinetic-ar-monitor.deb
Installing the package
Open the Downloads folder in a new terminal:
sudo dpkg -i ros-[version]-ar-monitor.deb
Unless not installed explicitly, you should install the rosbridge-server package.
sudo apt-get install ros-[version]-rosbridge-server
Do not forget to source your ros version after opening a new terminal (or place it in the bashrc file for automatic sourcing):
source /opt/ros/[version]/setup.bash
Run or Launching the ros node:
Launching the status_server node:
Open a new terminal:
roslaunch ar_monitor all.launch #you have to install rosbridge_server the rosapi packages
Running the status_server node:
Open a new terminal:
roscore
Open a new tab in terminal:
rosrun ar_monitor status_server.py
Testing on local packages
Open a new terminal:
Launch the status_server node
Calling the service of the node (in a new tab):
rosservice call /ar_status_service "arg: '<package_name>/<launch_file_name>.launch'"
For example:
rosservice call /ar_status_service "arg: 'ar_monitor/all.launch'"
Running ROS1 kinetic in Docker
Installing Docker:
sudo apt-get install docker.io
Pull the docker image:
docker pull ngisystems/ros-kinetic-ar-monitor
Running the docker container:
sudo docker run -it ngisystems/ros-kinetic-ar-monitor
Running the image in multiple terminal:
sudo docker exec -it <container_name> bash #for example sudo docker exec -it d3363b5c0bc4 bash
** In this docker image is included the ardrone_autonomy package for testing.
Example of running the nodes in docker
Open a new terminal:
sudo docker run -it ngisystems/ros-kinetic-ar-monitor
source /opt/ros/kinetic/setup.bash
roslaunch ar_monitor all.launch
In a new terminal:
sudo docker exec -it [container] bash
source /opt/ros/kinetic/setup.bash
roslaunch ardrone_autonomy ardrone.launch
Using rosbag for simulating a drone:
Open a new terminal:
sudo docker run -it --network host ngisystems/ros-kinetic-ar-monitor
roscore
In a new terminal
sudo docker exec -it [container] bash
rosbag play catkin_ws/src/example.bag
In a new terminal
sudo docker exec -it [container] bash
cd catkin_ws
source devel/setup.bash
rosrun ar_monitor_extended status_server.py
In a new terminal you can see the values of the drone
sudo docker exec -it [container] bash
rostopic echo /ardrone/navdata
ROS2 Setup
Installing ROS2
Ros eloquent follow the instructions from this page:https://index.ros.org/doc/ros2/Installation/Eloquent/Linux-Install-Debians/
Do not forget to source your ros version after opening a new terminal (or place it in the bashrc file for automatic sourcing):
source /opt/ros/eloquent/setup.bash
Download the ar_monitor prebuilt package:
You can download our binary package from Bitbucket repo:
For ros eloquent: ros-eloquent-ar-monitor.deb
Installing the ar_monitor package
Installing the .deb file
Open the Downloads folder in a new terminal install first the dependency for the package and the package itself:
sudo apt-get install ros-eloquent-launch-testing
sudo dpkg -i ros-eloquent-ar-monitor.deb
Run or Launching the ros node:
Launching the status_server node:
Open a new terminal:
ros2 launch ar_monitor ar_monitor.launch.py
Running the status_server node:
Open a new terminal:
ros2 run ar_monitor status_server.py
Testing on local packages
Open a new terminal:
Run the status_server node
ros2 run ar_monitor status_server.py
2. Calling the service of the node (in a new tab):
ros2 service call /ar_status_service_ros2 ar_monitor/srv/StatusInfo arg:\ \'<package_name>/<launch_file_name>.launch.py\'
For example :
rosservice call /ar_status_service "arg: 'ar_monitor/all.launch'"
Using the ROS2 ar_monitor Package with ROS1 and Android
Create a new ros2 workspace in a terminal:
mkdir eloquent_ws
cd eloquent_ws
mkdir src
colcon build
Cloning the ROS2AR repo and extract the ros part
cd src
git clone -b ROS2AR-28-ROS2-Adapter --single-branch https://bitbucket.org/NGi-Systems/ros2ar.git
cd ros2ar
cp -r ros/ar_monitor/ ..
cd .. && mv ros2ar/ ~/
Clone the ros1_bridge to the created ros2 workspace:
cd ~/eloquent_ws/src
git clone https://github.com/ros2/ros1_bridge.git
cd ..
sudo apt-get install ros-eloquent-launch-testing-ament-cmake
Build the packages:
source /opt/ros/melodic/setup.bash
source /opt/ros/eloquent/setup.bash
colcon build --packages-select ar_monitor
source install/setup.bash
colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure
Running the all necessary nodes for ROS2AR project with ROS2 adaptor:
Open a new terminal and launch the rosbridge websocket for ROS1
source /opt/ros/melodic/setup.bash
roslaunch rosbridge_server rosbridge_websocket.launch
In a new tab
source /opt/ros/melodic/setup.bash
source /opt/ros/eloquent/setup.bash
cd eloquent_ws
source install/setup.bash
ros2 run ar_monitor status_server.py
In a new tab
source /opt/ros/melodic/setup.bash
source /opt/ros/eloquent/setup.bash
source install/setup.bash
ros2 run ros1_bridge dynamic_bridge
In this way you can access the ar_monitor package both from ROS1 in ROS2 and vice-versa.
Running ROS1-ROS2 Docker and the ar_monitor snap package
Installing Docker:
sudo apt-get install docker.io
Pull the docker image:
docker pull ngisystems/ros-melodic-eloquent-ar-monitor
Running the docker container:
sudo docker run -it --network host ngisystems/ros-melodic-eloquent-ar-monitor
Running the image in multiple terminal:
sudo docker exec -it <container_name> bash #for example sudo docker exec -it d3363b5c0bc4 bash
Example of running the nodes in docker
Open a new terminal:
sudo docker run -it --network host ngisystems/ros-melodic-eloquent-ar-monitor
source /opt/ros/melodic/setup.bash
source /opt/ros/eloquent/setup.bash
cd eloquent_ws
source install/setup.bash
ros2 run ar_monitor status_server.py
In a new tab:
sudo docker exec -it [container] bash
source /opt/ros/melodic/setup.bash
roslaunch rosbridge_server rosbridge_websocket.launch
In a tab
sudo docker exec -it [container] bash
source /opt/ros/melodic/setup.bash
source /opt/ros/eloquent/setup.bash
cd eloquent_ws
source install/setup.bash
ros2 run ros1_bridge dynamic_bridge
Installing and running ar_monitor package with snap
Installing the snap command:
sudo apt update
sudo apt install snapd
Downloading and installing the snap file:
Download the snap file from Bitbucket: ros2-ar-monitor.snap
cd Downloads
sudo snap install ros2-ar-monitor.snap --devmode
Running the snap file
ros2-ar-monitor
You might need to run the following variable export in case of complaining against libgtk3:
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0
Acknowledgements
Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components.
More information: ROSIN.
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.