Browse Source

generate_microRTPS_bridge: make sure that the ROS2 version of FastRTPS is grabbed in a colcon build

sbg
TSC21 5 years ago committed by Nuno Marques
parent
commit
acc3866ac9
  1. 16
      msg/tools/generate_microRTPS_bridge.py

16
msg/tools/generate_microRTPS_bridge.py

@ -47,6 +47,7 @@ from uorb_rtps_classifier import Classifier @@ -47,6 +47,7 @@ from uorb_rtps_classifier import Classifier
import subprocess
import glob
import errno
import re
try:
from six.moves import input
@ -259,9 +260,6 @@ else: @@ -259,9 +260,6 @@ else:
raise Exception(
"FastRTPSGen not found. Specify the location of fastrtpsgen with the -f flag")
# get FastRTPS version
fastrtps_version = subprocess.check_output(
"ldconfig -v 2>/dev/null | grep libfastrtps", shell=True).decode("utf-8").strip().split('so.')[-1]
# get ROS 2 version, if exists
ros2_distro = ''
@ -272,6 +270,18 @@ if ros_version == '2' : @@ -272,6 +270,18 @@ if ros_version == '2' :
else :
ros2_distro = os.environ.get('ROS_DISTRO')
# get FastRTPS version
fastrtps_version = ''
if not ros2_distro:
# grab the version installed system wise
fastrtps_version = subprocess.check_output(
"ldconfig -v 2>/dev/null | grep libfastrtps", shell=True).decode("utf-8").strip().split('so.')[-1]
else:
# grab the version of the ros-<ros_distro>-fastrtps package
fastrtps_version = re.search(r'Version:\s*([\dd.]+)', subprocess.check_output(
"dpkg -s ros-" + ros2_distro + "-fastrtps 2>/dev/null | grep -i version", shell=True).decode("utf-8").strip()).group(1)
# If nothing specified it's generated both
if agent == False and client == False:
agent = True

Loading…
Cancel
Save