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

Ros2 motor enable fix #478

Merged
merged 3 commits into from
Jan 10, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ void LynxSystem::UpdateFlagErrors()
if (driver_data.IsFlagError()) {
RCLCPP_WARN_STREAM_THROTTLE(
logger_, steady_clock_, 1000,
"Error state on the default driver: " << driver_data.GetFlagErrorLog());
"Driver in error state:\n"
<< driver_data.GetFlagErrorLog());
roboteq_error_filter_->UpdateError(ErrorsFilterIds::ROBOTEQ_DRIVER, true);

HandleRobotDriverWriteOperation([this] { robot_driver_->AttemptErrorFlagReset(); });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,20 @@ void PantherSystem::UpdateFlagErrors()
const auto front_driver_data = robot_driver_->GetData(DriverNames::FRONT);
const auto rear_driver_data = robot_driver_->GetData(DriverNames::REAR);
if (front_driver_data.IsFlagError() || rear_driver_data.IsFlagError()) {
RCLCPP_WARN_STREAM_THROTTLE(
logger_, steady_clock_, 1000,
"Error state on one of the drivers:\n"
<< "\tFront: " << front_driver_data.GetFlagErrorLog()
<< "\tRear: " << rear_driver_data.GetFlagErrorLog());
if (front_driver_data.IsFlagError()) {
RCLCPP_WARN_STREAM_THROTTLE(
logger_, steady_clock_, 1000,
"Front driver in error state:\n"
<< front_driver_data.GetFlagErrorLog());
}

if (rear_driver_data.IsFlagError()) {
RCLCPP_WARN_STREAM_THROTTLE(
logger_, steady_clock_, 1000,
"Rear driver in error state:\n"
<< rear_driver_data.GetFlagErrorLog());
}

roboteq_error_filter_->UpdateError(ErrorsFilterIds::ROBOTEQ_DRIVER, true);

HandleRobotDriverWriteOperation([this] { robot_driver_->AttemptErrorFlagReset(); });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,29 @@ const RuntimeError & DriverData::GetRuntimeError(const std::uint8_t channel) con

std::string DriverData::GetFlagErrorLog() const
{
return "Fault flags: " + fault_flags_.GetErrorLog() +
"Script flags: " + script_flags_.GetErrorLog() +
"Channel 1 motor runtime flags: " + channel_1_runtime_error_.GetErrorLog() +
"Channel 2 motor runtime flags: " + channel_2_runtime_error_.GetErrorLog();
std::string error_log;

if (!fault_flags_.GetErrorLog().empty()) {
error_log += "Fault Flags: " + fault_flags_.GetErrorLog() + "\n";
}

if (!script_flags_.GetErrorLog().empty()) {
error_log += "Script Flags: " + script_flags_.GetErrorLog() + "\n";
}

if (!channel_1_runtime_error_.GetErrorLog().empty()) {
error_log += "Channel 1 Motor Runtime Flags: " + channel_1_runtime_error_.GetErrorLog() + "\n";
}

if (!channel_2_runtime_error_.GetErrorLog().empty()) {
error_log += "Channel 2 Motor Runtime Flags: " + channel_2_runtime_error_.GetErrorLog() + "\n";
}

if (!error_log.empty() && error_log.back() == '\n') {
error_log.pop_back();
}

return error_log;
}

std::map<std::string, bool> DriverData::GetFlagErrorMap() const
Expand Down
Loading