From adb7085caf586e43b6921fb34df21f8a6852f166 Mon Sep 17 00:00:00 2001 From: Cody Li Date: Sat, 10 Jun 2023 16:10:25 -0700 Subject: [PATCH] Add support for new estops + up the min voltage for battery warnings (#2925) * estop * up min battery voltage * 22.6 is above nominal --- src/shared/constants.h | 2 +- src/software/thunderscope/robot_communication.py | 2 +- src/software/thunderscope/thunderscope_main.py | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/shared/constants.h b/src/shared/constants.h index 3256e797eb..dd7ad3a619 100644 --- a/src/shared/constants.h +++ b/src/shared/constants.h @@ -114,7 +114,7 @@ static const unsigned int MAX_ROBOT_IDS = MAX_ROBOT_IDS_PER_SIDE * 2; static const unsigned NUM_CELLS_IN_BATTERY = 3; static const unsigned NUM_BATTERIES_IN_SERIES = 2; static const double MAX_SINGLE_CELL_VOLTAGE = 4.2; -static const double MIN_SINGLE_CELL_VOLTAGE = 3.2 + 0.1; // +0.1v headroom +static const double MIN_SINGLE_CELL_VOLTAGE = 3.5 + 0.1; // +0.1v headroom static const double MIN_BATTERY_VOLTAGE = MIN_SINGLE_CELL_VOLTAGE * NUM_CELLS_IN_BATTERY * NUM_BATTERIES_IN_SERIES; diff --git a/src/software/thunderscope/robot_communication.py b/src/software/thunderscope/robot_communication.py index d7da226bf0..59ed2deec6 100644 --- a/src/software/thunderscope/robot_communication.py +++ b/src/software/thunderscope/robot_communication.py @@ -19,7 +19,7 @@ def __init__( multicast_channel, interface, disable_estop, - estop_path="/dev/ttyACM0", + estop_path, estop_buadrate=115200, ): """Initialize the communication with the robots diff --git a/src/software/thunderscope/thunderscope_main.py b/src/software/thunderscope/thunderscope_main.py index 6623eda0fb..e36a7e873b 100644 --- a/src/software/thunderscope/thunderscope_main.py +++ b/src/software/thunderscope/thunderscope_main.py @@ -257,11 +257,17 @@ # else, it will be the diagnostics proto current_proto_unix_io = tscope.proto_unix_io_map[ProtoUnixIOTypes.CURRENT] + # different estops use different ports this detects which one to use based on what is plugged in + estop_path = ( + "/dev/ttyACM0" if os.path.isfile("/dev/ttyACM0") else "/dev/ttyUSB0" + ) + with RobotCommunication( current_proto_unix_io, getRobotMulticastChannel(0), args.interface, args.disable_estop, + estop_path, ) as robot_communication: if args.run_diagnostics: for tab in tscope_config.tabs: