-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add RobotInterface library and a SensorBridge interface class #87
Add RobotInterface library and a SensorBridge interface class #87
Conversation
1a45c8d
to
444c13e
Compare
To be honest, I think that What about using Eigen types in the interface then? I would be totally fine in having OpenCV as a dependency in case we develop some modules which use it extensively, but right now it seems a bit of an overkill. |
I thought about it too. If we can depend on the user to make relevant conversions from Eigen to relevant types, then we can keep the design that way. In that case, would it also make sense to change GenericVectorContainer to Eigen? |
But then, if we also want point clouds to be handled by this Bridge, then there comes a problem of adding PCL which is quite a heavy library that depends on many other libraries as a dependency. So we might have to think about this a bit. If we find suitable conversions between Eigen and PCL and these conversions are lightweight, then it's reasonable. |
The
Is there a specific type/class we may need to use from this library? |
Agreed.
I am just looking forward into our tasks. For example, for the staircase climbing task, if we need perception in the loop, we could begin to use PCL library extensively for plane segmentation. But from within the class, we would need pcl::PoincloudXYZRGB. |
I think there might be some conversions available. https://github.com/PointCloudLibrary/pcl/blob/2c8d58a0e6497d91cc50f61460d75b9ebf44429a/common/include/pcl/point_cloud.h#L351 Anyway, the take-home message would be to avoid heavy dependencies only for a type in an interface class. For sure, if we need some additional feature of these libraries, it makes total sense to add them. In principle, I may want to avoid having a certain dependency, paying the price of losing some features. But I am expecting the feature to be related to the dependency I am missing. In this specific case, it would be a pity not to be able to compile the |
I understand. In that case, we can avoid having OpenCV and PCL as a dependency for this interface class and rely on relevant conversions at a higher level. I will replace the image related methods to Eigen types. |
e4741d2
to
4838ba0
Compare
src/RobotInterface/include/BipedalLocomotion/RobotInterface/ISensorBridge.h
Outdated
Show resolved
Hide resolved
src/RobotInterface/include/BipedalLocomotion/RobotInterface/ISensorBridge.h
Outdated
Show resolved
Hide resolved
src/RobotInterface/include/BipedalLocomotion/RobotInterface/ISensorBridge.h
Outdated
Show resolved
Hide resolved
src/RobotInterface/include/BipedalLocomotion/RobotInterface/ISensorBridge.h
Show resolved
Hide resolved
src/RobotInterface/tests/DummyImplementation/DummySensorBridgeTest.cpp
Outdated
Show resolved
Hide resolved
* @return true/false in case of success/failure | ||
*/ | ||
virtual bool getLinearAccelerometerMeasurement(const std::string& accName, | ||
GenericContainer::Vector<double>& accMeasurement, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a good idea to use the GenericContainer::Vector
here? In all the other parts of the code, we use Eigen vectors as intefrace of the class. I would avoid having mixing different kinds of types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For instance here you can use an Eigen::Ref<Eigen::Vector3d>
And the you can pass every different container (std vector iDynTree or yarp) through an Eigen::Map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a discussion about this at #87 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The important point that was raised was,
So, right now I would suggest using GenericContainer::Vector in case you need to deal with different vector implementation at the same time, especially in case you need to resize them (something that is not possible with an Eigen::map).
I would avoid having mixing different kinds of types
would you have an opinion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid having mixing different kinds of types
would you have an opinion on this?
I would say that it depends on whether accMeasurement
has a predefined size or not. If so, I agree on using Eigen types for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, we assume for joint states and images, that the size is decided at the configuration and remains fixed, and internal checks can be done at the implementation level. This means that the user must pass a resized argument to these getter methods. Correct me if I am wrong, @GiulioRomualdi!
I shall add a description in the documentation regarding this.
However, we need to understand how to handle this for the elements with variable size, for example, point clouds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok for the documentation. For point clouds, are they matrices or vector of points?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are usually handled as a struct asking for maintaining cloud width and height. Then they store a vector of XYZ points or XYZRGB points.
I hope we will not be causing any overheads by doing multiple conversions by passing these kinds of images or point cloud measurements through this bridge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may open one or more issue to discuss on this. In particular, it is not clear:
- when to use
Eigen
vectors vsGenericContainer
vs templates - how to deal with matrices
- how to deal with particular input classes, like point clouds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added documentation for the joint states and image methods and relevant configuration parameters in the SensorBridgeOptions
if the implementation might want to use it. 979733e
4a4b818
to
8d44405
Compare
src/RobotInterface/include/BipedalLocomotion/RobotInterface/ISensorBridge.h
Outdated
Show resolved
Hide resolved
src/RobotInterface/include/BipedalLocomotion/RobotInterface/ISensorBridge.h
Outdated
Show resolved
Hide resolved
src/RobotInterface/include/BipedalLocomotion/RobotInterface/ISensorBridge.h
Outdated
Show resolved
Hide resolved
@prashanthr05 let me know if you want to reorganize the commits otherwise I will merge the PR |
[RobotInterface] ISensorBridge make receiveTimeInSeconds optional Add optional helper methods for use of SensorBridgeOptions and SensorLists in the ISensorBridge interface
699ea3f
to
9f9a8b6
Compare
Ciao @GiulioRomualdi .. I have squashed and rebased all changes into a single commit. Thanks for waiting! |
This PR,
RobotInterface
library to the FrameworkISensorBridge
interface class toRobotInterface
library- Adds OpenCV as a dependency for handlingcv::Mat
within theISensorBridge
classDummySensorBridge
test implementation to depict the use of theISensorBridge
interface