Skip to content

Commit

Permalink
Merge pull request #298 from Yaskawa-Global/MajorAlarmMessage
Browse files Browse the repository at this point in the history
Understandable message for /reset_error if major alarm is active
  • Loading branch information
gavanderhoorn authored Sep 10, 2024
2 parents 5820d8d + aef5d3b commit 7bac007
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
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");
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

0 comments on commit 7bac007

Please sign in to comment.