Skip to content

Commit

Permalink
Merge branch 'topic/sim-cam' of github.com:MissouriMRDT/Autonomy_Soft…
Browse files Browse the repository at this point in the history
…ware into topic/sim-cam
  • Loading branch information
ClayJay3 committed Jan 5, 2025
2 parents 9277c2e + 477cb22 commit 69d5b3f
Show file tree
Hide file tree
Showing 38 changed files with 1,008 additions and 298 deletions.
14 changes: 8 additions & 6 deletions .devcontainer/Dockerfile_Jammy
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,33 @@ RUN echo "${TZ}" > /etc/localtime && \
RUN echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}" > /usr/local/cuda/version.txt

# Add APT Repo for PCIe drivers.
RUN apt update && apt install -y curl && \
RUN apt update && apt install -y wget gnupg && \
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg && \
wget -qO - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
wget -qO - https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel-archive-keyring.gpg && \
mv bazel-archive-keyring.gpg /usr/share/keyrings && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list

# Install Required Ubuntu Packages
RUN apt-get update && apt-get install --no-install-recommends -y iputils-ping \
build-essential gdb wget less udev zstd sudo libgomp1 \
build-essential gdb less udev zstd sudo libgomp1 \
cmake git libgtk2.0-dev pkg-config libx264-dev libdrm-dev ssh \
libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev tzdata net-tools \
yasm libatlas-base-dev gfortran libpq-dev libpostproc-dev \
libxine2-dev libglew-dev libtiff5-dev zlib1g-dev cowsay lolcat locales usbutils \
libeigen3-dev python3-dev python3-pip python3-numpy libx11-dev xauth libssl-dev \
valgrind doxygen graphviz htop nano fortune fortunes \
vim-common gasket-dkms nlohmann-json3-dev gcovr lcov
vim-common gasket-dkms nlohmann-json3-dev gcovr lcov curl \
libaom-dev libass-dev libfdk-aac-dev libdav1d-dev libmp3lame-dev \
libopus-dev libvorbis-dev libvpx-dev libx264-dev libx265-dev

# Nice to have
RUN apt-get update && apt-get install --no-install-recommends -y bat \
bash-completion fish git-lfs

# Install Required Python Packages and link python3 executable to python.
RUN ln -s /usr/bin/python3 /usr/bin/python && \
python -m pip install numpy opencv-python pyopengl
python -m pip install numpy opencv-python pyopengl matplotlib

# Set Timezone
RUN echo "${TZ}" > /etc/localtime && \
Expand Down
14 changes: 10 additions & 4 deletions .devcontainer/Dockerfile_JetPack
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,32 @@ RUN echo "# R${L4T_MAJOR} (release), REVISION: ${L4T_MINOR}.${L4T_PATCH}" > /etc
# Clean APT Cache
RUN rm /var/lib/dpkg/info/libc-bin.*
# Add APT Repo for PCIe drivers and Bazel.
RUN apt update && apt install -y curl && \
RUN apt update && apt install -y wget && \
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

# Install Required Ubuntu Packages
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential gfortran cmake git gdb file tar libatlas-base-dev apt-transport-https iputils-ping \
libswresample-dev libcanberra-gtk3-module zstd wget less libx264-dev libdrm-dev \
libswresample-dev libcanberra-gtk3-module zstd less libx264-dev libdrm-dev \
libeigen3-dev libglew-dev libgstreamer-plugins-base1.0-dev udev net-tools \
libgstreamer-plugins-good1.0-dev libgstreamer1.0-dev libgtk-3-dev libjpeg-dev sudo usbutils \
libjpeg8-dev libjpeg-turbo8-dev liblapack-dev liblapacke-dev libopenblas-dev libpng-dev tzdata \
libpostproc-dev libtbb-dev libtbb2 libtesseract-dev libtiff-dev libv4l-dev \
libxine2-dev libxvidcore-dev libx264-dev libgtkglext1 libgtkglext1-dev pkg-config qv4l2 \
v4l-utils zlib1g-dev python3-dev libboost-all-dev valgrind doxygen graphviz nano \
vim-common libedgetpu1-std gasket-dkms ca-certificates nlohmann-json3-dev
vim-common libedgetpu1-std gasket-dkms ca-certificates nlohmann-json3-dev curl \
python3-dev python3-pip python3-numpy libaom-dev libass-dev libfdk-aac-dev libdav1d-dev \
libmp3lame-dev libopus-dev libvorbis-dev libvpx-dev libx264-dev libx265-dev

# Nice to have
RUN apt-get update && apt-get install --no-install-recommends -y bat \
bash-completion fish git-lfs

# Install Required Python Packages and link python3 executable to python.
RUN ln -s /usr/bin/python3 /usr/bin/python && \
python -m pip install numpy opencv-python pyopengl matplotlib

# This symbolic link is needed to use the streaming features on Jetson inside a container
RUN ln -sf /usr/lib/aarch64-linux-gnu/tegra/libv4l2.so.0 /usr/lib/aarch64-linux-gnu/libv4l2.so

Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"gruntfuggly.todo-tree",
"streetsidesoftware.code-spell-checker",
"vscode-icons-team.vscode-icons",
"ryanluker.vscode-coverage-gutters"
"ryanluker.vscode-coverage-gutters",
"GitHub.vscode-pull-request-github"
],
"settings": {
// VSCode settings.
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ valgrind.rpt
tools/action-runners/compose.yml
!tools/package-builders/

# Logging tools.
tools/logging/*.png

# Compiled Program
Autonomy_Software

Expand Down
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cmake_policy(SET CMP0153 OLD) # Allows use of "Exec_Program" function
####################################################################################################################

## Enable or Disable Simulation Mode
option(BUILD_SIM_MODE "Enable Simulation Mode" ON)
option(BUILD_SIM_MODE "Enable Simulation Mode" OFF)

## Enable or Disable Code Coverage Mode
option(BUILD_CODE_COVERAGE "Enable Code Coverage Mode" OFF)
Expand Down Expand Up @@ -186,6 +186,9 @@ endif()
## Find Threads
find_package(Threads REQUIRED)

## Find OpenMP
find_package(OpenMP REQUIRED)

## Find Quill
find_package(quill REQUIRED)

Expand Down Expand Up @@ -309,6 +312,7 @@ endif()

## Link Libraries
set(AUTONOMY_LIBRARIES Threads::Threads
OpenMP::OpenMP_CXX
Eigen3::Eigen
RoveComm_CPP
quill::quill
Expand Down Expand Up @@ -343,23 +347,24 @@ if (BUILD_TESTS_MODE)
file(GLOB_RECURSE IntegrationTests_SRC CONFIGURE_DEPENDS "tests/Integration/*.cc")
file(GLOB_RECURSE Algorithms_SRC CONFIGURE_DEPENDS "src/algorithms/*.cpp")
file(GLOB_RECURSE Drivers_SRC CONFIGURE_DEPENDS "src/drivers/*.cpp")
# file(GLOB_RECURSE Handlers_SRC CONFIGURE_DEPENDS "src/handlers/*.cpp")
file(GLOB_RECURSE Vision_SRC CONFIGURE_DEPENDS "src/vision/*.cpp")
file(GLOB Network_SRC CONFIGURE_DEPENDS "src/AutonomyNetworking.cpp")
file(GLOB Logging_SRC CONFIGURE_DEPENDS "src/AutonomyLogging.cpp")
file(GLOB Globals_SRC CONFIGURE_DEPENDS "src/AutonomyGlobals.cpp")

list(LENGTH UnitTests_SRC UnitTests_LEN)
list(LENGTH IntegrationTests_SRC IntegrationTests_LEN)

if (UnitTests_LEN GREATER 0)
add_executable(${EXE_NAME}_UnitTests ${UnitTests_SRC} ${Algorithms_SRC} ${Drivers_SRC} ${Network_SRC} ${Logging_SRC})
add_executable(${EXE_NAME}_UnitTests ${UnitTests_SRC} ${Algorithms_SRC} ${Drivers_SRC} ${Vision_SRC} ${Network_SRC} ${Logging_SRC} ${Globals_SRC})
target_link_libraries(${EXE_NAME}_UnitTests GTest::gtest GTest::gtest_main ${AUTONOMY_LIBRARIES})
add_test(Unit_Tests ${EXE_NAME}_UnitTests)
else()
message("No Unit Tests!")
endif()

if (IntegrationTests_LEN GREATER 0)
add_executable(${EXE_NAME}_IntegrationTests ${IntegrationTests_SRC} ${Algorithms_SRC} ${Drivers_SRC} ${Network_SRC} ${Logging_SRC})
add_executable(${EXE_NAME}_IntegrationTests ${IntegrationTests_SRC} ${Algorithms_SRC} ${Drivers_SRC} ${Vision_SRC} ${Network_SRC} ${Logging_SRC} ${Globals_SRC})
target_link_libraries(${EXE_NAME}_IntegrationTests GTest::gtest GTest::gtest_main ${AUTONOMY_LIBRARIES})
add_test(Integration_Tests ${EXE_NAME}_IntegrationTests)
else()
Expand Down
65 changes: 65 additions & 0 deletions data/Custom_Dictionaries/Autonomy-Dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CAFFE
CALIB
CELLVOLTAGE
charconv
chromaprint
chrono
clayjay
CLEARWAYPOINTS
Expand Down Expand Up @@ -202,6 +203,7 @@ Geospatial
gfortran
gmock
GNSS
gnutls
GPSLATLONALT
GPSMDRS
GPSSDELC
Expand Down Expand Up @@ -254,53 +256,111 @@ jthread
kbits
keyrings
keyscan
ladspa
latlng
latlon
ldconfig
LEDRGB
LEFTCAM
libaom
libass
libatlas
libavcodec
libavdevice
libavfilter
libavformat
libavutil
libbluray
libboost
libbs
libc
libcaca
libcanberra
libcdio
libchromaprint
libcodec
libdatachannel
libdav
libdc
libdrm
libedgetpu
libeigen
libfdk
libflite
libfontconfig
libfreetype
libfribidi
libglew
libglslang
libgme
libgnutls
libgomp
libgsm
libgstreamer
libgtkglext
libharfbuzz
libiec
libjack
libjpeg
libjxl
liblapack
liblapacke
libmfx
libmp
libmysofa
libopenblas
libopenjpeg
libopenmpt
libopus
libplacebo
libpostproc
libpq
libpulse
librabbitmq
librav
librist
librsvg
librubberband
libshine
libsnappy
libsoxr
libspeex
libsrt
libssh
libsvtav
libswresample
libswscale
libtbb
libtesseract
libtheora
libtwolame
libusb
libv
libvidstab
libvorbis
libvpl
libvpx
libwebp
libx
libxine
libxvid
libxvidcore
libzimg
libzmq
libzvbi
localtime
LOGNAME
lpthread
m_muWebRTCRGBImageCopyMutex
MAINCAM
MAINCAN
mainpage
Makefiles
MAKEFLAGS
MAPANGLE
MAPRANGE
marsrover
matplotlib
matx
Memcheck
MERICA
Expand All @@ -321,6 +381,7 @@ NAVIGATIONBOARD
navpvt
nJter
nlohmann
nonfree
noninteractive
nullptr
numops
Expand All @@ -330,9 +391,11 @@ OBJDETECTION
OBJECTDETECT
Objectness
odometry
openal
OPENCL
opencontainers
opencv
opengl
OPENMP
ostream
OTSU
Expand All @@ -347,6 +410,7 @@ pispcl
PIXELTYPE
PKNS
PNSD
pocketsphinx
POSETRACK
Pranswer
pthread
Expand Down Expand Up @@ -393,6 +457,7 @@ SIMBASICCAM
SIMCAM
SIMZED
SIMZEDCAM
sndio
sockaddr
softprops
SPSC
Expand Down
2 changes: 1 addition & 1 deletion examples/vision/cameras/OpenBasicCam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void RunExample()
globals::g_pCameraHandler = new CameraHandler();

// Get reference to camera.
ZEDCamera* ExampleBasicCam1 = globals::g_pCameraHandler->GetBasicCam(CameraHandler::BasicCamName::eHeadGroundCam);
BasicCamera* ExampleBasicCam1 = globals::g_pCameraHandler->GetBasicCam(CameraHandler::BasicCamName::eHeadGroundCam);
// Start basic cam.
ExampleBasicCam1->Start();

Expand Down
2 changes: 1 addition & 1 deletion examples/vision/dnn/InferenceYOLOModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void RunExample()
globals::g_pCameraHandler = new CameraHandler();

// Get reference to camera.
ZEDCamera* ExampleBasicCam1 = globals::g_pCameraHandler->GetBasicCam(CameraHandler::eHeadGroundCam);
BasicCamera* ExampleBasicCam1 = globals::g_pCameraHandler->GetBasicCam(CameraHandler::BasicCamName::eHeadGroundCam);
// Start basic cam.
ExampleBasicCam1->Start();

Expand Down
2 changes: 1 addition & 1 deletion examples/vision/tagdetection/ArucoDetectionBasicCam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void RunExample()
globals::g_pTagDetectionHandler = new TagDetectionHandler();

// Get pointer to camera.
ZEDCamera* ExampleBasicCam1 = globals::g_pCameraHandler->GetBasicCam(CameraHandler::eHeadGroundCam);
BasicCamera* ExampleBasicCam1 = globals::g_pCameraHandler->GetBasicCam(CameraHandler::BasicCamName::eHeadGroundCam);
// Start basic cam.
ExampleBasicCam1->Start();

Expand Down
4 changes: 2 additions & 2 deletions examples/vision/tagdetection/ArucoDetectionZED.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ void RunExample()
globals::g_pTagDetectionHandler = new TagDetectionHandler();

// Get pointer to camera.
ZEDCamera* ExampleZEDCam1 = globals::g_pCameraHandler->GetZED(CameraHandler::eHeadMainCam);
ZEDCamera* ExampleZEDCam1 = globals::g_pCameraHandler->GetZED(CameraHandler::ZEDCamName::eHeadMainCam);
// Start basic cam.
ExampleZEDCam1->Start();

// Get pointer to the tag detector for the basic cam.
TagDetector* ExampleTagDetector1 = globals::g_pTagDetectionHandler->GetTagDetector(TagDetectionHandler::eHeadMainCam);
TagDetector* ExampleTagDetector1 = globals::g_pTagDetectionHandler->GetTagDetector(TagDetectionHandler::TagDetectors::eHeadMainCam);
// Start the basic cam detector.
ExampleTagDetector1->Start();

Expand Down
9 changes: 5 additions & 4 deletions src/AutonomyConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace constants
const bool MODE_SIM = false; // REG MODE ENABLED: Toggle RoveComm and Cameras to use standard configuration.
#endif
const std::string SIM_IP_ADDRESS = "192.168.69.48"; // The IP address to use for simulation mode.
const uint SIM_WEBRTC_QP = 25; // The QP value to use for WebRTC in simulation mode. 0-51, 0 is lossless. If too high for network, frames drop.

// Safety constants.
const double BATTERY_MINIMUM_CELL_VOLTAGE = 3.2; // The minimum cell voltage of the battery before autonomy will forcefully enter Idle state.
Expand Down Expand Up @@ -224,8 +225,8 @@ namespace constants

// OpenCV ArUco detection config.
const cv::aruco::PredefinedDictionaryType ARUCO_DICTIONARY = cv::aruco::DICT_4X4_50; // The predefined ArUco dictionary to use for detections.
const float ARUCO_TAG_SIDE_LENGTH = 0.015f; // Size of the white borders around the tag.
const int ARUCO_VALIDATION_THRESHOLD = 20; // How many times does the tag need to be detected(hit) before being validated as an actual aruco tag.
const float ARUCO_TAG_SIDE_LENGTH = 0.015f; // Size of the white borders around the tag in meters.
const int ARUCO_VALIDATION_THRESHOLD = 10; // How many times does the tag need to be detected(hit) before being validated as an actual aruco tag.
const int ARUCO_UNVALIDATED_TAG_FORGET_THRESHOLD = 5; // How many times can an unvalidated tag be missing from frame before being forgotten.
const int ARUCO_VALIDATED_TAG_FORGET_THRESHOLD = 10; // How many times can a validated tag be missing from frame before being forgotten.
const double ARUCO_PIXEL_THRESHOLD = 175; // Pixel value threshold for pre-process threshold mask
Expand Down Expand Up @@ -296,7 +297,7 @@ namespace constants
///////////////////////////////////////////////////////////////////////////

// Approaching Marker State
const int APPROACH_MARKER_DETECT_ATTEMPTS_LIMIT = 60; // How many consecutive failed attempts at detecting a tag before giving up on marker.
const int APPROACH_MARKER_DETECT_ATTEMPTS_LIMIT = 5; // How many consecutive failed attempts at detecting a tag before giving up on marker.
const double APPROACH_MARKER_MOTOR_POWER = 0.3; // The amount of power the motors use when approaching the marker.
const double APPROACH_MARKER_PROXIMITY_THRESHOLD = 2.0; // How close in meters the rover must be to the target marker before completing its approach.
const double APPROACH_MARKER_TF_CONFIDENCE_THRESHOLD = 0.5; // What is the minimal confidence necessary to consider a tensorflow tag as a target.
Expand Down Expand Up @@ -330,7 +331,7 @@ namespace constants
const double STATEMACHINE_ZED_REALIGN_THRESHOLD = 0.5; // The threshold in meters that the error between GPS and ZED must be before realigning the ZED cameras.

// Navigating State.
const double NAVIGATING_REACHED_GOAL_RADIUS = 1.0; // The radius in meters that the rover should get to the goal waypoint.
const double NAVIGATING_REACHED_GOAL_RADIUS = 2.0; // The radius in meters that the rover should get to the goal waypoint.

// Avoidance State.
const double AVOIDANCE_STATE_MOTOR_POWER = DRIVE_MAX_POWER; // Drive speed of avoidance state
Expand Down
Loading

0 comments on commit 69d5b3f

Please sign in to comment.