#!/usr/bin/env bash # 构建真机用的 Flexiv 硬件包(前提:RDK 已装到 ~/flexiv_install) set -eo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT" if [[ -f "${HOME}/anaconda3/etc/profile.d/conda.sh" ]]; then # shellcheck disable=SC1091 source "${HOME}/anaconda3/etc/profile.d/conda.sh" elif [[ -f "${HOME}/miniconda3/etc/profile.d/conda.sh" ]]; then # shellcheck disable=SC1091 source "${HOME}/miniconda3/etc/profile.d/conda.sh" set +u conda activate ros_flexiv 2>/dev/null || true set -u 2>/dev/null || true fi if [[ -z "${ROS_DISTRO:-}" ]]; then # shellcheck disable=SC1091 source /opt/ros/humble/setup.bash 2>/dev/null || source /opt/ros/jazzy/setup.bash 2>/dev/null || true fi PREFIX="${HOME}/flexiv_install" CMAKE_PREFIX="${PREFIX}" if [[ -n "${CONDA_PREFIX:-}" ]]; then CMAKE_PREFIX="${PREFIX};${CONDA_PREFIX}" fi export CXXFLAGS="${CXXFLAGS:-} -include cstdint -Wno-template-body" colcon build --symlink-install --packages-select \ flexiv_hardware \ flexiv_msgs \ flexiv_gripper \ flexiv_test_nodes \ flexiv_robot_states_broadcaster \ flexiv_bringup \ --cmake-args "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX}" "$@" echo "Real stack build done. source ${ROOT}/scripts/env.sh"