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

Understandable message for /reset_error if major alarm is active #298

Merged
merged 1 commit into from
Sep 10, 2024
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
5 changes: 5 additions & 0 deletions src/ControllerStatusIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ BOOL Ros_Controller_IsAlarm()
|| (g_Ros_Controller.ioStatus[IO_ROBOTSTATUS_ALARM_USER]!=0) );
}

BOOL Ros_Controller_IsMajorAlarm()
{
return ((g_Ros_Controller.ioStatus[IO_ROBOTSTATUS_ALARM_MAJOR] != 0));
}

BOOL Ros_Controller_IsError()
{
return ((g_Ros_Controller.ioStatus[IO_ROBOTSTATUS_ERROR]!=0));
Expand Down
1 change: 1 addition & 0 deletions src/ControllerStatusIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ extern void Ros_Controller_StatusInit();
extern BOOL Ros_Controller_StatusRead(USHORT ioStatus[IO_ROBOTSTATUS_MAX]);
extern BOOL Ros_Controller_IoStatusUpdate();
extern BOOL Ros_Controller_IsAlarm();
extern BOOL Ros_Controller_IsMajorAlarm();
extern BOOL Ros_Controller_IsError();
extern BOOL Ros_Controller_IsPlay();
extern BOOL Ros_Controller_IsTeach();
Expand Down
2 changes: 2 additions & 0 deletions src/ErrorHandling.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const char* const Ros_ErrorHandling_MotionNotReadyCode_ToString(MotionNotReadyCo
return motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_OTHER_TRAJ_MODE_ACTIVE_STR;
case MOTION_NOT_READY_NOT_CONT_CYCLE_MODE:
return motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_NOT_CONT_CYCLE_MODE_STR;
case MOTION_NOT_READY_MAJOR_ALARM:
return motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_MAJOR_ALARM_STR;
default:
return motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_UNSPECIFIED_STR;
}
Expand Down
1 change: 1 addition & 0 deletions src/ErrorHandling.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef enum
MOTION_NOT_READY_OTHER_PROGRAM_RUNNING = motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_OTHER_PROGRAM_RUNNING,
MOTION_NOT_READY_OTHER_TRAJ_MODE_ACTIVE = motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_OTHER_TRAJ_MODE_ACTIVE,
MOTION_NOT_READY_NOT_CONT_CYCLE_MODE = motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_NOT_CONT_CYCLE_MODE,
MOTION_NOT_READY_MAJOR_ALARM = motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_MAJOR_ALARM,
} MotionNotReadyCode;

typedef enum
Expand Down
10 changes: 9 additions & 1 deletion src/ServiceResetError.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ void Ros_ServiceResetError_Trigger(const void* request_msg, void* response_msg)
}
}

// Check for condition that can be fixed remotely
// Major alarms cannot be reset remotely
if (Ros_Controller_IsMajorAlarm())
{
rosidl_runtime_c__String__assign(&response->message, "Major alarm active. Cannot be reset. Check teach pendant");
jimmy-mcelwain marked this conversation as resolved.
Show resolved Hide resolved
response->result_code.value = MOTION_NOT_READY_MAJOR_ALARM;
goto DONE;
}

// Other alarm types can be reset remotely
if (Ros_Controller_IsAlarm())
{
// Reset alarm
Expand Down
Loading