ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
So, how to load both models from one launch file?
you don't.
The (implicit) assumption is that there is only a single robot_description
that contains the urdf for your entire application. You can definitely have multiple parameters containing snippets of urdf, but almost every node that consumes urdf will assume that the parameter is called robot_description
.
Pushing things in namespaces is supported, so that could allow you to have multiple robot_description
parameters, but then you run into the issues you already mentioned.
So in your specific case: create a composite xacro that 'marries' an instance of the Kinova model with your mp470
. Use a fixed
joint for that fi. If you make sure to model that in a way that reflects reality, you can then even use that to do planning for both base and manipulator at the same time.
Then load that composite xacro -- which is now also a top-level xacro -- into the robot_description
parameter and everything should start working.
2 | No.2 Revision |
So, how to load both models from one launch file?
you don't.
The (implicit) assumption is that there is only a single robot_description
that contains the urdf for your entire application. You can definitely have multiple parameters containing snippets of urdf, but almost every node that consumes urdf will assume that the parameter is called robot_description
.
Pushing things in namespaces is supported, so that could allow you to have multiple robot_description
parameters, but then you run into the issues you already mentioned.
So in your specific case: create a composite xacro that 'marries' an instance of the Kinova model with your mp470
. Use a fixed
joint for that fi. If you make sure to model that in a way that reflects reality, you can then even use that to do planning for both base and manipulator at the same time.
Then load that composite xacro -- which is now also a top-level xacro -- into the robot_description
parameter and everything should start working.
Edit:
I tried what gvdhorn suggested. I created a file "jaco_mp470.xacro", that only contains the following two lines:
<xacro:include filename="$(find mp470_description)/urdf/mp470.xacro"/> <xacro:include filename="$(find kinova_description)/urdf/j2s7s300_standalone.xacro"/>
And than tried to load it with:
<param name="robot_description" command="$(find xacro)/xacro.py '$(find total_model)/urdf/jaco_mp470.xacro'" /> <node joint_state_publisher" pkg="....... /> <node name="robot_state_publisher" pkg="....... />
But rviz tells me that the robot_description parameter is not loaded. So what do i miss?
Just including the two xacros is not enough.
That is similar to #include <..>
in C/C++ and then not using any of the functions defined in those headers. xacro
doesn't magically know that you want to insert two instances of those models in your xacro, where those should be placed in the scene or how they should be connected to each other.
There are quite a few examples 'out there' that show you how to create a composite xacro properly, but I'm going to link you to this one: Example: adding an end-effector to a robot.
Notice how there are three aspects to this:
include
ing the definitionSkip any of those three and xacro
will abort with an error or return an empty document, causing any node expecting something in robot_description
to not be able to find anything.
3 | No.3 Revision |
So, how to load both models from one launch file?
you don't.
The (implicit) assumption is that there is only a single robot_description
that contains the urdf for your entire application. You can definitely have multiple parameters containing snippets of urdf, but almost every node that consumes urdf will assume that the parameter is called robot_description
.
Pushing things in namespaces is supported, so that could allow you to have multiple robot_description
parameters, but then you run into the issues you already mentioned.
So in your specific case: create a composite xacro that 'marries' an instance of the Kinova model with your mp470
. Use a fixed
joint for that fi. If you make sure to model that in a way that reflects reality, you can then even use that to do planning for both base and manipulator at the same time.
Then load that composite xacro -- which is now also a top-level xacro -- into the robot_description
parameter and everything should start working.
Edit:
I tried what gvdhorn suggested. I created a file "jaco_mp470.xacro", that only contains the following two lines:
<xacro:include filename="$(find mp470_description)/urdf/mp470.xacro"/> <xacro:include filename="$(find kinova_description)/urdf/j2s7s300_standalone.xacro"/>
And than tried to load it with:
<param name="robot_description" command="$(find xacro)/xacro.py '$(find total_model)/urdf/jaco_mp470.xacro'" /> <node joint_state_publisher" pkg="....... /> <node name="robot_state_publisher" pkg="....... />
But rviz tells me that the robot_description parameter is not loaded. So what do i miss?
Just including the two xacros is not enough.
That is similar to #include <..>
in C/C++ and then not using any of the functions defined in those headers. xacro
doesn't magically know that you want to insert two instances of those models in your xacro, where those should be placed in the scene or how they should be connected to each other.
There are quite a few examples 'out there' that show you how to create a composite xacro properly, but I'm going to link you to this one: Example: adding an end-effector to a robot.
Notice how there are three aspects to this:
include
ing the definitionSkip any of those three and xacro
will abort with an error or return an empty document, causing any node expecting something in robot_description
to not be able to find anything.
(note: the example I linked you to actually creates a xacro macro that instantiates and connects everything. You would need another top-level xacro to call that macro or else you'll run into the same problem again with an empty document (ie: definition but no instantiation or use))
4 | No.4 Revision |
So, how to load both models from one launch file?
you don't.
The (implicit) assumption is that there is only a single robot_description
that contains the urdf for your entire application. You can definitely have multiple parameters containing snippets of urdf, but almost every node that consumes urdf will assume that the parameter is called robot_description
.
Pushing things in namespaces is supported, so that could allow you to have multiple robot_description
parameters, but then you run into the issues you already mentioned.
So in your specific case: create a composite xacro that 'marries' an instance of the Kinova model with your mp470
. Use a fixed
joint for that fi. If you make sure to model that in a way that reflects reality, you can then even use that to do planning for both base and manipulator at the same time.
Then load that composite xacro -- which is now also a top-level xacro -- into the robot_description
parameter and everything should start working.
Edit:
I tried what gvdhorn suggested. I created a file "jaco_mp470.xacro", that only contains the following two lines:
<xacro:include filename="$(find mp470_description)/urdf/mp470.xacro"/> <xacro:include filename="$(find kinova_description)/urdf/j2s7s300_standalone.xacro"/>
And than tried to load it with:
<param name="robot_description" command="$(find xacro)/xacro.py '$(find total_model)/urdf/jaco_mp470.xacro'" /> <node joint_state_publisher" pkg="....... /> <node name="robot_state_publisher" pkg="....... />
But rviz tells me that the robot_description parameter is not loaded. So what do i miss?
Just including the two xacros is not enough.
That is similar to #include <..>
in C/C++ and then not using any of the functions defined in those headers. xacro
doesn't magically know that you want to insert two instances of those models in your xacro, where those should be placed in the scene or how they should be connected to each other.
There are quite a few examples 'out there' that show you how to create a composite xacro properly, but I'm going to link you to this one: Example: adding an end-effector to a robot.
Notice how there are three aspects to this:
include
ing the definitionSkip any of those three and xacro
will abort with an error or return an empty document, causing any node expecting something in robot_description
to not be able to find anything.
(note: the example I linked you to actually creates a xacro macro that instantiates and connects everything. If your world is simple enough, or you'll never need more than one of it, you can ignore that. You would need another top-level xacro to call that macro or else you'll run into the same problem again with an empty document (ie: definition but no instantiation or use))