-
Notifications
You must be signed in to change notification settings - Fork 312
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
Enabling non-namespace use of Gazebo robot #187
Conversation
Note that using a franka_ros/franka_gazebo/src/franka_hw_sim.cpp Lines 26 to 33 in 563465d
... which was introduced only recently by @gollth in f2f82b2. I think this commit already resolved the main problems to separate the name of the robot ( |
…ika#186, and frankaemika#187 into develop
The robotNamespace is conceptually different from arm_id. While the latter just acts as a name prefix for links and joints, the <robotNamespace> tag specifies the name of the ROS namespace, which is used for key robot components like the joint_states topic, the controller_manager, etc. To allow for an empty namespace, the default needs to be specified as empty. Otherwise, i.e. having a non-empty default, specifying ns:="" on the commandline will fall back to the default despite an (empty) value was provided.
By default, we don't start in a namespace to match the real-robot behavior. Unfortunately, we cannot just specify an empty ns="" in roslaunch, but we need to distinguish the two cases empty/non-empty namespace. To avoid code duplication, the relevant code was factored out into panda_ns.launch.xml, which is include w/ or w/o a namespace. The file-ending is deliberatively choosen as .launch.xml to hide the file from bash completion.
Instead of arm_id/arm_id_xxx use arm_id/xxx
Rebased after merge of #183. |
Hmm, not sure about this one. I think the main confusion here is the distinction between topic namespaces and URDF prefixes, which are two distinct features. Let's try to not mix the two. Passing a topic namespace into an URDF seems already flawed to me. Ideally a URDF does not need to care in which namespace it is loaded. It is valid in any namespace. The only reason I see where we would need the namespace in the URDF anyways would be for <gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>$(arg arm_id)</robotNamespace> <!-- HERE -->
<controlPeriod>0.001</controlPeriod>
<robotSimType>franka_gazebo/FrankaHWSim</robotSimType>
</plugin>
</gazebo> The documentation for this
So can we just leave it out completely? Then we don't have any association between ROS topic namespaces in the URDF anymore: <gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<controlPeriod>0.001</controlPeriod>
<robotSimType>franka_gazebo/FrankaHWSim</robotSimType>
</plugin>
</gazebo> Regarding the naming between
<launch>
<group ns="panda_left">
<include file="$(find franka_gazebo)/launch/panda.launch">
<arg name="arm_id" value="panda_1" />
</include>
</group>
<group ns="panda_right">
<include file="$(find franka_gazebo)/launch/panda.launch">
<arg name="arm_id" value="panda_2" />
</include>
</group>
</include> Notice how the namespace could potentially even be different than the I drafted a possible solution here if you want to have a look. Would that be compatible with MoveIT then?
BTW. this is already possible, see https://frankaemika.github.io/docs/franka_ros.html#customization |
Regarding this check I also agree, that, in any case this will be outdated then. The main idea behind this was to give the User a clearer warning if the namespaces don't match other than the cryptic However now I see, that if this warning would be printed, then the URDF had to be found in the first place to define the |
Good that we agree on this crucial point. The problem is that the old code linked these two features, using the URDF prefix franka_ros/franka_description/robots/panda_arm.urdf.xacro Lines 64 to 65 in da8a709
Thus, the central contribution of this PR is to change this line. The rest is required to forward the |
Don't know if I understand your point entirely.
For me it does: If I start this launchfile with the changes from the above commit, I can start both pandas in separate namespaces (which can even be different from the <?xml version="1.0"?>
<launch>
<include file="$(find gazebo_ros)/launch/empty_world.launch" >
<!-- Start paused, simulation will be started, when Pandas were loaded -->
<arg name="paused" value="true"/>
<arg name="use_sim_time" value="true"/>
</include>
<group ns="panda_left">
<include file="$(find franka_gazebo)/launch/panda.launch">
<arg name="arm_id" value="panda_1" />
<arg name="y" value="-0.5" />
<arg name="gazebo" value="false" />
<arg name="paused" value="true" />
</include>
</group>
<group ns="panda_right">
<include file="$(find franka_gazebo)/launch/panda.launch">
<arg name="arm_id" value="panda_2" />
<arg name="y" value="0.5" />
<arg name="gazebo" value="false" />
<arg name="paused" value="false" />
</include>
</group>
</launch> Output of
Can you elaborate what you mean by "Your solution relies on the fact that Gazebo itself is started within the corresponding namespace"? |
You are totally right. I just verified that the Gazebo spawner indeed considers the namespace it is started in. My statement in #187 (comment) was based on the (unverified - sorry, I was in a rush) assumption that this wouldn't be the case. Your solution is much better then. Closing here in favour of #196. |
No worries, thanks for the contribution |
@gollth, @Maverobot I created a pull request that removes the redundant ROS namespace warning from FrankaHWSim. Please feel free to ask for changes if you think of a better solution. |
So far, the Gazebo robot was always started in the
arm_id=panda
namespace. However, the real robot is not running in a namespace. To increase coherence, this PR (building on top of #183 to avoid merge conflicts) adds two commits:ns
argument topanda_arm.urdf.xacro
franka_gazebo/panda.launch
to allow an empty namespaceThis essentially decouples the
namespace
from thearm_id
and - for example - allows spawning two arms as follows: