Speed up the ros2 stuff

This commit is contained in:
Alexander Rosenberg 2025-02-11 03:29:15 -08:00
parent b85772067d
commit 4348e98b97
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 17 additions and 3 deletions

View File

@ -260,7 +260,7 @@ source "${ZSH_CONFIG_DIR}/emacs-bookmark.zsh"
# Ros2 instll on arch # Ros2 instll on arch
if [[ -d /opt/ros/humble/ ]]; then if [[ -d /opt/ros/humble/ ]]; then
ZSH_ROS2_ROOT=/opt/ros/humble/ # ZSH_ROS2_ROOT=/opt/ros/humble/
source "${ZSH_CONFIG_DIR}/lazy-ros2.zsh" source "${ZSH_CONFIG_DIR}/lazy-ros2.zsh"
fi fi

View File

@ -1,6 +1,20 @@
# Lazy-load ros2 stuff # Lazy-load ros2 stuff
(( ${+ZSH_ROS2_ROOT} )) || return function __zsh_load_ros2 {
export AMENT_PREFIX_PATH=/opt/ros/humble
export CMAKE_PREFIX_PATH=/opt/ros/humble
export COLCON_PREFIX_PATH=/opt/ros/humble
export ROS_DISTRO=humble
export ROS_LOCALHOST_ONLY=0
export ROS_PYTHON_VERSION=3
export ROS_VERSION=2
export LD_LIBRARY_PATH="/opt/ros/humble/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib:${LD_LIBRARY_PATH}"
export PATH="/opt/ros/humble/bin:${PATH}"
export PKG_CONFIG_PATH="/opt/ros/humble/lib/pkgconfig:${PKG_CONFIG_PATH}"
export PYTHONPATH="/opt/ros/humble/lib/python3.13/dist-packages/:/opt/ros/humble/lib/python3.13/site-packages:${PYTHONPATH}"
}
# (( ${+ZSH_ROS2_ROOT} )) || return
local defined=() local defined=()
@ -23,7 +37,7 @@ for exec in ${defined}; do
printf 'Setting up ros2 with \"%s\"...\n\n' \\ printf 'Setting up ros2 with \"%s\"...\n\n' \\
\"\${(q)ZSH_ROS2_ROOT%/}/setup.zsh\" \"\${(q)ZSH_ROS2_ROOT%/}/setup.zsh\"
unfunction ${undef_args} unfunction ${undef_args}
source \${(q)ZSH_ROS2_ROOT}/setup.zsh || __zsh_load_ros2 ||
{ echo 'Failed to load ros2 libraries!'; return } { echo 'Failed to load ros2 libraries!'; return }
(( \${#} == 0 )) && ${(q)exec} || ${(q)exec} \"\${@}\" (( \${#} == 0 )) && ${(q)exec} || ${(q)exec} \"\${@}\"
}" }"