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

Document attach/detach levels used for different kind of devices #377

Open
traversaro opened this issue Aug 30, 2022 · 6 comments
Open

Document attach/detach levels used for different kind of devices #377

traversaro opened this issue Aug 30, 2022 · 6 comments

Comments

@traversaro
Copy link
Member

For people writing new yarprobotinterface files, it would be convenient to document the leves used for attach/detach phases for different types of devices. By inspecting the configuration files, it seems that these leves are:

Type of device Phase Action Level
remapper startup attach 5
nws startup attach 10
control/estimation startup attach 15
control/estimation shutdown detach 2
nws shutdown detach 15
remapper shutdown detach 20
@GiulioRomualdi
Copy link
Member

Hi @traversaro, this is pretty useful. Is there any documentation that explains the meaning of the levels and why such specific levels are required?

@traversaro
Copy link
Member Author

I am afraid not. What I think they do (looking into the code) is that they specify the order at which the attach operations are done (the lower the level, the earlier the operation is done). So imagining that the devices are nodes and the "is attached to" or "is detached from" is a ordered arcs, for the attach operations you want to do them in the order of the most closer to the roots of the tree is attached before, and "leafs" are attached later, while for the detach you want to do the contrary.

The relevant code is: https://github.com/robotology/yarp/blob/e4762b0b4a7946bf9379b183379bd32353d54a26/src/libYARP_robotinterface/src/yarp/robotinterface/Robot.cpp#L667-L686 .

@pattacini
Copy link
Member

pattacini commented Apr 12, 2024

I can see two different layers of documentation missing here, describing:

  • What an attach/detach level is all about. This probably goes to YARP right away (cc @randaz81).
  • How we generally or typically employ these levels for dealing with robots. We could plan for yielding this documentation at the next PI (cc @Nicogene).

/remind May 06

Copy link

octo-reminder bot commented Apr 12, 2024

Reminder
Monday, May 6, 2024 10:00 AM (GMT+02:00)

@randaz81
Copy link
Member

randaz81 commented Apr 12, 2024

Levels are just numbers to specify a sequence. These numbers do not have any specific meaning. There are some gaps in the sequence to allow the insertion of new stuff without reordering all the sequence. The sequence is dependent on the specific device dependencies in the same way you launch modules through yarpmanager. For example first you start a device driver, then you start the network wrapper, finally you do the attach. During closure, the order is obviously inverted. If you stop the device driver and the wrapper is still running, you'll probaby get a call to a nullptr, resulting in a segfault. I can provide an official documentaion on this topic.

Copy link

octo-reminder bot commented May 6, 2024

🔔 @pattacini

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

No branches or pull requests

4 participants