Files
agv_pro_ros2/TODO.md
T

118 lines
7.9 KiB
Markdown

# TODO
## ROS 2 Lyrical migration (`lyrical` branch)
Everything except the lidar stack has been moved to build against `ros:lyrical`
(Dockerfile, `upstream.lyrical.repos`, `rosdep-packages.txt`). The following upstream
packages are temporarily excluded from the colcon build via a `COLCON_IGNORE` marker
(captured in their respective `patches/*.patch` so it survives a fresh `vcs import`),
pending a dedicated pass to get them building under Lyrical:
- ~~`FAST_LIO` (`patches/fast_lio.patch`)~~ re-enabled, builds clean under lyrical
(`ament_target_dependencies()` guarded with `if(COMMAND ...)` + modern namespaced
targets; `tf2_ros/transform_broadcaster.h` → `.hpp`; added missing `tf2_ros` depend;
dropped unused `pcl_ros`/`rclcpp_components` link targets which don't export a
simple umbrella target under lyrical).
- ~~`livox_ros_driver2` (`patches/livox_ros_driver2.patch`)~~ re-enabled, builds clean
under lyrical (extended its existing `DISTRO_ROS STREQUAL "humble" OR "jazzy"`
modern-rosidl-typesupport guard to also match `"lyrical"`).
- ~~`livox_sdk` (`patches/livox_sdk.patch`)~~ re-enabled, builds clean under lyrical
(needed `cmake_minimum_required` bumped from 3.0 to 3.5 in several sub-CMakeLists —
CMake 4.2 fully removed compatibility with versions below 3.5).
- ~~`Lslidar_ROS2_driver` (`patches/lslidar_ros2_driver.patch`, new)~~ re-enabled,
builds clean under lyrical (`ament_target_dependencies` guarded with
`if(COMMAND...)` + modern namespaced targets in both the `lslidar_driver`
library and `lslidar_driver_node` executable; also needed `libpcap0.8-dev`
installed -- the package.xml's `libpcap` rosdep key resolves to it, but it
wasn't in `rosdep-packages.txt` yet since this package was previously
COLCON_IGNORE'd when that file was last frozen).
- ~~`point_lio_ros2` (`patches/point_lio_ros2.patch`, new)~~ re-enabled, builds clean
under lyrical (same `ament_target_dependencies`/modern-target-link pattern as
`FAST_LIO`; `tf2_ros/transform_broadcaster.h` \u2192 `.hpp` in 3 files; plus a new
fix not needed by `FAST_LIO`: added an explicit `find_package(PCL REQUIRED
COMPONENTS common io filters)` + `target_link_libraries(${PCL_LIBRARIES})`,
since this package never had its own PCL linkage and relied on legacy
`ament_target_dependencies` transitively pulling it in via `pcl_conversions`).
- ~~`unilidar_sdk2` (`patches/unilidar_sdk2.patch`)~~ re-enabled, builds clean under
lyrical (`unitree_lidar_ros2`'s `ament_target_dependencies` guarded with
`if(COMMAND...)` + modern namespaced targets; `unitree_lidar_sdk` only exports
legacy `ament_export_libraries()`/`ament_export_include_directories()` variables
(no namespaced target), so it's linked via explicit `${unitree_lidar_sdk_LIBRARIES}`/
`${unitree_lidar_sdk_INCLUDE_DIRS}`; `tf2_ros/transform_broadcaster.h` → `.hpp` and
`tf2/LinearMath/Quaternion.h` → `.hpp` in `unitree_lidar_ros2.h`). All 6 lidar
packages are now re-enabled and the full workspace builds clean (31/31 packages).
`agv_pro_bringup`'s `exec_depend` on `livox_ros_driver2`/`lslidar_driver` is left as-is —
rosdep's `--ignore-src` treats those as satisfied by the (ignored) local source packages,
so this doesn't block `rosdep install`. The `wheel_interface`/lidar-dependent launch
options simply won't have a built executable until the lidar packages are revisited.
`agv_pro_base` hard-depends on `serial_driver`/`io_context` (from the
`ros-drivers/transport_drivers` repo) at build time, but `ros-lyrical-serial-driver`/
`ros-lyrical-io-context` aren't published as apt packages yet (confirmed via
`apt-cache policy` in a real `ros:lyrical` container — index.ros.org lists them as
"released" for lyrical, but the actual .debs haven't synced to the mirror). Worked
around by vendoring `ros-drivers/transport_drivers` from source in
`upstream.lyrical.repos` instead of relying on the apt packages. It also needed a
CMake fix (`patches/transport_drivers.patch`): `ament_target_dependencies()` has been
removed entirely from Lyrical's `ament_cmake`, so the `ASIO` linkage (a non-ROS
dependency resolved via an old-style `Find<Pkg>.cmake` module, no modern imported
target) had to be replaced with manual `target_include_directories`/
`target_compile_definitions` using `${ASIO_INCLUDE_DIRS}`/`${ASIO_DEFINITIONS}`, and
the package's own test targets switched to linking modern namespaced targets
(`rclcpp::rclcpp`, `std_msgs::std_msgs__rosidl_typesupport_cpp`, etc.).
- [ ] Once `ros-lyrical-serial-driver`/`ros-lyrical-io-context` are actually published,
consider dropping the vendored `transport_drivers` in favor of the apt packages
again (re-run `./scripts/freeze-rosdep.sh` to confirm).
`ros-lyrical-cartographer-ros` (used by `agv_pro_bringup`) and `ros-lyrical-orbbec-camera`
(used by `agv_pro_slam`) are likewise not yet published as apt packages for lyrical. Both
are `exec_depend`-only (not needed to build), so they were simply removed from
`rosdep-packages.txt` — same treatment as the lidar exec_depends. The corresponding
launch options (cartographer-based mapping, Orbbec RGBD input) won't have a runnable
package installed in the image until these are published upstream.
- [ ] Re-add `ros-lyrical-cartographer-ros`/`ros-lyrical-orbbec-camera` to
`rosdep-packages.txt` once they're actually installable via apt.
Need to patch src/upstream/slam_gmapping/include/slam_gmapping/slam_gmapping.h
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
## CAN wheel control (agv_pro_can service / wheel_interface:=can)
Switched from an unverified CANopen approach (`agv_pro_canopen_config`/`ros2_canopen`,
now removed) to the RobStride private protocol via the community `robstride_ros2`
package, after empirically confirming real CAN communication with the wheel drives
(RobStride RS01 motors, CAN IDs 1-4, direction-confirmed via `candump -x`; see
`/memories/repo/agv_can_serial_hw_notes.md`). Remaining before this is production-ready:
- [x] Determine which physical wheel corner each CAN ID (1-4) actually drives — VERIFIED
by rotating each wheel in turn and watching `scripts/hw_debug/robstride_rotation_watch.py`:
1=front_left, 2=front_right, 3=rear_left, 4=rear_right (matches the xacro default).
- [x] Confirm per-wheel `direction` (sign) — all 4 wheels rotated the same physical
"forward" way; raw mechpos was negative for left-side motors (1,3) and positive for
right-side motors (2,4), consistent with mirrored motor mounting. Set `direction=-1`
for IDs 1/3 and `direction=1` for IDs 2/4 in the xacro. LIVE-VALIDATED by
`scripts/hw_debug/robstride_spin_test.py`: commanded all 4 motors forward at
2 rad/s for 4s using this sign convention and all 4 wheels visually spun forward
together (user-confirmed). Note: this validated the raw protocol-level sign
convention via a standalone script bypassing `ros2_control`; the `robstride_ros2`
driver's own `direction` xacro param still needs a real `ros2_control` build/test
to confirm it applies the same convention end-to-end.
- [ ] Determine real `gear_ratio` (currently 1.0 placeholder) from the drivetrain so
commanded/measured velocity is in correct SI units at the wheel.
- [ ] Tune `kp`/`kd` velocity-mode gains (currently placeholder `kp=0.0 kd=0.8`) for the
real mecanum drivetrain.
- [ ] Confirm `can_timeout_ticks` (currently the package default, 4000 ticks = 200 ms) is an
appropriate watchdog window for this platform.
- [ ] Build-test: `colcon build` will build `robstride_ros2` and `ros2_socketcan` from
source per `upstream.lyrical.repos` — not yet exercised in this workspace.
- [ ] End-to-end test: confirm `ros2 launch agv_pro_bringup agv_pro_bringup.launch.py
wheel_interface:=can` actually drives all four wheels through the full
`ros2_control`/`mecanum_drive_controller` stack (only ad-hoc Python/CAN scripts have
been validated against the hardware so far, not the ROS2 stack itself).