Skip to content

System modes inference#50

Merged
fmrico merged 4 commits intomasterfrom
system-modes-inference
Sep 30, 2020
Merged

System modes inference#50
fmrico merged 4 commits intomasterfrom
system-modes-inference

Conversation

@jginesclavero
Copy link
Copy Markdown
Contributor

System modes inference

Please, accept first my previous PR #48

This PR adds the rules to the pilot_modes to support the inference and adaptation of the system_modes:

  • I have tested adaptation of the system_modes in case of laser failure.

  • I have modified the dummy metacontroller to read the logs of the battery and change the mode to ENERGY_SAVING.

Future works

  • Modify the dummy metacontroller to take Diagnostics msgs instead of logs.

LaserResender()
: rclcpp_lifecycle::LifecycleNode("laser_resender")
{
declare_parameter("node_name");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the intention of this node_name here? Could be a better id

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Following the Arne suggestions in micro-ROS/system_modes#45 (comment) I have defined a fake parameter.

Currently, there has to be a parameter, because otherwise the mode is invisible from the outside and can't be inferred in any way.

You may want to introduce a simple fake parameter, that is a bool for example or - to make it a bit easier to understand - a string parameter that holds the name of the mode. We stumbled upon this question before.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok

Comment thread laser_resender/src/laser_resender_node.cpp
Comment thread mros_contingencies_sim/package.xml
Comment thread mros_contingencies_sim/src/battery_contingency_node.cpp
Comment thread mros_contingencies_sim/src/battery_contingency_node.cpp
Comment thread mros_contingencies_sim/src/battery_contingency_node.cpp
while not cli.wait_for_service(timeout_sec=1.0):
print('service not available, waiting again...')
req = ChangeMode.Request()
req.node_name = node_name
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This causes an error with newer versions of system_modes:

ros2 run metacontroller_pilot metacontroller
Traceback (most recent call last):
  File "/home/parallels/pilot_urjc_ws/install/metacontroller_pilot/lib/metacontroller_pilot/metacontroller", line 11, in <module>
    load_entry_point('metacontroller-pilot', 'console_scripts', 'metacontroller')()
  File "/home/parallels/pilot_urjc_ws/build/metacontroller_pilot/metacontroller_pilot/metacontroller_sim.py", line 67, in main
    node.change_mode("pilot", '__DEFAULT__')
  File "/home/parallels/pilot_urjc_ws/build/metacontroller_pilot/metacontroller_pilot/metacontroller_sim.py", line 47, in change_mode
    req.node_name = node_name
AttributeError: 'ChangeMode_Request' object has no attribute 'node_name'

See micro-ROS/system_modes#24

Suggested change
req.node_name = node_name

Copy link
Copy Markdown
Contributor Author

@jginesclavero jginesclavero Sep 30, 2020

Choose a reason for hiding this comment

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

I am using the feature/rules branch, and this field is necessary. I have changed the dependencies.repos file to download this branch instead of master

@jginesclavero
Copy link
Copy Markdown
Contributor Author

I have added the changes to solve these issues in #51

@fmrico fmrico merged commit edb72c4 into master Sep 30, 2020
@jginesclavero jginesclavero deleted the system-modes-inference branch October 7, 2020 09:49
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.

3 participants