Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write Drivers for Rover Hardware Interfaces #141

Merged
merged 22 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d3b3635
Add geographiclib.
ClayJay3 Oct 6, 2023
b18aab2
Merge remote-tracking branch 'origin/development' into topic/drivers
ClayJay3 Oct 6, 2023
3eb7b6c
Add words to dictionary.
ClayJay3 Oct 6, 2023
b522af4
Add geographiclib to other Dockerfiles.
ClayJay3 Oct 8, 2023
53415a4
Added GPS/UTM conversions.
ClayJay3 Oct 12, 2023
0efea4d
Added unit test for UTM/GPS conversion.
ClayJay3 Oct 12, 2023
4e8a7c3
Fixed linking of GeoLib.
ClayJay3 Oct 12, 2023
c0115eb
Fixed bugs within differential drive kinematics.
ClayJay3 Oct 13, 2023
02f61e9
Wrote Unit test for diffdrive.
ClayJay3 Oct 13, 2023
d0e0a71
Drivers are close to done.
ClayJay3 Oct 13, 2023
7994e2e
Readded Clamp to numops.
ClayJay3 Oct 13, 2023
7387732
Added CalculateGeoDistance function to geoops namespace.
ClayJay3 Oct 13, 2023
6b3eca0
Added test for CalculateGeoDistance
ClayJay3 Oct 13, 2023
5f961a6
Change earth radius.
ClayJay3 Oct 14, 2023
f339b88
Began writing a universal PID controller.
ClayJay3 Oct 17, 2023
082d973
Little more progress on the PID controller.
ClayJay3 Oct 17, 2023
b8269fb
Wrote setters for PID controller.
ClayJay3 Oct 17, 2023
380ef22
Finished writing setters for PIDController and fixed compile error.
ClayJay3 Oct 19, 2023
37b8f07
Finished PID controller and drive board class.
ClayJay3 Oct 20, 2023
2a0410e
Merge remote-tracking branch 'origin/development' into topic/drivers
ClayJay3 Oct 20, 2023
809ce67
Made requested PR changes.
ClayJay3 Oct 20, 2023
4ad4006
Merge remote-tracking branch 'origin/development' into topic/drivers
ClayJay3 Oct 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .devcontainer/Dockerfile_Focal
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ARG ZED_MAJOR="4"
ARG ZED_MINOR="0"
ARG CMAKE_VERSION="3.24.3"
ARG OPENCV_VERSION="4.8.0"
ARG GEOLIB_VERSION="v2.3"
ARG QUILL_VERSION="v3.3.1"
ARG GTEST_VERSION="v1.14.0"
ARG TZ="America/Chicago"
Expand Down Expand Up @@ -113,11 +114,23 @@ RUN git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/ope
cd ../.. && \
rm -rf opencv_contrib && rm -rf opencv

# Install GeographicLib from Source
RUN git clone --depth 1 --branch ${GEOLIB_VERSION} https://github.com/geographiclib/geographiclib.git && \
mkdir geographiclib/build && \
cd geographiclib/build && \
cmake \
-D CMAKE_BUILD_TYPE=Release .. && \
make && \
make install && \
cd ../.. && \
rm -rf geographiclib

# Install Quill from Source
RUN git clone --depth 1 --branch ${QUILL_VERSION} http://github.com/odygrd/quill.git && \
mkdir quill/build && \
cd quill/build && \
cmake .. && \
cmake \
-D CMAKE_BUILD_TYPE=Release .. && \
make && \
make install && \
cd ../.. && \
Expand Down
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile_Jammy
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ARG ZED_MAJOR="4"
ARG ZED_MINOR="0"
ARG CMAKE_VERSION="3.24.3"
ARG OPENCV_VERSION="4.8.0"
ARG GEOLIB_VERSION="v2.3"
ARG QUILL_VERSION="v3.3.1"
ARG GTEST_VERSION="v1.14.0"
ARG TZ="America/Chicago"
Expand Down Expand Up @@ -116,6 +117,17 @@ RUN git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/ope
cd ../.. && \
rm -rf opencv_contrib && rm -rf opencv

# Install GeographicLib from Source
RUN git clone --depth 1 --branch ${GEOLIB_VERSION} https://github.com/geographiclib/geographiclib.git && \
mkdir geographiclib/build && \
cd geographiclib/build && \
cmake \
-D CMAKE_BUILD_TYPE=RelWithDebInfo .. && \
make && \
make install && \
cd ../.. && \
rm -rf geographiclib

# Install Quill from Source
RUN git clone --depth 1 --branch ${QUILL_VERSION} http://github.com/odygrd/quill.git && \
mkdir quill/build && \
Expand Down
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile_JetPack
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ARG ZED_MAJOR="4"
ARG ZED_MINOR="0"
ARG CMAKE_VERSION="3.24.3"
ARG OPENCV_VERSION="4.8.0"
ARG GEOLIB_VERSION="v2.3"
ARG QUILL_VERSION="v3.3.1"
ARG GTEST_VERSION="v1.14.0"
ARG TZ="America/Chicago"
Expand Down Expand Up @@ -115,6 +116,17 @@ RUN git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/ope
cd ../.. && \
rm -rf opencv_contrib && rm -rf opencv

# Install GeographicLib from Source
RUN git clone --depth 1 --branch ${GEOLIB_VERSION} https://github.com/geographiclib/geographiclib.git && \
mkdir geographiclib/build && \
cd geographiclib/build && \
cmake \
-D CMAKE_BUILD_TYPE=RelWithDebInfo .. && \
make && \
make install && \
cd ../.. && \
rm -rf geographiclib

# Install Quill from Source
RUN git clone --depth 1 --branch ${QUILL_VERSION} http://github.com/odygrd/quill.git && \
mkdir quill/build && \
Expand Down
6 changes: 4 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// "image": "ghcr.io/missourimrdt/autonomy-jetpack:latest",
// "build": {
// // "dockerfile": "Dockerfile_Jammy"
// "dockerfile": "Dockerfile_Focal"
// // "dockerfile": "Dockerfile_Focal"
// // "dockerfile": "Dockerfile_JetPack"
// },
// Features to add to the dev container. More info: https://containers.dev/features.
Expand Down Expand Up @@ -95,7 +95,9 @@
"/usr/local/include/gmock/",
"/usr/local/include/gmock/**",
"/usr/local/include/gtest/",
"/usr/local/include/gtest/**"
"/usr/local/include/gtest/**",
"/usr/local/include/GeographicLib/",
"/usr/local/include/GeographicLib/**"
],
// CMAKE extension settings.
"cmake.configureOnOpen": true,
Expand Down
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ find_package(Eigen3 3.3 REQUIRED NO_MODULE)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

## Find Geographic Lib.
find_package(GeographicLib REQUIRED)
include_directories(${GeographicLib_INCLUDE_DIRS})

## Find CUDA.
find_package(CUDA 11.4 REQUIRED)
message(STATUS "Found CUDA ${CUDA_VERSION_STRING} at ${CUDA_TOOLKIT_ROOT_DIR}")
Expand Down Expand Up @@ -133,12 +137,13 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads
Eigen3::Eigen
quill::quill
${OpenCV_LIBS}
${GeographicLib_LIBRARIES}
${ZED_LIBS}
RoveComm_CPP
)

## Package Executable
install(TARGETS ${PROJECT_NAME} RUNTIME_DEPENDENCIES DIRECTORIES ${OpenCV_LIBS} ${ZED_LIBS} quill::quill RoveComm_CPP RUNTIME DESTINATION bin)
install(TARGETS ${PROJECT_NAME} RUNTIME_DEPENDENCIES DIRECTORIES ${OpenCV_LIBS} ${GeographicLib_LIBRARIES} ${ZED_LIBS} quill::quill RoveComm_CPP RUNTIME DESTINATION bin)

## Unit/Integration Tests
file(GLOB_RECURSE UnitTests_SRC CONFIGURE_DEPENDS "tests/Unit/*.cc")
Expand All @@ -150,15 +155,15 @@ list(LENGTH IntegrationTests_SRC IntegrationTests_LEN)

if (UnitTests_LEN GREATER 0)
add_executable(${PROJECT_NAME}_UnitTests ${UnitTests_SRC} ${Logging_SRC})
target_link_libraries(${PROJECT_NAME}_UnitTests GTest::gtest GTest::gtest_main ${OpenCV_LIBS} quill::quill)
target_link_libraries(${PROJECT_NAME}_UnitTests GTest::gtest GTest::gtest_main quill::quill ${OpenCV_LIBS} ${GeographicLib_LIBRARIES})
add_test(Unit_Tests ${PROJECT_NAME}_UnitTests)
else()
message("No Unit Tests!")
endif()

if (IntegrationTests_LEN GREATER 0)
add_executable(${PROJECT_NAME}_IntegrationTests ${IntegrationTests_SRC} ${Logging_SRC})
target_link_libraries(${PROJECT_NAME}_IntegrationTests GTest::gtest GTest::gtest_main quill::quill)
target_link_libraries(${PROJECT_NAME}_IntegrationTests GTest::gtest GTest::gtest_main quill::quill ${OpenCV_LIBS} ${GeographicLib_LIBRARIES})
add_test(Integration_Tests ${PROJECT_NAME}_IntegrationTests)
else()
message("No Integration Tests!")
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Examples: `int g_nExampleGlobalInteger` or `int m_nExampleMemberInteger`
- Boost:
- State Chart > `sc` > Example: `sc::simple_state<IdleState, StateMachine>`
- Quill > `q` > Example: `quill::Config qConfig`
- GeographicLib > `ge` > Example: `GeographicLib::Geodesic geExampleGeographicType`

### Macro Names
Macros should be in all caps using underscores to separate words. They should be detailed enough to not require an additional comment.
Expand Down
23 changes: 23 additions & 0 deletions data/Custom_Dictionaries/Autonomy-Dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,42 @@ alloc
allocs
APRILTAG
Aruco
autofetch
arucotag
AUTONOMYTHREAD
BASICCAM
CALIB
clayjay
codeql
codezombiech
Coeffs
Colour
cpptools
cschlosser
CUDA
deadband
deque
Desaturate
devcontainer
diffdrive
doxdocgen
Doxygen
driveboard
Extention
feedforward
flightsticks
geoops
Geospatial
gmock
GPSMDRS
GPSSDELC
gruntfuggly
gtest
hyperthreaded
imgops
imread
imshow
jbockle
inferencing
jetpack
jspencerpittman
Expand All @@ -37,6 +51,7 @@ mainpage
MAPRANGE
Memcheck
microcontrollers
missourimrdt
MJPEG
MRDT
MULTIMEDIABOARD
Expand All @@ -55,9 +70,12 @@ reprojection
RESOLUTIONX
RESOLUTIONY
RGBE
Rolla
RIGHTCAM
rovecomm
searchbar
setpoint
setpoints
SIMCAM
statechart
Struct
Expand All @@ -67,13 +85,18 @@ Tele
tensorflowtag
threadpool
tparam
twxs
UART
UTMMDRS
UTMUPS
UNVALIDATED
valgrind
Watchpoints
wslg
XYZBGRA
XYZRGBA
YUVJ
YUYV
Zain
ZEDCAM
ZEDSDK
11 changes: 10 additions & 1 deletion src/AutonomyConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ namespace constants
const float DRIVE_MIN_EFFORT = -0.5;

// Control constants.
const bool DRIVE_SQUARE_CONTROL_INPUTS = false; // This is used by the DifferentialDrive algorithms. True makes fine inputs smoother, but less responsive.
const double DRIVE_PID_PROPORTIONAL = 0.1; // The proportional gain for the controller used to point the rover at a goal heading during navigation.
const double DRIVE_PID_INTEGRAL = 0.01; // The integral gain for the controller used to point the rover at a goal heading during navigation.
const double DRIVE_PID_DERIVATIVE = 0.0; // The derivative gain for the controller used to point the rover at a goal heading during navigation.
const double DRIVE_PID_MAX_ERROR_PER_ITER = 100; // The max allowable error the controller will see per iteration. This is on degrees from setpoint.
const double DRIVE_PID_MAX_INTEGRAL_TERM = 0.3; // The max effort the I term is allowed to contribute.
const double DRIVE_PID_MAX_OUTPUT_EFFORT = 0.5; // The max effort the entire PID controller is allowed to output. Range is within DRIVE_MAX/MIN_POWER.
const double DRIVE_PID_MAX_RAMP_RATE = 0.4; // The max ramp rate of the output of the PID controller.
const double DRIVE_PID_OUTPUT_FILTER = 0.0; // Larger values will filter out large spikes or oscillations. 0.1 is a good starting point.
const bool DRIVE_PID_OUTPUT_REVERSED = false; // Negates the output of the PID controller.
const bool DRIVE_SQUARE_CONTROL_INPUTS = false; // This is used by the DifferentialDrive algorithms. True makes fine inputs smoother, but less responsive.
const bool DRIVE_CURVATURE_KINEMATICS_ALLOW_TURN_WHILE_STOPPED = true; // This enabled turning in-place when using curvature drive control.
///////////////////////////////////////////////////////////////////////////

Expand Down
Loading