Skip to content

Commit

Permalink
Robot PY Library (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
Serafadam authored Dec 22, 2023
1 parent b428824 commit 3fc9138
Show file tree
Hide file tree
Showing 84 changed files with 1,904 additions and 151 deletions.
52 changes: 17 additions & 35 deletions .github/workflows/main.workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ on:
workflow_dispatch:
push:
branches:
- '*'
- humble
pull_request:
branches:
- humble
env:
ROS_DISTRO: humble

Expand All @@ -15,8 +18,11 @@ jobs:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
permissions:
contents: read
packages: write
env:
PUSH: ${{ (github.repository == 'luxonis/rae-ros') }}
PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'luxonis/rae-ros') && startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -27,43 +33,16 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v1
if: env.PUSH == 'true'
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Version
if: env.PUSH == 'true'
id: vars
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}

- name: Build Sim
uses: docker/build-push-action@v3
if: env.PUSH == 'false'
with:
build-args: |
ROS_DISTRO=${{ env.ROS_DISTRO }}
USE_RVIZ=1
SIM=1
platforms: |
amd64
no-cache: true

- name: Build and Push Sim
uses: docker/build-push-action@v3
if: env.PUSH == 'true'
with:
build-args: |
ROS_DISTRO=${{ env.ROS_DISTRO }}
USE_RVIZ=1
platforms: |
amd64
push: ${{ env.PUSH }}
no-cache: true
tags: |
luxonis/rae-ros-sim:${{ steps.vars.outputs.short_ref }}
- name: Build Robot
uses: docker/build-push-action@v3
if: env.PUSH == 'false'
Expand All @@ -74,6 +53,8 @@ jobs:
SIM=0
platforms: |
arm64
amd64
push: ${{ env.PUSH }}
no-cache: true

- name: Build and Push Robot
Expand All @@ -86,7 +67,8 @@ jobs:
SIM=0
platforms: |
arm64
amd64
push: ${{ env.PUSH }}
no-cache: true
tags: |
luxonis/rae-ros-robot:${{ steps.vars.outputs.short_ref }}
ghcr.io/luxonis/rae-ros-humble:${{ steps.vars.outputs.short_ref }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@
*.exe
*.out
*.app

*.pyc
57 changes: 29 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
ARG ROS_DISTRO=humble
FROM luxonis/depthai-ros-rae AS builder
ARG SIM=0
ARG CORE_NUM=1
ARG BUILD_TYPE="RelWithDebInfo"
FROM ghcr.io/luxonis/rae-base:2023.12.19

ARG BUILD_TYPE="RelWithDebInfo"
ARG SIM=0
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install --no-install-recommends \

RUN apt-get update && apt-get -y install --no-install-recommends \
software-properties-common \
git \
nano \
libusb-1.0-0-dev \
wget \
zsh \
python3-colcon-common-extensions \
python3-rosdep \
build-essential \
neovim \
tmux \
htop \
net-tools \
iputils-ping \
gpiod \
gstreamer1.0-plugins-bad \
gstreamer1.0-alsa \
libasound2-dev \
busybox \
ros-humble-cv-bridge \
ros-humble-image-transport \
ros-humble-image-transport-plugins \
ros-humble-rmw-cyclonedds-cpp \
gstreamer1.0-plugins-bad \
alsa-utils \
mpg123 \
libmpg123-dev
libmpg123-dev \
ros-humble-rtabmap-slam \
unzip \
ffmpeg \
ros-humble-image-proc \
git \
htop

ENV WS=/ws
RUN mkdir -p $WS/src
Expand All @@ -38,15 +35,19 @@ RUN cp -R .$WS/src/rae-ros/assets/. /usr/share
RUN rm -rf .$WS/src/rae-ros/assets
RUN rm -rf .$WS/src/rae-ros/rae_gazebo

RUN cd .$WS/ && apt update && rosdep update && rosdep install --from-paths src --ignore-src -y --skip-keys depthai --skip-keys depthai_bridge --skip-keys depthai_ros_driver --skip-keys audio_msgs --skip-keys laserscan_kinect --skip-keys ira_laser_tools
RUN cd .$WS/src && git clone https://github.com/Serafadam/ira_laser_tools.git && git clone https://github.com/Serafadam/depth_nav_tools.git
RUN cd .$WS/src && git clone https://github.com/BrettRD/ros-gst-bridge && \
cd ros-gst-bridge && \
git checkout 23980326ce8c0fefc0d5d590c2bfc9d308f35a73 # Pin latest master version at the time.
RUN cd ${WS}/src && git clone --branch dai_ros_py https://github.com/luxonis/depthai-ros.git
RUN cd .$WS/ && rosdep install --from-paths src --ignore-src -y --skip-keys depthai --skip-keys depthai_bridge --skip-keys depthai_ros_driver --skip-keys audio_msgs --skip-keys laserscan_kinect --skip-keys ira_laser_tools
RUN cd .$WS/ && . /opt/ros/${ROS_DISTRO}/setup.sh && . /sai_ros/spectacularai_ros2/install/setup.sh && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
RUN echo "if [ -f ${WS}/install/setup.bash ]; then source ${WS}/install/setup.bash; fi" >> $HOME/.bashrc
RUN echo "if [ -f ${WS}/install/setup.zsh ]; then source ${WS}/install/setup.zsh; fi" >> $HOME/.zshrc
RUN chmod +x /ws/src/rae-ros/entrypoint.sh

RUN cd .$WS/ && . /opt/ros/${ROS_DISTRO}/setup.sh && . $UNDERLAY_WS/install/setup.sh && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
ENTRYPOINT [ "/ws/src/rae/entrypoint.sh" ]

RUN echo "if [ -f ${WS}/install/setup.zsh ]; then source ${WS}/install/setup.zsh; fi" >> $HOME/.zshrc
RUN echo 'eval "$(register-python-argcomplete3 ros2)"' >> $HOME/.zshrc
RUN echo 'eval "$(register-python-argcomplete3 colcon)"' >> $HOME/.zshrc
RUN echo "if [ -f ${WS}/install/setup.bash ]; then source ${WS}/install/setup.bash; fi" >> $HOME/.bashrc
ENTRYPOINT [ "/ws/src/rae-ros/entrypoint.sh" ]
RUN rm -rf /usr/share/doc

CMD ["zsh"]
CMD ["bash"]
8 changes: 5 additions & 3 deletions rae_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,36 @@ add_executable(perception_ipc_rtabmap src/perception_ipc_rtabmap)

ament_target_dependencies(camera
${dependencies})
target_link_libraries(camera depthai::core)

install(TARGETS
camera
DESTINATION lib/${PROJECT_NAME})

ament_target_dependencies(stereo_depth
${dependencies})

target_link_libraries(stereo_depth depthai::core)
install(TARGETS
stereo_depth
DESTINATION lib/${PROJECT_NAME})


ament_target_dependencies(stereo_pair
${dependencies})

target_link_libraries(stereo_pair depthai::core)
install(TARGETS
stereo_pair
DESTINATION lib/${PROJECT_NAME})

ament_target_dependencies(yolo
${dependencies})

target_link_libraries(yolo depthai::core)
install(TARGETS
yolo
DESTINATION lib/${PROJECT_NAME})

ament_target_dependencies(perception_ipc_rtabmap ${IPC_DEPS_RTABMAP})
target_link_libraries(perception_ipc_rtabmap depthai::core)
install(TARGETS perception_ipc_rtabmap
DESTINATION lib/${PROJECT_NAME})

Expand Down
7 changes: 1 addition & 6 deletions rae_hw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(MPG123 REQUIRED libmpg123)

# Add GStreamer packages
find_package(PkgConfig REQUIRED)
pkg_check_modules(GST REQUIRED gstreamer-1.0)

include_directories(include
${GST_INCLUDE_DIRS} )
include_directories(include )

ament_auto_add_library(
${PROJECT_NAME}
Expand Down
3 changes: 2 additions & 1 deletion rae_hw/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@

<depend>libasound2-dev</depend>
<depend>libmpg123-dev</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>ament_cmake_gmock</test_depend>
<test_depend>ros2_control_test_assets</test_depend>

<exec_depend>rosbridge_server</exec_depend>
<exec_depend>foxglove_bridge</exec_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
Loading

0 comments on commit 3fc9138

Please sign in to comment.