Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion environment_setup/ubuntu20_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible-lint==25.7.0
ansible-lint==25.8.1
pyqtgraph==0.13.7
pyqt6==6.6.1
PyQt6-Qt6==6.6.1
Expand Down
2 changes: 1 addition & 1 deletion environment_setup/ubuntu22_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible-lint==25.7.0
ansible-lint==25.8.1
pyqtgraph==0.13.7
pyqt6==6.6.1
PyQt6-Qt6==6.6.1
Expand Down
2 changes: 1 addition & 1 deletion environment_setup/ubuntu24_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible-lint==25.7.0
ansible-lint==25.8.1
pyqtgraph==0.13.7
thefuzz==0.19.0
iterfzf==0.5.0.20.0
Expand Down
2 changes: 0 additions & 2 deletions src/proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ proto_library(
srcs = [
"ball.proto",
"game_state.proto",
"geneva_slot.proto",
"geometry.proto",
"ip_notification.proto",
"parameters.proto",
Expand Down Expand Up @@ -50,7 +49,6 @@ py_proto_library(
"ball.proto",
"estop_state.proto",
"game_state.proto",
"geneva_slot.proto",
"geometry.proto",
"ip_notification.proto",
"parameters.proto",
Expand Down
12 changes: 0 additions & 12 deletions src/proto/geneva_slot.proto

This file was deleted.

36 changes: 7 additions & 29 deletions src/proto/message_translation/power_frame_msg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,13 @@ void inline setPowerMsg(TbotsProto_PowerFrame& frame,
*
* @return a nanopb power status msg with provided fields
*/
TbotsProto_PowerStatus inline createNanoPbPowerStatus(
float battery_voltage, float capacitor_voltage, float current_draw,
TbotsProto_Geneva_Slot geneva_slot, uint32_t sequence_num, bool breakbeam_tripped)
TbotsProto_PowerStatus inline createNanoPbPowerStatus(float battery_voltage,
float current_draw,
uint32_t sequence_num,
bool breakbeam_tripped)
{
TbotsProto_PowerStatus status = {.battery_voltage = battery_voltage,
.capacitor_voltage = capacitor_voltage,
.current_draw = current_draw,
.geneva_slot = geneva_slot,
.sequence_num = sequence_num,
.breakbeam_tripped = breakbeam_tripped};
return status;
Expand Down Expand Up @@ -198,26 +197,6 @@ TbotsProto_PowerPulseControl inline createNanoPbPowerPulseControl(
default:
break;
}
switch (power_control.geneva_slot())
{
case TbotsProto::Geneva::LEFT:
nanopb_control.geneva_slot = TbotsProto_Geneva_Slot_LEFT;
break;
case TbotsProto::Geneva::CENTRE_LEFT:
nanopb_control.geneva_slot = TbotsProto_Geneva_Slot_CENTRE_LEFT;
break;
case TbotsProto::Geneva::CENTRE:
nanopb_control.geneva_slot = TbotsProto_Geneva_Slot_CENTRE;
break;
case TbotsProto::Geneva::CENTRE_RIGHT:
nanopb_control.geneva_slot = TbotsProto_Geneva_Slot_CENTRE_RIGHT;
break;
case TbotsProto::Geneva::RIGHT:
nanopb_control.geneva_slot = TbotsProto_Geneva_Slot_RIGHT;
break;
default:
break;
}
return nanopb_control;
}
/**
Expand All @@ -229,12 +208,12 @@ TbotsProto_PowerPulseControl inline createNanoPbPowerPulseControl(
TbotsProto_PowerPulseControl inline createNanoPbPowerPulseControl(
ChickerCommandMode chicker_command, uint32_t kick_pulse_width,
uint32_t chip_pulse_width, AutoChipOrKickMode auto_chip_or_kick,
uint32_t autochip_pulse_width, uint32_t autokick_pulse_width,
TbotsProto_Geneva_Slot geneva_slot)
uint32_t autochip_pulse_width, uint32_t autokick_pulse_width)
{
TbotsProto_PowerPulseControl control = TbotsProto_PowerPulseControl_init_default;
TbotsProto_PowerPulseControl_ChickerControl chicker =
TbotsProto_PowerPulseControl_ChickerControl_init_default;

switch (chicker_command)
{
case ChickerCommandMode::CHIP:
Expand Down Expand Up @@ -272,8 +251,7 @@ TbotsProto_PowerPulseControl inline createNanoPbPowerPulseControl(
break;
}

control.chicker = chicker;
control.geneva_slot = geneva_slot;
control.chicker = chicker;

return control;
}
Expand Down
6 changes: 3 additions & 3 deletions src/proto/power_frame_msg.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ syntax = "proto3";
package TbotsProto;

import "proto/robot_status_msg.proto";
import "proto/geneva_slot.proto";

// This is used on the robots. Similar proto in primitive.proto but with m_per_s instead
// of pulse width
Expand All @@ -28,8 +27,9 @@ message PowerPulseControl
}
}

ChickerControl chicker = 1;
Geneva.Slot geneva_slot = 2;
ChickerControl chicker = 1;

reserved 2;
}

message PowerFrame
Expand Down
6 changes: 3 additions & 3 deletions src/proto/primitive.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package TbotsProto;

import "google/protobuf/descriptor.proto";
import "proto/geometry.proto";
import "proto/geneva_slot.proto";
import "proto/tbots_timestamp_msg.proto";

extend google.protobuf.EnumValueOptions
Expand Down Expand Up @@ -95,8 +94,9 @@ message PowerControl
};
}

ChickerControl chicker = 1;
Geneva.Slot geneva_slot = 2;
ChickerControl chicker = 1;

reserved 2;
}

message Primitive
Expand Down
21 changes: 11 additions & 10 deletions src/proto/robot_status_msg.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ syntax = "proto3";
package TbotsProto;

import "proto/tbots_timestamp_msg.proto";
import "proto/geneva_slot.proto";
import "proto/geometry.proto";

message RobotStatus
Expand Down Expand Up @@ -142,15 +141,17 @@ message NetworkStatus
uint32 primitive_packet_loss_percentage = 3;
}

/* Battery and capacitor voltages */
/* Data from power board about battery voltages and current draw */
message PowerStatus
{
// The voltage on the robot’s battery, in volts.
float battery_voltage = 1;
float capacitor_voltage = 2;
// voltage on the robot’s capacitor, in volts.
float current_draw = 3;
Geneva.Slot geneva_slot = 4;
uint32 sequence_num = 5;
bool breakbeam_tripped = 6;
reserved 2, 4;

// The voltage on the robot’s battery, in volts
float battery_voltage = 1;

// The current draw on the robot's battery, in amps
float current_draw = 3;

uint32 sequence_num = 5;
bool breakbeam_tripped = 6;
}
7 changes: 1 addition & 6 deletions src/shared/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,7 @@ static const double MAX_BATTERY_VOLTAGE =
MAX_SINGLE_CELL_VOLTAGE * NUM_CELLS_IN_BATTERY * NUM_BATTERIES_IN_SERIES;
static const double BATTERY_WARNING_VOLTAGE = MIN_BATTERY_VOLTAGE + 1.0; // 1V headroom

// Chick Capacitor Constants
static const double MIN_CAPACITOR_VOLTAGE = 0;
static const double MAX_CAPACITOR_VOLTAGE = 250.0 + 50.0; // +50v headroom

// Chicker Constants
static const unsigned int ROBOT_CHIP_ANGLE_DEGREES = 45;
static const double CHICKER_TIMEOUT = 3 * MILLISECONDS_PER_SECOND;

Expand Down Expand Up @@ -224,7 +221,5 @@ static const char ARDUINO_PRODUCT_ID[ARDUINO_ID_LENGTH] = "0043";
// Number of times thunderloop should tick per second
static const unsigned THUNDERLOOP_HZ = 300u;

static const unsigned NUM_GENEVA_ANGLES = 5;

// Jetson Nano Constants
static const double MAX_JETSON_TEMP_C = 97;
6 changes: 3 additions & 3 deletions src/shared/uart_framing/uart_framing_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ class UartFramingTest : public ::testing::Test
protected:
void SetUp() override
{
test_message = createNanoPbPowerPulseControl(
ChickerCommandMode::AUTOCHIPORKICK, 1.0, 2.0, AutoChipOrKickMode::AUTOCHIP,
3.0, 4.0, TbotsProto_Geneva_Slot_LEFT);
test_message =
createNanoPbPowerPulseControl(ChickerCommandMode::AUTOCHIPORKICK, 1.0, 2.0,
AutoChipOrKickMode::AUTOCHIP, 3.0, 4.0);
}

TbotsProto_PowerPulseControl test_message;
Expand Down
1 change: 0 additions & 1 deletion src/software/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const std::string ROBOT_KICK_EXP_COEFF_REDIS_KEY = "/kick_coeff";
const std::string ROBOT_CHIP_PULSE_WIDTH_REDIS_KEY = "/chip_pulse_width";
const std::string ROBOT_CURRENT_DRAW_REDIS_KEY = "/current_draw";
const std::string ROBOT_BATTERY_VOLTAGE_REDIS_KEY = "/battery_voltage";
const std::string ROBOT_CAPACITOR_VOLTAGE_REDIS_KEY = "/cap_voltage";

const std::string SSL_VISION_ADDRESS = "224.5.23.2";
static constexpr unsigned int SSL_VISION_PORT = 10020;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
echo: false

- name: Flashing... (this will take a while on the first run)
ansible.builtin.command: "/opt/tbotspython/bin/platformio run --disable-auto-clean -t nobuild -t upload -d ~/powerloop/power"
ansible.builtin.command: "/opt/tbotspython/bin/platformio run --disable-auto-clean -t nobuild -t upload -d ~/powerloop/host/bin/software/power"
register: result
changed_when: true

Expand Down
2 changes: 1 addition & 1 deletion src/software/embedded/ansible/requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ansible==10.5.0
ansible==11.9.0
12 changes: 6 additions & 6 deletions src/software/embedded/ansible/requirements_lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#
# bazel run //software/embedded/ansible:requirements.update
#
ansible==10.5.0 \
--hash=sha256:1d10bddba58f1edd0fe0b8e0387e0fafc519535066bb3c919c33b6ea3ec32a0f \
--hash=sha256:ba2045031a7d60c203b6e5fe1f8eaddd53ae076f7ada910e636494384135face
ansible==11.9.0 \
--hash=sha256:528ca5a408f11cf1fea00daea7570e68d40e167be38b90c119a7cb45729e4921 \
--hash=sha256:79b087ef38105b93e0e092e7013a0f840e154a6a8ce9b5fddd1b47593adc542a
# via -r software/embedded/ansible/requirements.in
ansible-core==2.17.5 \
--hash=sha256:10f165b475cf2bc8d886e532cadb32c52ee6a533649793101d3166bca9bd3ea3 \
--hash=sha256:ae7f51fd13dc9d57c9bcd43ef23f9c255ca8f18f4b5c0011a4f9b724d92c5a8e
ansible-core==2.18.8 \
--hash=sha256:b0766215a96a47ce39933d27e1e996ca2beb54cf1b3907c742d35c913b1f78cd \
--hash=sha256:b60bc23b2f11fd0559a79d10ac152b52f58a18ca1b7be0a620dfe87f34ced689
# via ansible
cffi==1.16.0 \
--hash=sha256:0c9ef6ff37e974b73c25eecc13952c55bceed9112be2d9d938ded8e856138bcc \
Expand Down
8 changes: 4 additions & 4 deletions src/software/embedded/ansible/tasks/setup_systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
dest: ~/thunderbots_binaries/
copy_links: true

- name: Compute Thunderloop MD5 Hash
ansible.builtin.command: "/home/{{ ansible_user }}/hash_thunderloop_binary.sh"
register: result
changed_when: true
# - name: Compute Thunderloop MD5 Hash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems accidental

# ansible.builtin.command: "/home/{{ ansible_user }}/hash_thunderloop_binary.sh"
# register: result
# changed_when: true

- name: Sync Thunderloop systemd file
become_method: ansible.builtin.sudo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ def get_current_draw(self) -> str:
def get_battery_volt(self) -> str:
return str(self.redis.get(ROBOT_BATTERY_VOLTAGE_REDIS_KEY))

def get_cap_volt(self) -> str:
return str(self.redis.get(ROBOT_CAPACITOR_VOLTAGE_REDIS_KEY))

def __clamp(self, val: float, min_val: float, max_val: float) -> float:
"""Simple Math Clamp function (Faster than numpy & fewer dependencies)
:param val: Value to clamp
Expand Down Expand Up @@ -117,7 +114,6 @@ def get_chip_primitive(self, auto: bool, distance: float) -> Primitive:
def get_zero_power_control_primitive(self) -> Primitive:
"""Creates a PowerControl primitive with zeroed/default base values"""
power_control_primitive = PowerControl()
power_control_primitive.geneva_slot = Slot.CENTRE_RIGHT
return power_control_primitive

def get_zero_motor_control_primitive(self) -> Primitive:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ def __generate_redis_table(self) -> Table:
f"{ROBOT_CURRENT_DRAW_REDIS_KEY}",
self.embedded_data.get_current_draw(),
)
table.add_row(
"Capacitor Voltage",
f"{ROBOT_CAPACITOR_VOLTAGE_REDIS_KEY}",
self.embedded_data.get_cap_volt(),
)
return table

def stats(self) -> None:
Expand Down
4 changes: 0 additions & 4 deletions src/software/embedded/services/robot_auto_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ int main(int argc, char **argv)
{
LOG(WARNING) << "Battery voltage is zero";
}
else if (abs(power_status.capacitor_voltage()) < THRESHOLD)
{
LOG(WARNING) << "Capacitor voltage is zero";
}
else if (abs(power_status.current_draw()) < THRESHOLD)
{
LOG(WARNING) << "Current draw is zero";
Expand Down
25 changes: 12 additions & 13 deletions src/software/embedded/thunderloop.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems accidental

Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ Thunderloop::Thunderloop(const RobotConstants_t& robot_constants, bool enable_lo
LOG(INFO)
<< "THUNDERLOOP: Power Service initialized! Next initializing Motor Service";

motor_service_ = std::make_unique<MotorService>(robot_constants, loop_hz);
g_motor_service = motor_service_.get();
motor_service_->setup();
LOG(INFO) << "THUNDERLOOP: Motor Service initialized!";
// motor_service_ = std::make_unique<MotorService>(robot_constants, loop_hz);
// g_motor_service = motor_service_.get();
// motor_service_->setup();
// LOG(INFO) << "THUNDERLOOP: Motor Service initialized!";

LOG(INFO) << "THUNDERLOOP: finished initialization with ROBOT ID: " << robot_id_
<< ", CHANNEL ID: " << channel_id_
Expand Down Expand Up @@ -289,6 +289,8 @@ void Thunderloop::runLoop()

// Power Service: execute the power control command
power_status_ = pollPowerService(poll_time);
LOG(INFO) << "Thunderloop: Poll PowerService: "
<< power_status_.DebugString();
thunderloop_status_.set_power_service_poll_time_ms(
getMilliseconds(poll_time));

Expand Down Expand Up @@ -328,8 +330,9 @@ void Thunderloop::runLoop()
}

// Motor Service: execute the motor control command
motor_status_ = pollMotorService(poll_time, direct_control_.motor_control(),
time_since_prev_iter);
// motor_status_ = pollMotorService(poll_time,
// direct_control_.motor_control(),
// time_since_prev_iter);
thunderloop_status_.set_motor_service_poll_time_ms(
getMilliseconds(poll_time));

Expand All @@ -340,9 +343,9 @@ void Thunderloop::runLoop()
// Update Robot Status with poll responses
robot_status_.set_robot_id(robot_id_);
robot_status_.set_last_handled_primitive_set(last_handled_primitive_set);
*(robot_status_.mutable_time_sent()) = time_sent_;
*(robot_status_.mutable_thunderloop_status()) = thunderloop_status_;
*(robot_status_.mutable_motor_status()) = motor_status_.value();
*(robot_status_.mutable_time_sent()) = time_sent_;
*(robot_status_.mutable_thunderloop_status()) = thunderloop_status_;
//*(robot_status_.mutable_motor_status()) = motor_status_.value();
*(robot_status_.mutable_power_status()) = power_status_;
*(robot_status_.mutable_jetson_status()) = jetson_status_;
*(robot_status_.mutable_network_status()) = network_status_;
Expand Down Expand Up @@ -491,10 +494,6 @@ void Thunderloop::updateErrorCodes()
{
robot_status_.mutable_error_code()->Add(TbotsProto::ErrorCode::LOW_BATTERY);
}
if (power_status_.capacitor_voltage() >= MAX_CAPACITOR_VOLTAGE)
{
robot_status_.mutable_error_code()->Add(TbotsProto::ErrorCode::HIGH_CAP);
}
if (jetson_status_.cpu_temperature() >= MAX_JETSON_TEMP_C)
{
robot_status_.mutable_error_code()->Add(TbotsProto::ErrorCode::HIGH_BOARD_TEMP);
Expand Down
Loading
Loading