-
Notifications
You must be signed in to change notification settings - Fork 3
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
CREO2URDF – Implement recursion in the model tree navigation #97
Comments
This task is much less trivial than I expected, mainly because when we compute the transform In the iCub asm for example we have
When we are reaching a leaf of this graph with the component path we are able to compute the transform w.r.t the parent element in the model tree. At some point we should concatenate all the transforms in order to have the This commit still does not work: But it has several improvements in the logic of the code. In any case this change: --- a/src/creo2urdf/src/Sensorizer.cpp
+++ b/src/creo2urdf/src/Sensorizer.cpp
@@ -40,6 +40,11 @@ void Sensorizer::readSensorsFromConfig(const YAML::Node & config)
if (s["exportedFrameName"].IsDefined()) {
exported_frame_name = s["exportedFrameName"].Scalar();
}
+ std::vector<string> sensor_blobs;
+ if (s["sensorBlobs"].IsDefined())
+ {
+ sensor_blobs = s["sensorBlobs"].as<std::vector<std::string>>();
+ }
try
{
@@ -51,7 +56,7 @@ void Sensorizer::readSensorsFromConfig(const YAML::Node & config)
export_frame,
stringToEnum<SensorType>(sensor_type_map, s["sensorType"].Scalar()),
update_rate,
- s["sensorBlobs"].as<std::vector<std::string>>() });
+ sensor_blobs }); is not related but has to be added since |
In this latest commit I tried to add the concatenation of transforms between the subassembly and the underlying items (either other subassemblies or parts): Unfortunately
Is returning false (
I will investigate more in deep |
Another piece of information in the debugging.
Basically this is the only error I am getting because the the asm of left leg is missing any kind of csys, it doesn't have neither the The problems I am getting now are related to the element tree, when we populate the joints map we are retrieving parent and child links from the element tree, and the first part of each subassembly result having a joint beteween the subassembly and the part, but there is not any kind of constraint, so probably the |
After adding some guards while accessing map elements I managed to create an urdf, unfortunately, the model for some reason contains only those joints:
This instead is the list of joints retrieved from the element tree:
There are many more, but in any case, some links are missing from this list, this means that also some joints are missing, and the model seems to be disconnected at several points The ergoCub asm continues to be exportable without problems, then the problem seems how I am managing the subassemblies |
For example
And if I check how it is mounted The constraint is not pin because |
Thanks to the help of @salvi-mattia, @mfussi66 and I understood why we are missing all the joints whose parts belong to different subassemblies. The reason is that we are getting from the elementree of each part the joint information skipping the subassemblies since they does have to be insert in the urdf, but the joint that connects the last part of a subassembly to the first part of the childe subsubassembly (e.g. This is because the first part of a (sub)assembly has to be fixed, and not constrainted to anything. So a possible solution is that we analyze the elementree also of the subassembly, but we treat the subassembly as its first part. |
A significant step forward, unfortunately we have still something to fix. Yesterday we realized that from how a component is assembled into another, when we traverse the elementree of a part, if a joint is present, the first part returned is the parent and the second is the child. Before for understanding which part was the parent and the child we did a check on the names, but when we retrieve the elementree of a subassembly the name of the owner is not a "link", so our method worked with flat assemblies, but the subassemblies broke it. After this improvement I saw more joints in the resulting urdf, but still some were missing, this was due to the fact that the datum used for assemble had not univoque names (e.g. axis Finally I decided to refactor the code in order to use as univoque key of the joint map As you can see I still encountering issues on defining some transforms I don't know if:
In any case a big step forward |
In the latest commit, I managed to fix the transform between an assembly and child subassembly I had to refactor a bit the code, the ergocub model is still exported as before. The only thing I am missing is to fix the axis of the joints that are defined between two links belonging to different subassemblies, but we are close to the goal! |
Actually, the problems I am facing with the axis are not related to the recursion or subassemblies, are wrong all the axis where the child link (part) has not a linkFrame defined, but For computing the axis vector we do: axis_unit_vector = csys_H_link_frame.inverse() * axis_unit_vector;
This method does not work with We are already printing a warning when |
I elaborate a little bit on the problem above, maybe @traversaro on the math side or @fiorisi @Lawproto on the mech side have an idea of how to solve it because the Mathworks plugin manages to correctly export joints even if only CSYS is defined, so there should be a way to do it. Right now we can handle a case like this Instead, we cannot handle the To have an urdf well-formed as this one I have to create If the frames used are user-defined (e.g. On the other hand, when CSYS is used (second picture), the transformation we are using is referred to the default ref system that usually is not neither where the axis passes or "inside" the axis. I would like to compute a sort of transform between CSYS and the axis, if I am not wrong the axis defines just a direction so that offset should be applied to the transform The axis in creo is represented as 2 3D points (start and end), I thought to compute the medium point and apply the offset to the transform, but it didn't give the expected results, since the meshes are exported using |
Actually in iDynTree a |
And as offset the medium point of the line could make sense ? |
Any point on the line would be fine. The important thing is that the line then passes through the origin of the child frame, to be compliant with URDF constraints when the |
Right now we define the axis as follows creo2urdf/src/creo2urdf/src/Creo2Urdf.cpp Lines 239 to 242 in e1187ab
I changed it trying dynamic_cast<iDynTree::RevoluteJoint*>(joint_sh_ptr.get())->setAxis(iDynTree::Axis(axis, parent_H_child.getPosition() + axis_offset)); and dynamic_cast<iDynTree::RevoluteJoint*>(joint_sh_ptr.get())->setAxis(iDynTree::Axis(axis, axis_offset)); where axis_offset is the medium point of the axis: axis_offset[0] = ((pend->get(0) + pstart->get(0)) / 2.0) * scale[0];
axis_offset[1] = ((pend->get(1) + pstart->get(1)) / 2.0) * scale[1];
axis_offset[2] = ((pend->get(2) + pstart->get(2)) / 2.0) * scale[2]; But in both cases I cannot export the urdf for errors like this one:
@traversaro this is due to the fact that the ref frame is still CSYS and we cannot move just the axis right? |
@Nicogene I would gladly like to help you, unfortunately I am not sure I am understanding the problem. We can meet in person or via Teams if you want. |
As I mentioned in the previous post, there was a bug in the check of the iDynTree's URDF exporter. This was fixed in robotology/idyntree#1188, if that is ok for you I can merge and do a new release of idyntree. |
The 12.3.1 idyntree version with the fix was updated in vcpkg: microsoft/vcpkg#39257 . |
Great thanks I will try now! |
Unfortunately, the @traversaro fix did not solve the problems I am encountering, I applied as you can see Since this That issue happens also in the "flat" models, and we might debug it in a simpler assembly as 2bars rather than use iCub model. I think that #98 can be merged because:
cc @mfussi66 |
Right now
creo2urdf
can export the urdf of assemblies that contains only parts, it fails if subassemblies are present.cc @mfussi66 @pattacini
The text was updated successfully, but these errors were encountered: