Skip to content

Commit

Permalink
Merge pull request #129 from UOA-FSAE/cone_detection_test
Browse files Browse the repository at this point in the history
Cone detection test
  • Loading branch information
Tanish29 authored Aug 20, 2024
2 parents afcc0d2 + a2b1bd8 commit a60b221
Show file tree
Hide file tree
Showing 43 changed files with 4,806 additions and 168 deletions.
88 changes: 40 additions & 48 deletions .devcontainer/ros2_perception.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
FROM stereolabs/zed:4.0-tools-devel-l4t-r35.4
LABEL Name=zed_sdk Version=0.0.1
FROM nvcr.io/nvidia/l4t-base:35.4.1
LABEL Name=autonomous Version=0.0.1

SHELL [ "/bin/bash", "-c" ]

WORKDIR /ws

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libopenblas-dev \
libopenmpi-dev \
openmpi-bin \
openmpi-common \
gfortran \
libomp-dev \
nvidia-cuda-dev \
nvidia-cudnn8-dev && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean

RUN apt update && apt install locales && \
locale-gen en_US en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

RUN apt update && apt install -y gnupg wget software-properties-common && \
add-apt-repository universe
Expand All @@ -21,61 +35,39 @@ RUN apt update && apt install curl -y && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu focal main" | \
tee /etc/apt/sources.list.d/ros2.list > /dev/null

# setup timezone & install packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
tzdata \
dirmngr \
gnupg2 \
git \
ENV ROS_DISTRO humble

RUN apt update && apt install --no-install-recommends -y \
ros-humble-ros-base \
ros-dev-tools \
build-essential \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool && \
python3-vcstool \
python3-pip \
ros-humble-foxglove-bridge && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
apt-get clean && \
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc

COPY . .

ENV ROS_DISTRO humble

# setup colcon mixin and metadata
RUN rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
colcon mixin add default \
https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \
colcon mixin update && \
colcon metadata add default \
https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \
colcon metadata update
RUN rosdep init && rosdep update --rosdistro $ROS_DISTRO && apt-get update && \
cd /ws && \
rosdep install --from-paths src -y -r --ignore-src --rosdistro=$ROS_DISTRO --os=ubuntu:jammy && \
rm -rf /var/lib/apt/lists/*

COPY ./src/perception/ /ws/src/perception/
COPY ./src/moa/moa_description /ws/src/moa/moa_description
COPY ./src/moa/moa_msgs /ws/src/moa/moa_msgs
ENV PYTORCH_URL=https://developer.download.nvidia.com/compute/redist/jp/v512/pytorch/torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl PYTORCH_WHL=torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl

# install ros2 packages
RUN cd /ws/src/ && \
git clone --recursive https://github.com/stereolabs/zed-ros2-wrapper.git && \
cd .. && \
source /opt/ros/humble/setup.bash && \
rosdep update && apt-get update && \
rosdep install --from-paths src -y -r --ignore-src --rosdistro=$ROS_DISTRO --os=ubuntu:jammy && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
RUN cd /opt && \
wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${PYTORCH_URL} -O ${PYTORCH_WHL} && \
pip3 install --verbose ${PYTORCH_WHL}

RUN cd /usr/local/zed && \
pip install requests && \
python3 get_python_api.py
RUN python3 -c 'import torch; print(f"PyTorch version: {torch.__version__}"); print(f"CUDA available: {torch.cuda.is_available()}"); print(f"cuDNN version: {torch.backends.cudnn.version()}"); print(torch.__config__.show());'

RUN source /opt/ros/humble/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"'

RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc && \
echo "source /ws/install/setup.bash" >> ~/.bashrc

RUN . ~/.bashrc
--event-handlers console_direct+ --base-paths src

CMD ["bash"]
CMD [ "bash" ]
10 changes: 5 additions & 5 deletions .devcontainer/zed.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ RUN cd /ws/src/ && \

RUN cd /usr/local/zed && \
pip install requests && \
python3 get_python_api.py
python3 get_python_api.py \
pip3 install ultralytics \
pip3 install torch \
pip3 install pyopengl \
pip3 install pyzed

RUN source /opt/ros/humble/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
Expand All @@ -68,8 +72,4 @@ RUN source /opt/ros/humble/setup.bash && \

RUN echo "source /ws/install/setup.bash" >> ~/.bashrc

RUN . ~/.bashrc

COPY ./.devcontainer/SN31421864.conf /usr/local/zed/settings/SN31421864.conf

CMD ["bash"]
6 changes: 5 additions & 1 deletion .docker_templates/zed.Jetson.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ RUN cd /ws/src/ && \

RUN cd /usr/local/zed && \
pip install requests && \
python3 get_python_api.py
python3 get_python_api.py \
pip3 install ultralytics \
pip3 install torch \
pip3 install pyopengl \
pip3 install pyzed

RUN source /opt/ros/humble/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "src/hardware_drivers/foxglove-bridge"]
path = src/hardware_drivers/foxglove-bridge
url = https://github.com/foxglove/ros-foxglove-bridge.git
[submodule "src/moa/cone-detection/cone_detection/yolov7"]
path = src/perception/cone-detection/cone_detection/yolov7
url = https://github.com/WongKinYiu/yolov7.git
[submodule "src/hardware_drivers/CanTalk"]
path = src/hardware_drivers/CanTalk
url = https://github.com/UOA-FSAE/CanTalk.git
Expand Down
62 changes: 62 additions & 0 deletions src/geographic_msgs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Change history
==============

0.5.3 (2018-03-27)
------------------

* Add additional information to ``GetGeoPath`` service response.

0.5.2 (2017-04-15)
------------------

* Fix merge error in GeoPath message.

0.5.1 (2017-04-15)
------------------

* Add GeoPath message with poses.
* Add GetGeoPath service (`#7`_).

0.5.0 (2017-04-07)
------------------

* Add new ``GeoPointStamped`` and ``GeoPoseStamped`` messages.

0.4.0 (2014-09-18)
------------------

0.3.2 (2014-08-30)
------------------

* Add missing ``geometry_msgs`` dependency to ``catkin_package()``
components in CMakeLists.txt (`#13`_), thanks to Timo Roehling.

0.3.1 (2013-10-03)
------------------

0.3.0 (2013-08-03)
------------------

* Released to Hydro.
* Convert to catkin build (`#3`_).

0.2.1 (2012-08-13)
------------------

* Released to Fuerte.
* Released to Groovy: 2013-03-27.

0.2.0 (2012-06-02)
------------------

* Released to Electric.

0.1.0 (2012-04-10)
------------------

* Initial release to Electric.

.. _`#3`: https://github.com/ros-geographic-info/geographic_info/issues/3
.. _`#6`: https://github.com/ros-geographic-info/geographic_info/issues/6
.. _`#7`: https://github.com/ros-geographic-info/geographic_info/issues/7
.. _`#13`: https://github.com/ros-geographic-info/geographic_info/pull/13
81 changes: 81 additions & 0 deletions src/geographic_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
cmake_minimum_required(VERSION 3.5)
project(geographic_msgs)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(unique_identifier_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
"msg/BoundingBox.msg"
"msg/GeographicMapChanges.msg"
"msg/GeographicMap.msg"
"msg/GeoPath.msg"
"msg/GeoPoint.msg"
"msg/GeoPointStamped.msg"
"msg/GeoPose.msg"
"msg/GeoPoseStamped.msg"
"msg/GeoPoseWithCovariance.msg"
"msg/GeoPoseWithCovarianceStamped.msg"
"msg/KeyValue.msg"
"msg/MapFeature.msg"
"msg/RouteNetwork.msg"
"msg/RoutePath.msg"
"msg/RouteSegment.msg"
"msg/WayPoint.msg"
"srv/GetGeographicMap.srv"
"srv/GetGeoPath.srv"
"srv/GetRoutePlan.srv"
"srv/UpdateGeographicMap.srv"
DEPENDENCIES unique_identifier_msgs geometry_msgs std_msgs builtin_interfaces
)

rosidl_get_typesupport_target(cpp_typesupport_target "${PROJECT_NAME}" rosidl_typesupport_cpp)

if(TARGET "${cpp_typesupport_target}")
add_library(${PROJECT_NAME}::cpp_typesupport_target ALIAS ${cpp_typesupport_target})
add_library(validation INTERFACE)
add_library(${PROJECT_NAME}::validation ALIAS validation)
add_subdirectory(include)
target_link_libraries(validation INTERFACE ${PROJECT_NAME}::cpp_typesupport_target)

install(
TARGETS validation
EXPORT export_${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)

install(
DIRECTORY include/
DESTINATION include/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.hpp"
)

ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
endif()

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
add_subdirectory(test)
endif()

install(
FILES geographic_msgs_mapping_rule.yaml
DESTINATION share/${PROJECT_NAME}
)

ament_export_dependencies(rosidl_default_runtime)

ament_package()
12 changes: 12 additions & 0 deletions src/geographic_msgs/mainpage.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
\mainpage
\htmlinclude manifest.html

This package provides ROS messages for Geographic Information.

It includes a simple validation library to validate messages have values within
the documented bounds.

It has no nodes or scripts.

*/
13 changes: 13 additions & 0 deletions src/geographic_msgs/msg/BoundingBox.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Geographic map bounding box.
#
# The two GeoPoints denote diagonally opposite corners of the box.
#
# If min_pt.latitude is NaN, the bounding box is "global", matching
# any valid latitude, longitude and altitude.
#
# If min_pt.altitude is NaN, the bounding box is two-dimensional and
# matches any altitude within the specified latitude and longitude
# range.

GeoPoint min_pt # lowest and most Southwestern corner
GeoPoint max_pt # highest and most Northeastern corner
2 changes: 2 additions & 0 deletions src/geographic_msgs/msg/GeoPath.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
std_msgs/Header header
geographic_msgs/GeoPoseStamped[] poses
13 changes: 13 additions & 0 deletions src/geographic_msgs/msg/GeoPoint.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Geographic point, using the WGS 84 reference ellipsoid.

# Latitude [degrees]. Positive is north of equator; negative is south
# (-90.0 <= latitude <= +90.0).
float64 latitude

# Longitude [degrees]. Positive is east of prime meridian; negative is
# west (-180.0 <= longitude <= +180.0). At the poles, latitude is -90.0 or
# +90.0, and longitude is irrelevant, but must be in range.
float64 longitude

# Altitude [m]. Positive is above the WGS 84 ellipsoid (NaN if unspecified).
float64 altitude
2 changes: 2 additions & 0 deletions src/geographic_msgs/msg/GeoPointStamped.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
std_msgs/Header header
geographic_msgs/GeoPoint position
7 changes: 7 additions & 0 deletions src/geographic_msgs/msg/GeoPose.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Geographic pose, using the WGS 84 reference ellipsoid.
#
# Orientation uses the East-North-Up (ENU) frame of reference.
# (But, what about singularities at the poles?)

GeoPoint position
geometry_msgs/Quaternion orientation
2 changes: 2 additions & 0 deletions src/geographic_msgs/msg/GeoPoseStamped.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
std_msgs/Header header
geographic_msgs/GeoPose pose
12 changes: 12 additions & 0 deletions src/geographic_msgs/msg/GeoPoseWithCovariance.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Geographic pose, using the WGS 84 reference ellipsoid.
#
# Orientation uses the East-North-Up (ENU) frame of reference.
# (But, what about singularities at the poles?)

GeoPose pose

# Row-major representation of the 6x6 covariance matrix
# The orientation parameters use a fixed-axis representation.
# In order, the parameters are:
# (Lat, Lon, Alt, rotation about E (East) axis, rotation about N (North) axis, rotation about U (Up) axis)
float64[36] covariance
2 changes: 2 additions & 0 deletions src/geographic_msgs/msg/GeoPoseWithCovarianceStamped.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
std_msgs/Header header
geographic_msgs/GeoPoseWithCovariance pose
11 changes: 11 additions & 0 deletions src/geographic_msgs/msg/GeographicMap.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Geographic map for a specified region.

std_msgs/Header header # stamp specifies time
# frame_id (normally /map)

unique_identifier_msgs/UUID id # identifier for this map
BoundingBox bounds # 2D bounding box containing map

WayPoint[] points # way-points
MapFeature[] features # map features
KeyValue[] props # map properties
Loading

0 comments on commit a60b221

Please sign in to comment.