Files
pnkx_nav_core/setup_catkin_workspace.sh
duongtd d40051df27 pnkx_nav_core 1.0 — every package is a submodule at its own pinned commit
A single commit on an orphan branch, so this is the whole tree as it should
land on a robot, with no history from the branch it grew out of.

Every package is now a git submodule - 26 of them, 15 registered here for the
first time. They were sitting in the tree as plain clones, which looks right
locally and is empty on the robot: a clone of this repository would have
carried the directory names and none of the contents. That failure reports
itself as "works on my machine, not on the robot", and it is the reason this
conversion happened at all.

Newly registered:

  src/Navigations/Packages/move_base2
  src/Algorithms/Packages/actions/dock_pattern_action
  src/Algorithms/Packages/global_planners/sbpl_lattice_planner
  src/Algorithms/Packages/local_planners/{hybrid,mppi,priest}_local_planner
  src/Libraries/{action_core,angles,depth_image_proc,dock_pattern_detector}
  src/Libraries/{mission_adapters,recovery_core,robot_line_extraction}
  src/Libraries/{robot_sensor_ports,sbpl}

.gitignore had a rule - **/[Pp]ackages/* - that hid move_base2 and
dock_pattern_action from git status entirely, so they would have been left out
without anything being said. The exception is written for those two paths only
rather than by loosening the rule.

Every submodule points at the tip of the branch it was already pinned to, not
blindly at main. costmap_2d stays on dev_cam_intel; that branch exists for a
reason, and this tree carries field calibration that does not belong to main.
The other 25 are at the tip of main.

config/ is flattened into config/runtime/, matching the layout the nav core
reads. The .zip snapshots of old package states are gone - they were manual
backups, not build inputs.
2026-08-27 10:09:25 +07:00

117 lines
3.2 KiB
Bash
Executable File

#!/bin/bash
# ========================================================
# Script to setup Catkin workspace for pnkx_nav_core
# ========================================================
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORKSPACE_NAME="pnkx_nav_catkin_ws"
WORKSPACE_DIR="${SCRIPT_DIR}/../${WORKSPACE_NAME}"
echo "=========================================="
echo "Setting up Catkin workspace for pnkx_nav_core"
echo "=========================================="
echo ""
# Create workspace directory
echo "Creating workspace directory: ${WORKSPACE_DIR}"
mkdir -p "${WORKSPACE_DIR}/src"
# Check if src directory already has packages
if [ -d "${WORKSPACE_DIR}/src" ] && [ "$(ls -A ${WORKSPACE_DIR}/src 2>/dev/null)" ]; then
echo "Warning: ${WORKSPACE_DIR}/src already contains packages"
read -p "Do you want to continue? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 1
fi
fi
# Create symlinks to packages that have package.xml
echo ""
echo "Creating symlinks to packages with package.xml..."
# Find all packages with package.xml in the source tree
PACKAGES=(
"src/Libraries/tf3"
"src/Libraries/robot_nav_2d_utils"
"src/Navigations/Libraries/nav_grid"
"src/Navigations/Cores/nav_core"
"src/Navigations/Cores/nav_core2"
"src/Navigations/Cores/nav_core_adapter"
"src/Navigations/Cores/move_base_core"
"src/Navigations/Cores/nav_core_adapter"
"src/Packages/move_base"
"src/Navigations/Packages/move_base"
)
for PKG_PATH in "${PACKAGES[@]}"; do
FULL_PATH="${SCRIPT_DIR}/${PKG_PATH}"
if [ -f "${FULL_PATH}/package.xml" ]; then
PKG_NAME=$(basename "${PKG_PATH}")
TARGET="${WORKSPACE_DIR}/src/${PKG_NAME}"
if [ -e "${TARGET}" ]; then
echo " Warning: ${TARGET} already exists, skipping..."
else
echo " Linking: ${PKG_NAME} -> ${PKG_PATH}"
ln -s "${FULL_PATH}" "${TARGET}"
fi
else
echo " Warning: ${PKG_PATH}/package.xml not found, skipping..."
fi
done
# Create a README in the workspace
cat > "${WORKSPACE_DIR}/README.md" << EOF
# Catkin Workspace for pnkx_nav_core
This is a Catkin workspace containing ROS-compatible packages from pnkx_nav_core.
## Structure
\`\`\`
${WORKSPACE_NAME}/
├── src/ # Source packages (symlinked from pnkx_nav_core)
└── build/ # Build directory (created by catkin_make)
\`\`\`
## Building
\`\`\`bash
cd ${WORKSPACE_DIR}
catkin_make
\`\`\`
## Source the workspace
After building, source the setup file:
\`\`\`bash
source devel/setup.bash
\`\`\`
## Note
Packages in \`src/\` are symlinked from the main pnkx_nav_core project.
To add more packages, create symlinks in \`src/\` pointing to packages
that have both \`CMakeLists.txt\` and \`package.xml\`.
EOF
echo ""
echo "=========================================="
echo "Workspace setup complete!"
echo "=========================================="
echo ""
echo "Next steps:"
echo " 1. cd ${WORKSPACE_DIR}"
echo " 2. catkin_make"
echo " 3. source devel/setup.bash"
echo ""
echo "Note: Make sure all dependencies are built in the main project first"
echo " using standalone CMake before building with catkin."
echo ""