From cdfcf7922b00b0dcc15b57d444d61bad3fa32200 Mon Sep 17 00:00:00 2001 From: Abhay Deshpande Date: Thu, 28 Sep 2023 19:09:36 -0700 Subject: [PATCH] Install hindsightcan with fetchcontent (#262) * Install hindsightcan with fetchcontent * Update hindsightcan git tag --- src/CAN/CAN.cpp | 2 +- src/CAN/CANMotor.cpp | 6 +++--- src/CAN/CANMotor_AVR.cpp | 6 +++--- src/CAN/CANUtils.cpp | 2 +- src/CAN/FakeCANBoard.cpp | 2 +- src/CAN/TestIMU.cpp | 4 ++-- src/CMakeLists.txt | 11 +++++++++-- update_deps.sh | 2 +- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/CAN/CAN.cpp b/src/CAN/CAN.cpp index 6447b962f..13cde3dad 100644 --- a/src/CAN/CAN.cpp +++ b/src/CAN/CAN.cpp @@ -23,7 +23,7 @@ #include extern "C" { -#include "../HindsightCAN/CANCommon.h" +#include } using robot::types::DataPoint; diff --git a/src/CAN/CANMotor.cpp b/src/CAN/CANMotor.cpp index 59d23259e..ca7aef5fd 100644 --- a/src/CAN/CANMotor.cpp +++ b/src/CAN/CANMotor.cpp @@ -8,9 +8,9 @@ #include extern "C" { -#include "../HindsightCAN/CANCommon.h" -#include "../HindsightCAN/CANMotorUnit.h" -#include "../HindsightCAN/CANPacket.h" +#include +#include +#include } using namespace std::chrono_literals; diff --git a/src/CAN/CANMotor_AVR.cpp b/src/CAN/CANMotor_AVR.cpp index cdfff4f8b..e2e167b74 100644 --- a/src/CAN/CANMotor_AVR.cpp +++ b/src/CAN/CANMotor_AVR.cpp @@ -6,9 +6,9 @@ #include extern "C" { -#include "../HindsightCAN/CANCommon.h" -#include "../HindsightCAN/CANMotorUnit.h" -#include "../HindsightCAN/CANPacket.h" +#include +#include +#include } using namespace std::chrono_literals; diff --git a/src/CAN/CANUtils.cpp b/src/CAN/CANUtils.cpp index 3fd6a704e..0c9da84db 100644 --- a/src/CAN/CANUtils.cpp +++ b/src/CAN/CANUtils.cpp @@ -4,7 +4,7 @@ #include extern "C" { -#include "../HindsightCAN/CANPacket.h" +#include } namespace can { diff --git a/src/CAN/FakeCANBoard.cpp b/src/CAN/FakeCANBoard.cpp index 23ec9df9e..097deaf7c 100644 --- a/src/CAN/FakeCANBoard.cpp +++ b/src/CAN/FakeCANBoard.cpp @@ -12,7 +12,7 @@ #include extern "C" { -#include "../HindsightCAN/CANScience.h" +#include } using namespace std::chrono_literals; diff --git a/src/CAN/TestIMU.cpp b/src/CAN/TestIMU.cpp index abd573f9c..e364384c5 100644 --- a/src/CAN/TestIMU.cpp +++ b/src/CAN/TestIMU.cpp @@ -1,8 +1,8 @@ #include "../log.h" #include "CAN.h" extern "C" { -#include "../HindsightCAN/CANCommon.h" -#include "../HindsightCAN/CANSerialNumbers.h" +#include +#include } #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c968f6a60..c39dc4bec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,6 +6,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) project(Rover LANGUAGES CXX C) +include(FetchContent) + # If a build type was not explicitly specified, default to "RelWithDebInfo" (Same optimization # as the "Release" configuration but with debugging symbols). # @@ -109,7 +111,12 @@ find_package(nlohmann_json 3.2.0 REQUIRED) # Find the CAN library; contains packet and protocol definitions and does not # actually require physical CAN to be present. -find_package(HindsightCAN 1.4.0 REQUIRED) +FetchContent_Declare( + HindsightCAN + GIT_REPOSITORY https://github.com/huskyroboticsteam/HindsightCAN.git + GIT_TAG 7397787fbb04687bf03c8fbac9a1db56f245fc9a +) +FetchContent_MakeAvailable(HindsightCAN) find_package(Threads REQUIRED) find_package(OpenCV REQUIRED) @@ -197,7 +204,7 @@ else() CAN/CANStubs.cpp) endif() target_link_libraries(can_interface PUBLIC - HindsightCAN::HindsightCAN + HindsightCAN Threads::Threads utils ) diff --git a/update_deps.sh b/update_deps.sh index 2a3fdd0b8..11a599214 100755 --- a/update_deps.sh +++ b/update_deps.sh @@ -4,5 +4,5 @@ sudo apt update sudo apt install -y build-essential unzip gnupg2 lsb-release git \ cmake libeigen3-dev libopencv-dev libopencv-contrib-dev \ libwebsocketpp-dev libboost-system-dev gpsd gpsd-clients libgps-dev nlohmann-json3-dev \ - catch2 urg-lidar rplidar ublox-linux hindsight-can=1.4.0 frozen libargparse-dev libavutil-dev \ + catch2 urg-lidar rplidar ublox-linux frozen libargparse-dev libavutil-dev \ libx264-dev