-
Notifications
You must be signed in to change notification settings - Fork 0
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
URDFTools can take a Collection<InputStream> as the first parameters to allow for splitting the URDF up into multiple files #172
Conversation
…. There are errors all over the place still
…'s with duplicate joints for testing
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.
Gonna look into what should be done about the name, don't like that we ignore the rest of the names after getting the first one
scs2-examples/src/test/java/us/ihmc/scs2/examples/urdf/ComposedURDFLoadingTest.java
Outdated
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Outdated
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Outdated
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Show resolved
Hide resolved
scs2-session-logger/src/main/java/us/ihmc/scs2/session/tools/RobotModelLoader.java
Outdated
Show resolved
Hide resolved
scs2-session-logger/src/main/java/us/ihmc/scs2/session/tools/RobotModelLoader.java
Outdated
Show resolved
Hide resolved
scs2-session-logger/src/main/java/us/ihmc/scs2/session/tools/RobotModelLoader.java
Outdated
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Outdated
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Outdated
Show resolved
Hide resolved
scs2-examples/src/test/java/us/ihmc/scs2/examples/urdf/SimpleCrossFourBarRobotTest.java
Outdated
Show resolved
Hide resolved
scs2-examples/src/test/java/us/ihmc/scs2/examples/urdf/SimpleCrossFourBarRobotTest.java
Outdated
Show resolved
Hide resolved
scs2-session-logger/src/main/java/us/ihmc/scs2/session/tools/RobotModelLoader.java
Outdated
Show resolved
Hide resolved
…es to be more accurate. Removed method that isn't need anymore
…t components are prioritized
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Outdated
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Show resolved
Hide resolved
scs2-definition/src/main/java/us/ihmc/scs2/definition/robot/urdf/URDFTools.java
Show resolved
Hide resolved
scs2-examples/src/test/java/us/ihmc/scs2/examples/urdf/SimpleCrossFourBarRobotTest.java
Outdated
Show resolved
Hide resolved
if (!parserProperties.parseSensors) | ||
urdfModel.getGazebos().removeIf(gazebo -> gazebo.getSensor() != null); | ||
// If the model1 doesn't have any links that are in the model2, we define the model2 to be the parent | ||
return mergeChildIntoParentModel(model2, model1); |
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'd suggest inlining the mergeChildIntoParentModel
method in here, as it now relies solving the parent-child relationship outside making it vulnerable to idiot bugs 😅
Above, I'd make 2 new local variables URDFModel parentModel
and URDFModel childModel
and resolve them, then after you should be able to inline the mergeChildIntoParentModel
only once at the end of this method.
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.
True, that was able to happen, just had to set the parent or child model to the correct model and after that has been done, at the end collect all the joints from the parent and child.
…'t be a parent and a child, so should only go into the correct if statement
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 main is keeping backward compatibility. The other comment about not instantiating the models is just subjective style.
} | ||
|
||
URDFModel parentModel = new URDFModel(); | ||
URDFModel childModel = new URDFModel(); |
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.
No need to instantiate new models, just needed more references, these could be initialized to null
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.
Done, yep true, should know that by now dang
@@ -209,66 +247,256 @@ public static URDFModel loadURDFModel(InputStream inputStream, Collection<String | |||
* done. | |||
* @return the model. | |||
*/ | |||
public static URDFModel loadURDFModel(InputStream inputStream, | |||
public static URDFModel loadURDFModel(Collection<InputStream> inputStreams, | |||
Collection<String> resourceDirectories, | |||
ClassLoader resourceClassLoader, | |||
URDFParserProperties parserProperties) throws JAXBException |
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.
Let's add another factory for backward compatibility with the signature:
URDFModel loadURDFModel(InputStream inputStream, Collection<String> resourceDirectories, ClassLoader resourceClassLoader, URDFParserProperties parserProperties)
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 have this... lets see if I can link it....
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.
Couldn't link it but its on line 210
{ | ||
for (URDFJoint joint : model2.getJoints()) | ||
{ | ||
// Check if the model1 has any links that are referenced in model2 |
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.
Its possible for a link from Model1 to be contained inside either the parent or child joint in model2, depending on which it is, that makes it either the child or parent
{ | ||
for (URDFJoint joint : model1.getJoints()) | ||
{ | ||
// Check if the model2 has any links that are referenced in model1 |
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 have to check this for both models, if we get unlucky with the way the models are passed in and don't check both ways, the name may be wrong
if (!parserProperties.parseSensors) | ||
urdfModel.getGazebos().removeIf(gazebo -> gazebo.getSensor() != null); | ||
// If the model1 doesn't have any links that are in the model2, we define the model2 to be the parent | ||
return mergeChildIntoParentModel(model2, model1); |
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.
True, that was able to happen, just had to set the parent or child model to the correct model and after that has been done, at the end collect all the joints from the parent and child.
} | ||
|
||
URDFModel parentModel = new URDFModel(); | ||
URDFModel childModel = new URDFModel(); |
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.
Done, yep true, should know that by now dang
@@ -209,66 +247,256 @@ public static URDFModel loadURDFModel(InputStream inputStream, Collection<String | |||
* done. | |||
* @return the model. | |||
*/ | |||
public static URDFModel loadURDFModel(InputStream inputStream, | |||
public static URDFModel loadURDFModel(Collection<InputStream> inputStreams, | |||
Collection<String> resourceDirectories, | |||
ClassLoader resourceClassLoader, | |||
URDFParserProperties parserProperties) throws JAXBException |
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 have this... lets see if I can link it....
* done. | ||
* @return the model. | ||
*/ | ||
public static URDFModel loadURDFModel(InputStream inputStream, Collection<String> resourceDirectories, ClassLoader resourceClassLoader, URDFParserProperties parserProperties) throws JAXBException |
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.
This is what your looking for yes? @SylvainBertrand This is the factory you asked for, its just hidden in the mess haha
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.
oh yeah!
* done. | ||
* @return the model. | ||
*/ | ||
public static URDFModel loadURDFModel(InputStream inputStream, Collection<String> resourceDirectories, ClassLoader resourceClassLoader, URDFParserProperties parserProperties) throws JAXBException |
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.
oh yeah!
Initial attempt at getting the URDF to be split up, it loads properly. There are errors all over the place still