WIP: New robot hardware interface design#80
WIP: New robot hardware interface design#80destogl wants to merge 10 commits intoros-controls:masterfrom
Conversation
…oading components into it.
…rdwareCommunicationInterface.
|
Puh, many lines of code.... sorry for that guys, this thing is getting very, very complex... If possible just look at the main idea and it would be great to discuss it in WG meeting. The code is designed according to the design document in the roadmap. |
|
@destogl thanks for getting thing started here. As you can imagine that PR is pretty massive and I think realistically to make this work we have to break this down into multiple PRs. As you said it yourself, we might want to have a minimal set which is also directly usable with the current code architecture. I propose we start with only introducing the I still haven't fully understood why there is such a package as We can then in a second iteration introduce another level of complexity - always integrating it to a degree that it's actually being used. The current PR provides a lot of code, but it's not being used anywhere. Generally, while looking at the code, I have the feeling we're drifting already in a direction which leads to template and inheritance madness. I would strongly recommend that we stick to simple inheritance, that is defining abstract interface classes and having class SensorInterface
{
hardware_ret_t read(std::vector<uint64_t> & data) = 0;
};
class PositionSensor : public SensorInterface
{
hardware_ret_t read(std::vector<uint64_t> & data)
{
data = my_device->read();
}
};
class Sensor final
{
Sensor(std::unique_ptr<SensorInterface> impl)
: impl_(std::move(impl))
{}
hardware_ret_t read(std::vector<uin64_t> & data)
{
return impl_->read(data);
}
};The above example can hopefully illustrate the point here. That's pretty ABI/API stable, doesn't use a hell of inheritance/templates but moreover each individual implementation can easily be tested. If you'd take it even more serious like others we could get rid of that inheritance as well, but I think that'd be too crazy for a first run. The hardware interface could then simply be composed of a list of these That's pretty much all I would see as a first PR here. I'd leave our the
|
|
Another thing I've just noticed: In the context of ROS2, we have to be a bit more careful about choosing how many nodes we'd |
|
@Karsten1987 thank you for your comments. This is exactly I was hoping for :) I will use the time until the next meeting to hopefully implement the first functional version. For the ROS agnostic part... I am not sure how to implement this completely. The parameters are not a problem, especially if we are allowed to use undeclared parameters. The issue I see is with logging functions. The logger should be available from all components. |
|
Closed in favor of #101 |
Moved
ros2_control_corefrom demo repository.This is related to:
ros-controls/ros2_control_demos#6
ros-controls/ros2_control_demos#7