Skip to content

Commit

Permalink
Merge branch 'main' into MotionControl_error_codes
Browse files Browse the repository at this point in the history
  • Loading branch information
ted-miller authored Sep 16, 2024
2 parents 1701717 + 7bac007 commit 5f5fde4
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci_msbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ jobs:
shell: bash
run: echo "C:/build/mpsdk" >> $GITHUB_PATH

- name: Register mpBuilder problem matcher
run: echo "::add-matcher::motoros2/.github/matchers/mpbuilder.json"

- name: "Build MotoROS2 (config: ${{ steps.uppercaser.outputs.ctrlr }}_${{ matrix.uros.codename }})"
shell: cmd
env:
Expand Down
12 changes: 6 additions & 6 deletions src/ConfigFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,14 @@ void Ros_ConfigFile_Parse()

Ros_ConfigFile_SetAllDefaultValues();

#if defined (YRC1000) || defined (YRC1000u)
//config file always resides on USB for DX200/FS100, so only check
//on YRC1000 and micro
Ros_ConfigFile_CheckUsbForNewConfigFile();
#endif

do
{
#if defined (FS100) || defined (YRC1000) || defined (YRC1000u)
//config file always resides on USB for DX200, so only check
//on YRC1000 and micro
Ros_ConfigFile_CheckUsbForNewConfigFile();
#endif

if (!bOkToInit)
Ros_Sleep(3000);

Expand Down
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 @@ -72,6 +72,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;
case MOTION_NOT_READY_ECO_MODE:
return motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_ECO_MODE_STR;
case MOTION_NOT_READY_SERVO_ON_TIMEOUT:
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,
MOTION_NOT_READY_ECO_MODE = motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_ECO_MODE,
MOTION_NOT_READY_SERVO_ON_TIMEOUT = motoros2_interfaces__msg__MotionReadyEnum__NOT_READY_SERVO_ON_TIMEOUT,
} MotionNotReadyCode;
Expand Down
12 changes: 10 additions & 2 deletions 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 Expand Up @@ -123,5 +131,5 @@ void Ros_ServiceResetError_Trigger(const void* request_msg, void* response_msg)
response->result_code.value = MOTION_READY;

DONE:
Ros_Debug_BroadcastMsg("reset: %s", response->message);
Ros_Debug_BroadcastMsg("reset: %s", response->message.data);
}
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void RosInitTask()
if (tickNow > tickBefore)
tickDiff = tickNow - tickBefore;
else //unsigned rollover
tickDiff = (UINT_MAX - tickBefore) + tickNow;
tickDiff = (ULONG_MAX - tickBefore) + tickNow;

float elapsedMs = tickDiff * mpGetRtc(); //time it took to read and publish data

Expand Down

0 comments on commit 5f5fde4

Please sign in to comment.