Skip to content

Add package with "Fake" components for simple integration of framework#323

Merged
destogl merged 22 commits intoros-controls:masterfrom
destogl:add-fake-robot
Feb 22, 2021
Merged

Add package with "Fake" components for simple integration of framework#323
destogl merged 22 commits intoros-controls:masterfrom
destogl:add-fake-robot

Conversation

@destogl
Copy link
Copy Markdown
Member

@destogl destogl commented Feb 5, 2021

This package implements fake components (currently only System/Robot) which simply mirror the incoming commands to its states. It is basically a very simple simulation without a need for Gazebo. It also provides much more flexibility for integration tests than Gazebo. The use-cases are the following:

  1. Integration/setting up of ros2_control framework for a new robot. It enables testing of ros2_control URDF, controllers' setup, and external and internal interfaces without implementing communication to the hardware.
  2. MoveIt uses it for testing of their setup by the users. In ROS1 they were using fake_joint implementation. (@JafarAbdi)
  3. By extending the classes from this package users can create simple simulations when they cannot or don't want to use Gazebo.

Why I propose to merge this here and not in the ros2_control_demos repository? Because this package should be released at some point and the demos repository is meant to be used always from the source for users to see the implementation examples. Also, this is not a demonstration functionality, but rather a tool for setting up and testing the ros2_control framework.

@destogl destogl self-assigned this Feb 5, 2021
@destogl destogl linked an issue Feb 5, 2021 that may be closed by this pull request
@olivier-stasse
Copy link
Copy Markdown
Contributor

3. By extending the classes from this package users can create simple simulations when they cannot or don't want to use Gazebo.

Does that mean that we can have Gazebo examples in ros2_control_demos ?

Copy link
Copy Markdown
Contributor

@v-lopez v-lopez left a comment

Choose a reason for hiding this comment

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

In general LGTM.

I do not fully understand the need to separate the standard and other interfaces.

@destogl
Copy link
Copy Markdown
Member Author

destogl commented Feb 8, 2021

I do not fully understand the need to separate the standard and other interfaces.

Thanks for a fast review!

It is rather a convenience feature. So if one wants to extend the class and create some simple simulation for it, the interfaces relevant for the dynamic are already there, so they do not need to filter them.

The second reason is the JointStateController which is unhappy with nan position data. So I am initializing all dynamic-related data to 0 if no initial value is provided.

@destogl
Copy link
Copy Markdown
Member Author

destogl commented Feb 8, 2021

Does that mean that we can have Gazebo examples in ros2_control_demos ?

No, not yet, but I see you are on it :)

@AndyZe
Copy link
Copy Markdown
Contributor

AndyZe commented Feb 10, 2021

Linking to the first MoveIt PR that has tried to use this.

Notice that lines of code went up by 120 compared to fake_joint. That's not a good sign, in terms of being user-friendly and easy to configure.

@AndyZe
Copy link
Copy Markdown
Contributor

AndyZe commented Feb 10, 2021

I guess the difference is, fake_joint assumes position control for every joint.

I just want to make sure we aren't making things more complicated than they need to be.

@destogl
Copy link
Copy Markdown
Member Author

destogl commented Feb 11, 2021

I guess the difference is, fake_joint assumes position control for every joint.

I just want to make sure we aren't making things more complicated than they need to be.

This implementation provides a general solution where FakeSystem is adapting itself to the interfaces described with URDF. So it doesn't matter anymore which are used by your robot. In combination with at general JointTrajectoryController this works for really any set or input and output interfaces. (At least it should).

@bmagyar
Copy link
Copy Markdown
Member

bmagyar commented Feb 16, 2021

Notice that lines of code went up by 120 compared to fake_joint. That's not a good sign, in terms of being user-friendly and easy to configure.

I also don't like those lengthy launch files but what can we do about it? It feels that a lot of ROS2 is just dumping all the complexity on the end user in the name of freedom. Not that we should be doing this but we can't help launch files and param handling being inconvenient. Additionally, consider that if this can completely replace fake_joint, you can deduct the LoC of that too.

Copy link
Copy Markdown
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

@destogl I think in general the approach is good but we shouldn't create a new package for it. I think it would fit well in hardware_interface with the fake_component namespace you are already using, it's sole purpose after all is to fake some of that away.

Comment on lines +232 to +233
PLUGINLIB_EXPORT_CLASS(fake_components::GenericSystem, hardware_interface::SystemInterface)
PLUGINLIB_EXPORT_CLASS(fake_components::GenericRobot, hardware_interface::SystemInterface)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, any reason for exporting two different names for the same library .?

Copy link
Copy Markdown
Member Author

@destogl destogl Feb 16, 2021

Choose a reason for hiding this comment

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

Only convenience. For the most users in the most cases: System == Robot.

@bmagyar Are you also OK with this? We wanted to add this throughout the framework

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That seems confusing to me. Why exactly?

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.

Let's discuss this at the next WG meeting. If we want to revise nomenclature, that's fine, could do that for Galactic but I'd prefer to keep an official nomenclature without convenience duplications.

@destogl
Copy link
Copy Markdown
Member Author

destogl commented Feb 16, 2021

@destogl I think in general the approach is good but we shouldn't create a new package for it. I think it would fit well in hardware_interface with the fake_component namespace you are already using, it's sole purpose after all is to fake some of that away.

I will move this then...

Copy link
Copy Markdown
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

I agree with @AndyZe , dual names are confusing. I suggest to remove the typedef and the duplicate pluginlib export. If we are already renaming things for convenience, let's think about renaming it all for Galactic...

destogl and others added 3 commits February 22, 2021 12:23
@destogl destogl merged commit 93b1578 into ros-controls:master Feb 22, 2021
@destogl destogl deleted the add-fake-robot branch February 22, 2021 12:16
mahaarbo pushed a commit to mahaarbo/ros2_control that referenced this pull request Apr 22, 2021
ros-controls#323)

* Generic components FakeSystem for simple testing of ros2_control framework.

* Correct typo.

Co-authored-by: Victor Lopez <3469405+v-lopez@users.noreply.github.com>

* Update ros2_control/package.xml

Co-authored-by: Bence Magyar <bence.magyar.robotics@gmail.com>

* Remove dual names

Co-authored-by: JafarAbdi <cafer.abdi@gmail.com>
Co-authored-by: Bence Magyar <bence.magyar.robotics@gmail.com>
destogl pushed a commit to b-robotized-forks/ros2_control that referenced this pull request Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-Joint command interfaces

6 participants