Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
da7032b
(wip) working on the json integration
RCMast3r Feb 2, 2025
63cc72e
added power limiting to simple controller and it builds now
KrishKittur Feb 7, 2025
bff9234
added test cases
KrishKittur Feb 7, 2025
4bfe03c
wip params
RCMast3r Feb 13, 2025
9c6d015
Initial TCMUX Commit
JohnNesbit Mar 2, 2025
0b51feb
erm, WIP
RCMast3r Mar 2, 2025
6e7ea4c
Standardize SE input, change nix DB core source
JohnNesbit Mar 2, 2025
5d979cd
progress
RCMast3r Mar 3, 2025
17bd2c2
WIP issues with integration segfaulting on schema get
RCMast3r Mar 5, 2025
002448c
Testing(does not compile)
JohnNesbit Mar 19, 2025
9febd94
Does not compile
JohnNesbit Mar 19, 2025
f690ec7
Fix type errors
JohnNesbit Mar 19, 2025
2ddc847
type errors
JohnNesbit Mar 19, 2025
e4c3110
Merge branch 'feature/param_rec' into dev/v1.1.0
RCMast3r Mar 31, 2025
90d84d5
integrated with simple controller that has power limitting integrated
RCMast3r Mar 31, 2025
2cb4d88
added comment
RCMast3r Mar 31, 2025
73ab49b
updating to latest branch of drivebrain core
RCMast3r Mar 31, 2025
d13c58d
TCMux integration test
goltsmannn Mar 31, 2025
dd58bc1
Added shared_ptr functionality to controllers
goltsmannn Mar 31, 2025
47cfa99
Merging with dev
goltsmannn Mar 31, 2025
7b8543a
Intermediate status commit
goltsmannn Mar 31, 2025
b4fedbc
Finally
goltsmannn Mar 31, 2025
dc19a14
.
goltsmannn Mar 31, 2025
1a6bb3f
discovering borked unit tests for drivebrain tc mux
RCMast3r Mar 31, 2025
d4c9292
working through fixing tests
RCMast3r Apr 1, 2025
2f18e18
fixing simple controller tests
RCMast3r Apr 1, 2025
db7d10c
bring back in previous changes
RCMast3r Apr 1, 2025
4d76db8
bringing up to speed
RCMast3r Apr 1, 2025
f669823
Removed redundant print
goltsmannn Apr 1, 2025
ffbb814
Commented tcmux test for now
goltsmannn Apr 1, 2025
bfb1fe7
Merge pull request #35 from hytech-racing/origin/TCMUXtmp
goltsmannn Apr 1, 2025
c48d546
DT_sec is now a param
goltsmannn Apr 3, 2025
d0f5b53
Removing redundancy
goltsmannn Apr 3, 2025
7dba369
adding more checks for ensuring that things have pointers
RCMast3r Apr 3, 2025
d8f9ceb
fixing allocation / shared pointer issues
RCMast3r Apr 3, 2025
dcb1a0f
Added set_msg_logger functionality, refactored unit tests
goltsmannn Apr 3, 2025
cc1949a
Merge branch 'dev/v1.1.0' of https://github.com/hytech-racing/drivebr…
goltsmannn Apr 3, 2025
7a7a3ef
erm, fixed bugs
RCMast3r Apr 3, 2025
58d1bc6
removed commented code and added info print
RCMast3r Apr 3, 2025
047aee6
Fixed thread infinite loop
goltsmannn Apr 3, 2025
c88502c
correct dbc can description
KrishKittur Apr 3, 2025
40f84c5
merge with dev/v1.1.0
KrishKittur Apr 3, 2025
394ebfc
bruh
KrishKittur Apr 4, 2025
267fc53
Merge pull request #37 from hytech-racing/fix/can_comms
KrishKittur Apr 4, 2025
e6176f7
tuning down the loop rate for better sending
RCMast3r Apr 4, 2025
3c74f9a
integrating second can and updating db core src
RCMast3r Apr 10, 2025
a4f30e9
ok
RCMast3r Apr 12, 2025
a858a8d
integrating acu eth comms
RCMast3r Apr 20, 2025
dd606ce
integrating ability to turn off vectornav
RCMast3r Apr 21, 2025
d39faaf
yo
RCMast3r Apr 29, 2025
05f7b84
working through required updates and debugging
RCMast3r May 9, 2025
889502e
switching to weak pointers for destruction capability for the configu…
RCMast3r May 9, 2025
4b0cc3d
generalized ethernet recv driver and used it to implement vcf and vcr…
RCMast3r May 9, 2025
873a395
removed todo
RCMast3r May 9, 2025
5a801a6
fixed dumb issue that caused stale message logger shared_ptr in drive…
RCMast3r May 9, 2025
365c183
working first TODO of the mcap replay done
RCMast3r May 10, 2025
fbadb7d
added in mcap replay that can replay onto a virtual CAN bus
RCMast3r May 10, 2025
8e07f02
Feature/replay eth (#40)
RCMast3r May 11, 2025
edcde4b
fixing unit tests for the controller manager and using new core versi…
RCMast3r May 11, 2025
d5d232a
updating to latest drivebrain_core
RCMast3r May 11, 2025
e3d250b
updating readme
RCMast3r May 11, 2025
073d85c
if the state is not valid, stop outputting the drivebrain commands. t…
RCMast3r May 11, 2025
1edc0cb
fixed name of drivebrain executable
RCMast3r May 11, 2025
8dbdbe0
Feature/aero driver integration (#43)
RCMast3r May 14, 2025
4a3b66e
speed tech comms working in test binary. To be tested on car with dri…
RCMast3r May 19, 2025
977ea98
Feature/vcr control copy (#44)
RCMast3r May 19, 2025
1e169f7
Feature/scale driver comms (#45)
RCMast3r May 19, 2025
bc0919f
mems, fixing copy paster error
RCMast3r May 19, 2025
ae8e044
fixing speedtech lap timer, forgot to init
RCMast3r May 21, 2025
d185477
fixing unit tests
RCMast3r May 22, 2025
6056096
Feature/simulink automation integration (#46)
RCMast3r May 23, 2025
fd6a828
adjusting to rename and integrating new pid tv with load cell and ste…
RCMast3r May 25, 2025
77160c8
added outport
RCMast3r May 25, 2025
58ad863
Feature/mm gend estimator integration (#47)
RCMast3r May 28, 2025
b43e706
updating to latest release of the simulink models
RCMast3r May 30, 2025
a708d18
updated to latest version
RCMast3r May 30, 2025
eb02447
Merge branch 'dev/v1.1.0' of github.com:hytech-racing/drivebrain_soft…
RCMast3r May 30, 2025
5695bed
cleaning up logging setup, fixing loop time and pulling in latest con…
RCMast3r May 30, 2025
28d4e87
Merge branch 'dev/v1.1.0' of github.com:hytech-racing/drivebrain_soft…
RCMast3r May 30, 2025
824f471
pulling in changes to core and HT_proto for energy meter data
RCMast3r May 30, 2025
596b217
adding in vcr sender to replay util
RCMast3r May 30, 2025
971ea2f
fixing mcapreplay util to be up to current ethsender
RCMast3r May 31, 2025
1dba68b
oops, wrong release
RCMast3r May 31, 2025
d150e85
fixing logging for speed tech comms
RCMast3r Jun 5, 2025
d449824
erm, just updating json file
RCMast3r Jun 6, 2025
0aa2b7f
updating to latest simulink gend release
RCMast3r Jun 7, 2025
a38fd7a
adding in debug statements
RCMast3r Jun 7, 2025
16f7015
erm
RCMast3r Jun 10, 2025
4932339
adding in inverter temps data
RCMast3r Jun 11, 2025
2a1dd9c
500ms timeout for CAN msgs
RCMast3r Jun 12, 2025
773e9f7
adding in min cell and latest release of controller with de-rating
RCMast3r Jun 12, 2025
bc3f61f
adding in pack voltage measurement to state estimator for propagation
RCMast3r Jun 14, 2025
67c485f
updated to latest hT_PROTO and HT_CAN
RCMast3r Jun 14, 2025
e09e9ce
updating to latest rel of db simulink
RCMast3r Jun 14, 2025
aaf09fd
removing unnessecary logging of drivebrain command and added in 1hz c…
RCMast3r Jun 14, 2025
602925f
added core data
KrishKittur Sep 11, 2025
7596035
update
KrishKittur Sep 21, 2025
8b021e8
missing .gz
KrishKittur Sep 21, 2025
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ core.*
result-man/
result-man
.cache/
*.dbc
*.dbc

compile_commands.json
*.log
142 changes: 117 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ configure_file(
@ONLY
)

## simulink codegend estimators and controllers
find_package(codegen CONFIG REQUIRED)

### this one is generated from nix-proto but using foxglove's
# find_package(foxglove-schemas_proto_cpp CONFIG REQUIRED)

Expand Down Expand Up @@ -56,9 +59,9 @@ find_package(drivebrain_core REQUIRED)

include(create_package)

#####################
# created libraries #
#####################
###################################
# created drivebrain sw libraries #
###################################

# utils
add_library(drivebrain_common_utils SHARED
Expand All @@ -82,8 +85,11 @@ add_library(drivebrain_comms SHARED
drivebrain_core_impl/drivebrain_comms/src/foxglove_server.cpp
drivebrain_core_impl/drivebrain_comms/src/CANComms.cpp
drivebrain_core_impl/drivebrain_comms/src/VNComms.cpp
drivebrain_core_impl/drivebrain_comms/src/MCUETHComms.cpp
drivebrain_core_impl/drivebrain_comms/src/DBServiceImpl.cpp
drivebrain_core_impl/drivebrain_comms/src/ETHSendComms.cpp
drivebrain_core_impl/drivebrain_comms/src/SurreyAeroComms.cpp
drivebrain_core_impl/drivebrain_comms/src/SpeedTechComms.cpp
drivebrain_core_impl/drivebrain_comms/src/ScaleComms.cpp
)

target_compile_features(drivebrain_comms PUBLIC cxx_std_17)
Expand All @@ -100,8 +106,10 @@ target_include_directories(drivebrain_comms PUBLIC
)

target_link_libraries(drivebrain_comms PUBLIC
codegen::matlab_model
drivebrain_core::drivebrain_core
drivebrain_common_utils
drivebrain_control
gRPC::grpc++_reflection
foxglove_websocket::foxglove_websocket
protobuf::libprotobuf
Expand All @@ -117,7 +125,13 @@ target_link_libraries(drivebrain_comms PUBLIC
make_cmake_package(drivebrain_comms drivebrain)


add_library(drivebrain_control SHARED drivebrain_core_impl/drivebrain_control/src/SimpleController.cpp)
add_library(drivebrain_control SHARED
drivebrain_core_impl/drivebrain_control/src/SimpleTorqueController.cpp
drivebrain_core_impl/drivebrain_control/src/SimpleSpeedController.cpp
drivebrain_core_impl/drivebrain_control/src/SimplePowerLimiter.cpp
drivebrain_core_impl/drivebrain_control/src/LoadCellVectoringTorqueController.cpp
)

# drivebrain_core_impl/drivebrain_control/include/SimpleController.hpp
target_include_directories(drivebrain_control PUBLIC
$<INSTALL_INTERFACE:drivebrain_core_impl/drivebrain_control/include>
Expand All @@ -128,18 +142,20 @@ target_link_libraries(drivebrain_control PUBLIC
drivebrain_core::drivebrain_core
hytech_np_proto_cpp::hytech_np_proto_cpp
protobuf::libprotobuf
drivebrain_common_utils
)

make_cmake_package(drivebrain_control drivebrain)

add_library(drivebrain_mcap_logger SHARED drivebrain_core_impl/drivebrain_mcap_logger/src/MCAPProtobufLogger.cpp)
add_library(drivebrain_mcap_logger SHARED drivebrain_core_impl/drivebrain_logging/src/DrivebrainMCAPLogger.cpp)
target_include_directories(drivebrain_mcap_logger PUBLIC
$<INSTALL_INTERFACE:drivebrain_core_impl/drivebrain_mcap_logger/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/drivebrain_core_impl/drivebrain_mcap_logger/include>
$<INSTALL_INTERFACE:drivebrain_core_impl/drivebrain_logging/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/drivebrain_core_impl/drivebrain_logging/include>
)

target_link_libraries(drivebrain_mcap_logger PUBLIC
drivebrain_core::drivebrain_core
codegen::matlab_model
drivebrain_common_utils
protobuf::libprotobuf
mcap::mcap
Expand All @@ -160,10 +176,19 @@ target_include_directories(drivebrain_estimation PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/drivebrain_core_impl/drivebrain_estimation/include>
)

target_link_libraries(drivebrain_estimation PUBLIC
drivebrain_core::drivebrain_core
drivebrain_common_utils
hytech_np_proto_cpp::hytech_np_proto_cpp
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
protobuf::libprotobuf
)

make_cmake_package(drivebrain_estimation drivebrain)

add_library(drivebrain_app SHARED
drivebrain_app/src/DriveBrainApp.cpp
drivebrain_app/src/arg_parse.cpp
)

target_include_directories(drivebrain_app PUBLIC
Expand All @@ -173,21 +198,38 @@ target_include_directories(drivebrain_app PUBLIC

target_link_libraries(drivebrain_app PUBLIC
drivebrain_core::drivebrain_core
codegen::matlab_model
drivebrain_control
drivebrain_comms
drivebrain_mcap_logger
Boost::program_options
)

target_link_libraries(drivebrain_estimation PUBLIC
drivebrain_core::drivebrain_core
drivebrain_common_utils
hytech_np_proto_cpp::hytech_np_proto_cpp
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
make_cmake_package(drivebrain_app drivebrain)

#####################################
# drivebrain util / debug libraries #
#####################################

add_library(drivebrain_utils SHARED
drivebrain_utils/src/MCAPReplay.cpp
)

target_include_directories(drivebrain_utils PUBLIC
$<INSTALL_INTERFACE:drivebrain_utils/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/drivebrain_utils/include>
)

target_link_libraries(drivebrain_utils PUBLIC
protobuf::libprotobuf
mcap::mcap
Boost::program_options
spdlog::spdlog
drivebrain_comms # CANDriver
)

make_cmake_package(drivebrain_app drivebrain)

make_cmake_package(drivebrain_utils drivebrain)

###############
# executables #
Expand All @@ -203,6 +245,11 @@ make_cmake_package(drivebrain_app drivebrain)
# Boost::boost
# )


add_executable(replay_app drivebrain_utils/src/replay_app.cpp)

target_link_libraries(replay_app PUBLIC drivebrain_utils)

add_executable(test_param_server test/test_param_server.cpp)

target_link_libraries(test_param_server PUBLIC
Expand All @@ -211,6 +258,26 @@ target_link_libraries(test_param_server PUBLIC
zstd::libzstd_shared
)

add_executable(test_surrey_aero_comms test/test_surrey_aero_comms.cpp)

target_link_libraries(test_surrey_aero_comms PUBLIC
drivebrain_comms
)

add_executable(test_speedtech_comms test/test_speedtech_comms.cpp)

target_link_libraries(test_speedtech_comms PUBLIC
drivebrain_comms
)



add_executable(test_scale_comms test/test_scale_comms.cpp)

target_link_libraries(test_scale_comms PUBLIC
drivebrain_comms
)

# add_executable(test_dbcan test/test_dbcan.cpp)

# target_link_libraries(test_dbcan PUBLIC
Expand All @@ -237,6 +304,14 @@ target_link_libraries(test_db_grpc PUBLIC
gRPC::grpc++_reflection
)

add_executable(test_config_schema test/test_configurable.cpp)

target_link_libraries(test_config_schema PRIVATE
drivebrain_core::drivebrain_core
drivebrain_mcap_logger
drivebrain_comms
)


add_executable(test_mcap test/test_mcap/test_mcap_logging.cpp test/test_mcap/BuildFileDescriptorSet.cpp)

Expand All @@ -260,21 +335,25 @@ target_compile_features(test_vn PUBLIC cxx_std_11)
### system executable ###
### ###

add_executable(alpha_build
add_executable(drivebrain_exe
drivebrain_app/main.cpp
)

# Add include directory for DriveBrainApp header
target_include_directories(alpha_build PRIVATE
target_include_directories(drivebrain_exe PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/drivebrain_app
)
target_link_libraries(alpha_build PUBLIC

enable_testing()

target_link_libraries(drivebrain_exe PUBLIC
drivebrain_app
drivebrain_core::drivebrain_core
drivebrain_control
drivebrain_comms
drivebrain_mcap_logger
Boost::program_options
codegen::matlab_model
)

add_executable(test_build
Expand All @@ -291,23 +370,23 @@ target_link_libraries(test_build PUBLIC

enable_testing()

add_executable(alpha_test
add_executable(drivebrain_test
unit_test/main.cpp
unit_test/SimpleControllerTest.cpp
unit_test/SimpleSpeedControllerTest.cpp
unit_test/SimpleTorqueControllerTest.cpp
unit_test/test_controller_manager.cpp
unit_test/ControllerTesting.cpp
)




target_link_libraries(alpha_test PUBLIC
target_link_libraries(drivebrain_test PUBLIC
drivebrain_core::drivebrain_core
drivebrain_control
drivebrain_comms
Boost::program_options
gtest
)

add_test(NAME MyTest COMMAND alpha_test)
add_test(NAME Drivebrain_Tests COMMAND drivebrain_test)

target_link_libraries(mcu_standin PUBLIC
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
Expand All @@ -317,8 +396,21 @@ target_link_libraries(mcu_standin PUBLIC

include(GNUInstallDirs)
install(TARGETS
alpha_build
drivebrain_exe
test_param_server
test_build
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR})


add_executable(TCMUX_integration_test test/controller_manager_integration.cpp)

target_link_libraries(
TCMUX_integration_test PUBLIC
hytech_np_proto_cpp::hytech_np_proto_cpp
drivebrain_core_msgs_proto_cpp::drivebrain_core_msgs_proto_cpp
drivebrain_core::drivebrain_core
drivebrain_control
Boost::boost
drivebrain_app
)
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# execution

```bash
./build/drivebrain_exe -h
Allowed options:
-h [ --help ] produce help message
-p [ --param-path ] arg Path to the parameter JSON file
-d [ --dbc-path ] arg Path to the DBC file (optional)
-c [ --2-can ] arg use secondary CAN
```

```bash
./build/replay_app -h
Allowed options:
-h [ --help ] produce help message
-m [ --mcap ] arg Path to mcap file
-c [ --config ] arg Path to config file
-d [ --dbc ] arg Path to dbc file
```
- drivebrain:
```
./build/drivebrain_exe -p ./config/drivebrain_config.json -d ./config/hytech.dbc -c false
```

- replay app:

```bash
./build/replay_app -m <path_to_car_recorded_mcap_file> -c ./config/drivebrain_config.json -d ./config/hytech.dbc
```

## `grpcui` connection for start/stop recording and switching controllers in devshell

within the devshell:
```bash
grpcui -plaintext localhost:6969
```
# About

This repo contains the main executable that runs on the Drivebrain embedded computer on HyTech Racing's cars. This code is deployed as a `systemd` service onto the car within HyTech's [raspberry pi nixos description](https://github.com/hytech-racing/hytech_nixos). This service handles, among other things:
Expand Down Expand Up @@ -115,4 +151,24 @@ example `c_cpp_properties.json` file to be placed in your `.vscode/`:
],
"version": 4
}
```

## debugging example `launch.json`

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "cppdbg", // use "cppdbg" with gdb on Linux
"request": "launch",
"program": "${workspaceFolder}/build/drivebrain_exe",
"args": ["-p", "./config/drivebrain_config.json", "-d", "./config/hytech.dbc", "-c", "false"],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
}
]
}
```
11 changes: 11 additions & 0 deletions cmake/drivebrain_utilsConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

find_dependency(mcap)
find_dependency(fmt)
find_dependency(spdlog)
find_dependency(protobuf)
find_dependency(Boost COMPONENTS program_options)

include("${CMAKE_CURRENT_LIST_DIR}/drivebrain_utilsTargets.cmake")
14 changes: 14 additions & 0 deletions config/config_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ConfigureableTest" :
{
"test_float": 1.0,
"test_bool": false,
"test_double": 2.0,
"test_string": "asdf",
"test_int": 2
},
"asdf2":
{
"test_val": 3.0
}
}
Loading
Loading