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

New service: allow retrieving information about active alarms and/or errors #182

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

gavanderhoorn
Copy link
Collaborator

As per title really.

Should fix #14 -- or at least for a large part.

Interface definitions are discussed in Yaskawa-Global/motoros2_interfaces#9. Some of the fields in that service/message definition are not populated/set by the implementation in this PR. I wanted to get a basic implementation reviewed + merged before potentially working on some of the more involved parts (such as retrieving cause-remedy pairs from PP data files).

The current implementation works, at least as tested on my YRC1. There is a single issue to iron out, which is that the underlying infrastructure (from M+) has trouble reporting multiple concurrently active user alarms correctly. Alarm and error codes + subcodes will be correct, but the message will not be. This is a known issue and is solved in newer releases of the controller OS.

This doesn't necessarily need to go into 0.1.2, so reviews can be done later.

I just wanted to open the PR to avoid having it lying around any longer -- and avoid going in a direction which would not be acceptable later.

@gavanderhoorn
Copy link
Collaborator Author

Note: CI builds here will fail until we release M+ libmicroros which includes the new interfaces (Yaskawa-Global/motoros2_interfaces#9).

@gavanderhoorn gavanderhoorn force-pushed the get_active_alarm_info branch 3 times, most recently from 3e87aeb to c2243c7 Compare July 11, 2024 08:51
@gavanderhoorn gavanderhoorn marked this pull request as ready for review July 11, 2024 14:02
@gavanderhoorn
Copy link
Collaborator Author

gavanderhoorn commented Jul 11, 2024

I've marked this as no-longer-a-draft as I tested it again yesterday and it (still) works.

Not all fields of the response are filled (such as the timestamp), but that's by-design right now, as they are reserved for future use and will require some more work on the MotoROS2 side.

We don't need to merge this into 0.1.3 though.

But @ted-miller or @yai-rosejo or @jimmy-mcelwain: if you'd have some time to review, please do.


Edit: I only tested on YRC1 btw. It should work on YRC1u and DX2 as well. FS1 is not supported right now.

Copy link
Collaborator

@ted-miller ted-miller left a comment

Choose a reason for hiding this comment

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

Functionally, it works great. Just a few logistical comments.


static micro_ros_utilities_memory_rule_t mem_rules_response_[] =
{
{"result_message", 50},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where'd the 50 come from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tbh I don't remember (it's been a while).

Easy to change of course, so if we can come up with a more appropriate max length, we'll use that.

Copy link
Collaborator Author

@gavanderhoorn gavanderhoorn Aug 13, 2024

Choose a reason for hiding this comment

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

@ted-miller: any preference for a default/initial length of the result_message field?

Longest result_message is 47 chars (here), so I suggest we set this to 64.

Default value for max string capacity is 20, so that would not be sufficient.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have no preference. 64 is fine with me

src/ServiceGetActiveAlarmInfo.c Show resolved Hide resolved
Comment on lines +104 to +106
// TODO: use proper error codes + strings
rosidl_runtime_c__String__assign(&response->result_message, "M+ API error");
response->result_code = -1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the -1 is ok (maybe replace with ERROR), but I do think this string should be more descriptive

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The TODO was mostly a reminder we need to come up with some nice(r) way to deal with return codes. Both here and in other cases.

I could make them part of the .srv definition, but wasn't sure that was the best way to go about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And I'd probably like to define more meaningful error codes, to facilitate automated handling of errors (otherwise clients just see -1 and would have to interpret the result_message).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've defined a couple of result codes and messages (here). Still need to test them.

I opted to make them part of the response message instead of creating a separate .msg file for them as they are completely tied to this service implementation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

coming back to this:

I opted to make them part of the response message

this is not a good idea, as it means the .srv definition would have to be updated to change or add result codes and strings. This changes the msg hash on Iron and later, which would cause compatibility issues even if none of the actual message fields change.

I'll create a dedicated result codes .msg, similar to what we have for other services.

src/ServiceGetActiveAlarmInfo.c Show resolved Hide resolved
src/ServiceGetActiveAlarmInfo.c Show resolved Hide resolved
src/ServiceGetActiveAlarmInfo.c Outdated Show resolved Hide resolved
src/ServiceGetActiveAlarmInfo.c Show resolved Hide resolved
@ted-miller
Copy link
Collaborator

My testing was performed on DX200

src/ErrorHandling.h Show resolved Hide resolved
src/RosApiNameConstants.h Show resolved Hide resolved
Allows clients to retrieve information about active alarms and errors (code, subcode, msg, subcode msg, etc).
Supports retrieving alarm & error information.
Use micro_ros_utilities and a memory config for the response.
Retrieved using PlatformLib functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add service allowing to retrieve (active) error & alarm details
2 participants