pnkx_nav_core 1.0 — every package with a remote is a submodule, and the root CMake builds them

A single commit on an orphan branch: the whole tree as it should land on a
robot, with no history from the branch it grew out of.

The rule applied: a package that has its own remote becomes a submodule; a
package that only ever lived inside this repository stays as ordinary files.
That comes to 29 submodules, 18 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.

.gitignore is fixed at the source rather than patched per path. The rule
**/[Pp]ackages/* comes from the Visual Studio template and targets NuGet's
generated packages/ folder; here Packages/ is a SOURCE directory, so it hid
whole packages from git status - and a missing package then becomes invisible
to exactly the command you would use to look for one. It cost move_base2,
dock_pattern_action and sbpl_recovery, and sbpl_recovery surfaced only by
walking the tree for .git directories and diffing against .gitmodules. The
exception now re-includes src/*/Packages/** wholesale, placed immediately after
the NuGet rule so the build-artifact rules further down still win. Listing
paths one by one is what let one slip in the first place.

The root CMakeLists.txt described a tree that no longer exists. Its second half
was a migration shim that looked for a sibling Test/ directory from AMR_T800 and
added packages out of it; PNKX_NAV_CORE_BUILD_TEST_PACKAGES defaults to ON, so
with the migration finished it would have hit FATAL_ERROR at configure time.
That is gone, and the 18 packages are added in dependency order at their real
in-tree paths.

Two guard names are traps worth naming, because a guard that never matches adds
the subdirectory twice on a re-entrant configure:
  - src/Libraries/angles is project robot_angles_prv, and a DIFFERENT package
    called angles lives at src/Algorithms/Libraries/angles. Both are in the
    tree; guarding on `angles` would silently skip the first.
  - dock_pattern_action's library target is dock_pattern_action_handler, and
    move_base2's is move_base2_core.

sbpl_recovery and dock_pattern_action call find_package(catkin REQUIRED) at top
level with no standalone branch, so they sit behind
PNKX_NAV_CORE_BUILD_CATKIN_ONLY_PACKAGES, OFF, with a message naming why. They
still build under catkin_make, which does not go through this file. Pulling
them into the standalone graph fails with "Could not find recovery_core", which
misleads: recovery_core IS in the tree and was added above, but the catkin
branch wants a recovery_coreConfig.cmake that a standalone build never
produces.

grid_map_core and image_geometry were added because hybrid_local_planner and
depth_image_proc link robot_grid_map_core and robot_image_geometry, and neither
was in the tree - found by scanning every CMakeLists for internal library names
and diffing against the targets the tree defines, then confirmed by the build.

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 on main.

config/ is flattened into config/runtime/, matching the layout the nav core
reads. The .zip snapshots of old package states are gone - manual backups, not
build inputs.

Verified: cmake configure returns 0 and a full build returns 0, producing 46
shared libraries.
This commit is contained in:
2026-08-27 10:09:25 +07:00
commit 70caf52530
486 changed files with 72704 additions and 0 deletions

116
setup_catkin_workspace.sh Executable file
View File

@@ -0,0 +1,116 @@
#!/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 ""