icub-tech-iit / ergocub-software

Main collector of ergoCub specific SW
https://icub-tech-iit.github.io/ergocub-software/
BSD 3-Clause "New" or "Revised" License
13 stars 18 forks source link

Launch `yarprobotinterface` manually instead of when spawning the robot in simulation #193

Open SimoneMic opened 10 months ago

SimoneMic commented 10 months ago

Since there are two different versions of the "basic" configuration of the yarprobotinterface: namely ergocub.xml and ergocub_ros2.xml it would be nice to have the possibility to select which one to launch. Now, the robot interface it's launched when the robot spawns in simulation, via robot urdf

The main issue is that is not possible to launch the ROS2 remappers separately in a different file, at a different time.

For simplicity, I think that removing it from the URDF would be the easiest path. Then the user can launch whichever configuration suits him best via yarprobotinterface --config <path/to/xml>

Would this be a feasible option? I am also open to other solutions, if anything comes to mind.

Thank you

Nicogene commented 9 months ago

Specifically for running the ROS2 nws a possibility is to run a separate yarprobotinterface that, for each part, runs a nwc and a ros2 nws that attach to it. I think that this should be doable for both control boards or sensors/cameras.

This could introduce an overhead in performances (@elandini84 and @randaz81 know it better)

cc @traversaro

randaz81 commented 9 months ago

For simplicity, I think that removing it from the URDF would be the easiest path. Then the user can launch whichever configuration suits him best via yarprobotinterface --config <path/to/xml>

No, I think this is not a viable solution. The nws should run in the same process space of the device, inside gzserver.

randaz81 commented 9 months ago

The best solution that comes to my mind is to use two different urdfs. Or you can use a single urdf with a parameter which is replaced, depending on which yarprobotinterface xml is required. For example:

ergocub.sh

sed 's/YARPROBOTINTERFACEFILE/ergocub.xml/g' model.urdf > run.urdf
gazebo run.urdf

ergocub_ros2.sh

sed 's/YARPROBOTINTERFACEFILE/ergocub_ros2.xml/g' model.urdf > run.urdf
gazebo run.urdf
traversaro commented 9 months ago

Ideally it would be cool to be able to pass some kind of parameter from a Gazebo world, and then launch a different world based on the kind of ergocub you want to run. Would it be a suitable solution for you @SimoneMic ? How are you launching the simulation and/or adding the model to a running simulation?

SimoneMic commented 9 months ago

Hi @traversaro, I am launching the simulation using this command: export YARP_CLOCK=/clock && gazebo -s libgazebo_yarp_clock.so -s libgazebo_ros_init.so (usually I also specify a world file) then I drag and drop the robot from the models menu.

traversaro commented 9 months ago

then I drag and drop the robot from the models menu.

Would it be a problem if you inserted the model directly in the world instead of drag and drop manually it?

SimoneMic commented 9 months ago

Would it be a problem if you inserted the model directly in the world instead of drag and drop manually it?

On my side I don't have any problems

traversaro commented 9 months ago

Cool, thanks! I try to understand how we can pass parameters to gazebo_yarp_robotinterface via the .world file.

traversaro commented 8 months ago

Cool, thanks! I try to understand how we can pass parameters to gazebo_yarp_robotinterface via the .world file.

Done, a proposal is ready in https://github.com/robotology/gazebo-yarp-plugins/issues/672 .