generated from robmasocco/vscode_ros2_workspace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathros2.sh
59 lines (49 loc) · 1.75 KB
/
ros2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
# Shell functions and commands for ROS 2 management.
#
# Roberto Masocco <robmasocco@gmail.com>
# Intelligent Systems Lab <isl.torvergata@gmail.com>
#
# April 4, 2023
# shellcheck disable=SC1090
# Initialize ROS 2 environment according to the Zsh shell.
ros2init() {
if [[ $# -ne 0 ]]; then
export ROS_DOMAIN_ID=$1
fi
export ROS_VERSION=2
export ROS_PYTHON_VERSION=3
export ROS_DISTRO=humble
# Check that the ROS 2 installation is present, and source it
if [[ -f /opt/ros/$ROS_DISTRO/setup.zsh ]]; then
source /opt/ros/$ROS_DISTRO/setup.zsh
elif [[ -f /opt/ros/$ROS_DISTRO/install/setup.zsh ]]; then
source /opt/ros/$ROS_DISTRO/install/setup.zsh
else
echo >&2 "ROS 2 installation not found."
return 1
fi
# Source additional stuff for colcon argcomplete
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.zsh
# Source Ignition Gazebo stuff
if [[ -f /opt/gazebo/fortress/install/setup.zsh ]]; then
source /opt/gazebo/fortress/install/setup.zsh
fi
if [[ -f /opt/ros/ros_gz/install/local_setup.zsh ]]; then
source /opt/ros/ros_gz/install/local_setup.zsh
fi
# Source our fork of rmw_fastrtps
if [[ -f /opt/ros/rmw_fastrtps/install/local_setup.zsh ]]; then
source /opt/ros/rmw_fastrtps/install/local_setup.zsh
fi
# Source additional DUA stuff
if [[ -f /opt/ros/dua-utils/install/local_setup.zsh ]]; then
source /opt/ros/dua-utils/install/local_setup.zsh
fi
# Source workspace if present
if [[ -f /home/neo/workspace/install/local_setup.zsh ]]; then
source /home/neo/workspace/install/local_setup.zsh
fi
}
# Alias for Gazebo Classic that includes environment variables for HiDPI
alias gazebo='QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCREEN_SCALE_FACTORS=[1.0] /usr/bin/gazebo'