Refactor from my_robot to raspbot-v2

This commit is contained in:
2026-04-16 22:08:52 +00:00
parent 6af4ba10bf
commit 2fcf8ce26b
10 changed files with 21 additions and 21 deletions
+3 -3
View File
@@ -12,10 +12,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
WORKDIR /ws WORKDIR /ws
# Copy the ROS package into the standard colcon src/ layout and build it # Copy the ROS package into the standard colcon src/ layout and build it
COPY src/my_robot/ src/my_robot/ COPY src/raspbot_v2/ src/raspbot_v2/
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \ RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --packages-select my_robot colcon build --packages-select raspbot_v2
# ── Stage 2: runtime ────────────────────────────────────────────────────────── # ── Stage 2: runtime ──────────────────────────────────────────────────────────
FROM ros:kilted-ros-core FROM ros:kilted-ros-core
@@ -43,4 +43,4 @@ COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"] ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["ros2", "launch", "my_robot", "robot.launch.py"] CMD ["ros2", "launch", "raspbot_v2", "robot.launch.py"]
+8 -8
View File
@@ -1,4 +1,4 @@
# my_robot # raspbot_v2
ROS 2 package for the Yahboom Raspbot V2 platform — differential-drive motor control and pan/tilt camera orientation. ROS 2 package for the Yahboom Raspbot V2 platform — differential-drive motor control and pan/tilt camera orientation.
@@ -139,7 +139,7 @@ The [ansible/](ansible/) directory contains a playbook that handles the remainin
The Raspberry Pi is `arm64`, so the image must be built for that platform. On an amd64 host use `docker buildx`: The Raspberry Pi is `arm64`, so the image must be built for that platform. On an amd64 host use `docker buildx`:
```bash ```bash
docker build --platform linux/arm64 -t my_robot:latest . docker build --platform linux/arm64 -t raspbot_v2:latest .
``` ```
`--load` exports the built image into the local Docker image store so it can be deployed with `docker save`. `--load` exports the built image into the local Docker image store so it can be deployed with `docker save`.
@@ -156,7 +156,7 @@ The build is split into two stages:
Once the image is built, pipe it directly to the target over SSH — no intermediate file or registry needed: Once the image is built, pipe it directly to the target over SSH — no intermediate file or registry needed:
```bash ```bash
docker save my_robot:latest | ssh matt@raspbot-v2.local docker load docker save raspbot_v2:latest | ssh matt@raspbot-v2.local docker load
``` ```
Replace `matt` with the username configured in [ansible/inventory.ini](ansible/inventory.ini). Replace `matt` with the username configured in [ansible/inventory.ini](ansible/inventory.ini).
@@ -172,7 +172,7 @@ docker run --rm \
--network=host \ --network=host \
--device /dev/i2c-1 \ --device /dev/i2c-1 \
--env ROS_DOMAIN_ID=0 \ --env ROS_DOMAIN_ID=0 \
my_robot:latest raspbot_v2:latest
``` ```
If your board exposes the controller on a different bus (check with `ls /dev/i2c-*` on the host), substitute the correct device node (e.g. `--device /dev/i2c-0`). If your board exposes the controller on a different bus (check with `ls /dev/i2c-*` on the host), substitute the correct device node (e.g. `--device /dev/i2c-0`).
@@ -186,8 +186,8 @@ docker run --rm \
--network=host \ --network=host \
--device /dev/i2c-1 \ --device /dev/i2c-1 \
--env ROS_DOMAIN_ID=0 \ --env ROS_DOMAIN_ID=0 \
my_robot:latest \ raspbot_v2:latest \
ros2 launch my_robot robot.launch.py \ ros2 launch raspbot_v2 robot.launch.py \
wheel_base:=0.25 max_speed:=0.8 tilt_center_deg:=45.0 wheel_base:=0.25 max_speed:=0.8 tilt_center_deg:=45.0
``` ```
@@ -254,12 +254,12 @@ ros2 topic echo /joint_states
├── Dockerfile # Two-stage production image ├── Dockerfile # Two-stage production image
├── docker-entrypoint.sh # Sources ROS overlays before exec ├── docker-entrypoint.sh # Sources ROS overlays before exec
├── src/ ├── src/
│ └── my_robot/ │ └── raspbot_v2/
│ ├── package.xml # ROS package manifest │ ├── package.xml # ROS package manifest
│ ├── setup.py # ament_python build definition │ ├── setup.py # ament_python build definition
│ ├── launch/ │ ├── launch/
│ │ └── robot.launch.py # Starts both nodes together │ │ └── robot.launch.py # Starts both nodes together
│ └── my_robot/ │ └── raspbot_v2/
│ ├── __init__.py │ ├── __init__.py
│ ├── motor_controller_node.py # Differential-drive motor control │ ├── motor_controller_node.py # Differential-drive motor control
│ └── camera_orientation_node.py # Pan/tilt servo control │ └── camera_orientation_node.py # Pan/tilt servo control
@@ -21,7 +21,7 @@ def generate_launch_description():
# ── Nodes ───────────────────────────────────────────────────────── # ── Nodes ─────────────────────────────────────────────────────────
Node( Node(
package='my_robot', package='raspbot_v2',
executable='motor_controller', executable='motor_controller',
name='motor_controller', name='motor_controller',
parameters=[{ parameters=[{
@@ -32,7 +32,7 @@ def generate_launch_description():
), ),
Node( Node(
package='my_robot', package='raspbot_v2',
executable='camera_orientation', executable='camera_orientation',
name='camera_orientation', name='camera_orientation',
parameters=[{ parameters=[{
@@ -1,8 +1,8 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<package format="3"> <package format="3">
<name>my_robot</name> <name>raspbot_v2</name>
<version>0.0.1</version> <version>0.0.1</version>
<description>Four-wheel robot motor controller</description> <description>Yahboom Raspbot V2 motor and camera orientation controller</description>
<maintainer email="you@example.com">Your Name</maintainer> <maintainer email="you@example.com">Your Name</maintainer>
<license>Apache-2.0</license> <license>Apache-2.0</license>
@@ -1,5 +1,5 @@
[metadata] [metadata]
name = my_robot name = raspbot_v2
version = 0.0.1 version = 0.0.1
[options] [options]
@@ -8,6 +8,6 @@ install_requires =
setuptools setuptools
[develop] [develop]
script_dir=$base/lib/my_robot script_dir=$base/lib/raspbot_v2
[install] [install]
install_scripts=$base/lib/my_robot install_scripts=$base/lib/raspbot_v2
@@ -1,6 +1,6 @@
from setuptools import setup from setuptools import setup
package_name = 'my_robot' package_name = 'raspbot_v2'
setup( setup(
name=package_name, name=package_name,
@@ -15,8 +15,8 @@ setup(
zip_safe=True, zip_safe=True,
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [
'motor_controller = my_robot.motor_controller_node:main', 'motor_controller = raspbot_v2.motor_controller_node:main',
'camera_orientation = my_robot.camera_orientation_node:main', 'camera_orientation = raspbot_v2.camera_orientation_node:main',
], ],
}, },
) )