Skip to content

Commit

Permalink
Stripped out all of the functionality till it compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
amarburg committed Aug 10, 2023
1 parent 0095dd4 commit 48fe5b6
Show file tree
Hide file tree
Showing 18 changed files with 3,196 additions and 2,935 deletions.
106 changes: 106 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
ARG BUILD_TYPE=clone
ARG ROS_VERSION=iron
ARG WS_DIR=/root/arena_ws

## This should work through the magic of multi-arch?
FROM ros:${ROS_VERSION}-perception AS build_image

# This should be set automatically by the build engine
ARG TARGETPLATFORM
ARG ARENA_SDK_URL_BASE=https://s3.us-west-1.wasabisys.com/marburg/LucidVision_SDK

# Install the LucidVision SDK
WORKDIR /tmp

RUN apt-get update && apt-get install -y \
git \
python3-vcstool \
wget \
&& apt autoremove -y \
&& apt clean -y \
&& rm -rf /var/lib/apt/lists/*

RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
ARENA_SDK_FILE=ArenaSDK_v0.1.68_Linux_x64.tar.bz2; \
elif [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
ARENA_SDK_FILE=ArenaSDK_v0.1.49_Linux_ARM64.tar.bz2; \
else \
echo "Unknown target platform ${TARGETPLATFORM}"; \
exit; \
fi && \
ARENA_SDK_URL=${ARENA_SDK_URL_BASE}/${ARENA_SDK_FILE} && \
echo "Downloading ${ARENA_SDK_URL}" && \
wget $ARENA_SDK_URL && \
cd /usr/local && \
tar -xjvf /tmp/$ARENA_SDK_FILE && \
rm /tmp/$ARENA_SDK_FILE

ENV ARENA_ROOT=/usr/local/ArenaSDK
# The name of the directory in the tarball changes by architecture,
# so create a convenience symlink
RUN ln -s /usr/local/ArenaSDK_* ${ARENA_ROOT}
WORKDIR ${ARENA_ROOT}
RUN sh -c "sudo sh Arena_SDK_*.conf"

# Install the default ROS entrypoint
WORKDIR /root
COPY ros_entrypoint.sh /root/ros_entrypoint.sh
ENTRYPOINT [ "/root/ros_entrypoint.sh" ]

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This build path clones from github
FROM build_image as build_clone

ARG ARENA_CAMERA_ROS2_REPO=https://github.com/apl-ocean-engineering/arena_camera_ros2.git
ARG ARENA_CAMERA_ROS2_BRANCH=main

ARG WS_DIR
ONBUILD WORKDIR ${WS_DIR}/src
ONBUILD RUN echo "Cloning from ${ARENA_CAMERA_ROS2_BRANCH} branch ${ARENA_CAMERA_ROS2_REPO}"

# This will break cache when the repo changes
ONBUILD ADD https://api.github.com/repos/apl-ocean-engineering/arena_camera_ros2/git/refs/heads/${ARENA_CAMERA_ROS2_BRANCH} version.json
ONBUILD RUN git clone -b ${ARENA_CAMERA_ROS2_BRANCH} ${ARENA_CAMERA_ROS2_REPO}

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This build path copies from a local tree
#
# I find the structure of the arena_camera_ros drive extremely annoying and
# can see changing away from it.
FROM build_image as build_local

ARG LOCAL_SRC=local_src

ARG WS_DIR
ONBUILD WORKDIR ${WS_DIR}/src
ONBUILD RUN echo "Pulling source code from local directory ${LOCAL_SRC}"
ONBUILD COPY ${LOCAL_SRC}/ ${WS_DIR}/src/

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Then the two build paths re-merge here
# dockerfile_lint - ignore
FROM build_${BUILD_TYPE}
LABEL Version=0.1
LABEL Name=arena_camera_ros2

WORKDIR ${WS_DIR}/src
RUN vcs import --shallow --skip-existing < arena_camera_ros2/arena_camera_ros2.repos

WORKDIR ${WS_DIR}

# This is quite expensive to run on every build...
# RUN bash -c "apt-get update \
# && source /opt/ros/noetic/setup.bash \
# && rosdep install -y --ignore-src \
# --skip-keys=arena_sdk \
# --from-paths src/ \
# && rm -rf /var/lib/apt/lists/*"

RUN bash -c "/root/ros_entrypoint.sh \
colcon build && \
colcon test"

# Convert ARG to ENV
ENV ROS_WS ${WS_DIR}
#RUN echo "ROS_WS=${ROS_WS}" > /root/.ROS_WS
CMD ["ros", "launch", "arena_camera", "arena_camera_nodelet.launch"]
20 changes: 20 additions & 0 deletions .docker/ros_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
#set -e

ROS_VERSION=${ROS_VERSION:-iron}

# if [ -f $HOME/.ROS_WS ]; then
# echo "Loading catkin ws from $HOME/.ROS_WS"
# source $HOME/.ROS_WS
# fi

# setup ros environment
if [ "${ROS_WS}" == "" ]; then
echo "Loading default environment: /opt/ros/$ROS_VERSION/setup.bash"
source /opt/ros/$ROS_VERSION/setup.bash
else
echo "Loading environment from workspace: $ROS_WS"
source $ROS_WS/devel/setup.bash
fi

exec "$@"
82 changes: 63 additions & 19 deletions arena_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ project(arena_camera)

set(CMAKE_CXX_STANDARD 14)


#
# ARENA SDK
#
Expand All @@ -18,11 +17,18 @@ if (NOT ${arena_sdk_FOUND})
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findarena_sdk.cmake")
endif()

set(THIS_PACKAGE_INCLUDE_DEPENDS
rclcpp
rclcpp_components
ament_cmake
camera_control_msgs
imaging_msgs
)

find_package(rclcpp REQUIRED)
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
find_package(${Dependency} REQUIRED)
endforeach()

find_package(camera_control_msgs REQUIRED)
find_package(imaging_msgs REQUIRED)


#
Expand Down Expand Up @@ -101,35 +107,73 @@ find_package(imaging_msgs REQUIRED)


# flags for all C++ targets
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(arena_camera_lib_name ${PROJECT_NAME})
set(arena_camera_lib ${PROJECT_NAME})

add_library( ${arena_camera_lib_name}
add_library( ${arena_camera_lib}
SHARED
src/encoding_conversions.cpp
src/arena_camera_parameter.cpp
src/nodelet_base.cpp
src/polled_nodelet.cpp
src/streaming_nodelet.cpp
src/base_node.cpp
src/polled_node.cpp
src/streaming_node.cpp
)

target_include_directories( ${arena_camera_lib_name}
PRIVATE ${catkin_INCLUDE_DIRS}
ament_target_dependencies(${arena_camera_lib} ${THIS_PACKAGE_INCLUDE_DEPENDS})
target_include_directories( ${arena_camera_lib}
PRIVATE ${arena_sdk_INCLUDE_DIRS}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
)

target_link_libraries( ${arena_camera_lib_name}
${catkin_LIBRARIES}
target_link_libraries( ${arena_camera_lib}
${arena_sdk_LIBRARIES}
)

ament_target_dependencies(${arena_camera_lib_name}
rclcpp
camera_control_msgs
imaging_msgs
rclcpp_components_register_nodes(${arena_camera_lib} "arena_camera::ArenaCameraPolledNode")
rclcpp_components_register_nodes(${arena_camera_lib} "arena_camera::ArenaCameraStreamingNode")

## Build stand-alone executables
foreach(Executable IN ITEMS polled_node streaming_node)

add_executable(${Executable} src/nodes/${Executable}_main.cpp)

target_include_directories( ${Executable}
PRIVATE ${arena_sdk_INCLUDE_DIRS}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
)

target_link_libraries(${Executable} ${arena_camera_lib})

endforeach()


# Install
install(
TARGETS ${arena_camera_lib}
DESTINATION lib/${PROJECT_NAME}
)

# install(DIRECTORY
# include/
# DESTINATION include
# )

install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)

# Run linters found in package.xml except those below
# set(ament_cmake_copyright_FOUND TRUE)
# set(ament_cmake_uncrustify_FOUND TRUE)
# set(ament_cmake_pep257_FOUND TRUE)
# set(ament_cmake_flake8_FOUND TRUE)

ament_lint_auto_find_test_dependencies()
endif()


# #
# # ARENA_CAMERA_NODES
Expand Down
Loading

0 comments on commit 48fe5b6

Please sign in to comment.