Created
July 23, 2024 18:07
-
-
Save aharshac/b07929459d00935bf6b0259144202e58 to your computer and use it in GitHub Desktop.
ROS2 source environment with DDS switcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| use_fastdds=1 | |
| source /opt/ros/humble/setup.bash | |
| source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash | |
| ws_setup=/home/XXX/ros2_ws/install/setup.bash | |
| if [ -f $ws_setup ] | |
| then | |
| source $ws_setup | |
| else | |
| local_setup_done="\n\033[93mWorkspace setup not sourced\033[0m" | |
| fi | |
| export ROS_DOMAIN_ID=0 | |
| unset RMW_IMPLEMENTATION | |
| unset ROS_SUPER_CLIENT=True | |
| unset ROS_DISCOVERY_SERVER | |
| unset CYCLONEDDS_URI | |
| dds_impl= | |
| if [ -n "${use_fastdds}" ] && [ 1 == "$use_fastdds" ] | |
| then | |
| export RMW_IMPLEMENTATION=rmw_fastrtps_cpp | |
| #[ -t 0 ] && export ROS_SUPER_CLIENT=True || export ROS_SUPER_CLIENT=False | |
| export ROS_SUPER_CLIENT=True | |
| export ROS_DISCOVERY_SERVER="127.0.0.1:11811;" | |
| export FASTRTPS_DEFAULT_PROFILES_FILE=/home/XXX/ros2_ws/ros_config/fastdds_super_client.xml | |
| dds_impl="FastDDS" | |
| else | |
| export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp | |
| export CYCLONEDDS_URI=/home/XXX/ros2_ws/ros_config/cyclonedds_pc.xml | |
| dds_impl="CycloneDDS" | |
| fi | |
| export IGNITION_VERSION=fortress | |
| export WEBOTS_HOME=/usr/local/webots | |
| echo -e "Loaded ROS2 Environment with \033[1m\033[92m${dds_impl}\033[0m${local_setup_done}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment