First run on target hardware
The robot rotated with the ros2 topic pub command in the readme
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.8)
|
|
||||||
project(my_robot)
|
|
||||||
|
|
||||||
find_package(ament_cmake REQUIRED)
|
|
||||||
find_package(ament_cmake_python REQUIRED)
|
|
||||||
|
|
||||||
ament_python_install_package(${PROJECT_NAME})
|
|
||||||
|
|
||||||
ament_package()
|
|
||||||
+9
-13
@@ -3,25 +3,18 @@
|
|||||||
# ── Stage 1: build ────────────────────────────────────────────────────────────
|
# ── Stage 1: build ────────────────────────────────────────────────────────────
|
||||||
FROM ros:kilted AS builder
|
FROM ros:kilted AS builder
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
python3-colcon-common-extensions \
|
python3-colcon-common-extensions \
|
||||||
python3-pip \
|
|
||||||
ros-${ROS_DISTRO}-ament-cmake-python \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /ws
|
WORKDIR /ws
|
||||||
|
|
||||||
# Install the vendored Raspbot hardware library
|
|
||||||
COPY raspbot_v2_interface/ raspbot_v2_interface/
|
|
||||||
# PEP 668: newer Debian/Ubuntu marks the system Python as externally managed and blocks pip
|
|
||||||
# by default. --break-system-packages overrides this; safe here as the container is isolated.
|
|
||||||
RUN pip3 install --no-cache-dir --break-system-packages ./raspbot_v2_interface
|
|
||||||
|
|
||||||
# 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 package.xml setup.py setup.cfg CMakeLists.txt src/my_robot/
|
COPY src/my_robot/ src/my_robot/
|
||||||
COPY my_robot/ src/my_robot/my_robot/
|
|
||||||
|
|
||||||
RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \
|
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
|
||||||
colcon build --packages-select my_robot
|
colcon build --packages-select my_robot
|
||||||
|
|
||||||
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
|
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
|
||||||
@@ -31,10 +24,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
ros-${ROS_DISTRO}-rclpy \
|
ros-${ROS_DISTRO}-rclpy \
|
||||||
ros-${ROS_DISTRO}-geometry-msgs \
|
ros-${ROS_DISTRO}-geometry-msgs \
|
||||||
ros-${ROS_DISTRO}-std-msgs \
|
ros-${ROS_DISTRO}-std-msgs \
|
||||||
|
python3-smbus \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Bring across the installed Raspbot library and the built ROS overlay
|
# Install the Raspbot hardware library directly into site-packages
|
||||||
COPY --from=builder /usr/local/lib /usr/local/lib
|
COPY raspbot_v2_interface/ /usr/local/lib/python3.12/dist-packages/raspbot_v2_interface/
|
||||||
|
|
||||||
|
# Bring across the built ROS overlay
|
||||||
COPY --from=builder /ws/install /ws/install
|
COPY --from=builder /ws/install /ws/install
|
||||||
|
|
||||||
# Source both ROS base and the workspace overlay on every shell/exec
|
# Source both ROS base and the workspace overlay on every shell/exec
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
import rclpy
|
import rclpy
|
||||||
from rclpy.node import Node
|
from rclpy.node import Node
|
||||||
from geometry_msgs.msg import Twist
|
from geometry_msgs.msg import Twist
|
||||||
@@ -10,8 +10,11 @@
|
|||||||
<exec_depend>geometry_msgs</exec_depend>
|
<exec_depend>geometry_msgs</exec_depend>
|
||||||
<exec_depend>std_msgs</exec_depend>
|
<exec_depend>std_msgs</exec_depend>
|
||||||
|
|
||||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
<buildtool_depend>ament_python</buildtool_depend>
|
||||||
<buildtool_depend>ament_cmake_python</buildtool_depend>
|
|
||||||
|
<export>
|
||||||
|
<build_type>ament_python</build_type>
|
||||||
|
</export>
|
||||||
<test_depend>ament_copyright</test_depend>
|
<test_depend>ament_copyright</test_depend>
|
||||||
<test_depend>ament_flake8</test_depend>
|
<test_depend>ament_flake8</test_depend>
|
||||||
<test_depend>ament_pep257</test_depend>
|
<test_depend>ament_pep257</test_depend>
|
||||||
@@ -6,6 +6,10 @@ setup(
|
|||||||
name=package_name,
|
name=package_name,
|
||||||
version='0.0.1',
|
version='0.0.1',
|
||||||
packages=[package_name],
|
packages=[package_name],
|
||||||
|
data_files=[
|
||||||
|
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
|
||||||
|
('share/' + package_name, ['package.xml']),
|
||||||
|
],
|
||||||
install_requires=['setuptools'],
|
install_requires=['setuptools'],
|
||||||
zip_safe=True,
|
zip_safe=True,
|
||||||
entry_points={
|
entry_points={
|
||||||
Reference in New Issue
Block a user