mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
change how to get ros2 version
This commit is contained in:
@@ -264,18 +264,15 @@ fastrtps_version = subprocess.check_output(
|
|||||||
"ldconfig -v | grep libfastrtps", shell=True).decode("utf-8").strip().split('so.')[-1]
|
"ldconfig -v | grep libfastrtps", shell=True).decode("utf-8").strip().split('so.')[-1]
|
||||||
|
|
||||||
# get ROS 2 version, if exists
|
# get ROS 2 version, if exists
|
||||||
ros2_distro = ""
|
ros2_distro = ''
|
||||||
try:
|
ros_version = os.environ.get('ROS_VERSION')
|
||||||
rosversion_out = subprocess.check_output(["rosversion", "-d"])
|
if ros_version == '2' :
|
||||||
rosversion_out = rosversion_out.rstrip().decode('utf-8')
|
if args.ros2_distro != '':
|
||||||
if rosversion_out not in ["<unknown>", "kinetic", "lunar", "melodic"]:
|
ros2_distro = args.ros2_distro
|
||||||
ros2_distro = rosversion_out
|
else :
|
||||||
except OSError as e:
|
ros2_distro = os.environ.get('ROS_DISTRO')
|
||||||
if e.errno == errno.ENOENT:
|
else :
|
||||||
if args.ros2_distro != None:
|
raise ValueError
|
||||||
ros2_distro = args.ros2_distro
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
# If nothing specified it's generated both
|
# If nothing specified it's generated both
|
||||||
if agent == False and client == False:
|
if agent == False and client == False:
|
||||||
|
|||||||
Reference in New Issue
Block a user