Robotics StackExchange | Archived questions

How to impart action of plugin to different instances of the robot model separately?

How to apply plugin to specific instance of model?

I added following code in the launch file to create different instances of robot model:

<group ns="2">
    <param name="robot_description" command="$(find xacro)/xacro.py '$(find manycar)/urdf/azcar.xacro' prefix:='2'"/>
    <include file="$(find manycar)/launch/azcar.launch">
        <arg name="robot_num" value="2"/>
        <arg name="init_pose" value="-x 15 -y 20 -z 0 -Y 0.7 "/>
    </include>
</group>

<group ns="3">
    <param name="robot_description" command="$(find xacro)/xacro.py '$(find manycar)/urdf/azcar.xacro' prefix:='3'"/>
    <include file="$(find manycar)/launch/azcar.launch">
        <arg name="robot_num" value="3"/>
        <arg name="init_pose" value="-x 25 -y 10 -z 0 -Y 0.7 "/>
    </include>
</group>

Then I am imparting a linear velocity using following code segment in plugin function:

this->model->SetLinearVel(math::Vector3(2.5, 0, 0));

But the problem is when I invoke plugin from .gazebo file, it applies plugin to all the instances of model:

<gazebo>
    <plugin name="pluginname" filename="libmanycargazebo.so">
        <robotNamespace>/manycar2</robotNamespace>
    </plugin>
</gazebo>

Here doesn't affect anything. As you can see my motive is to just move manycar2 and not all the instances.

Asked by cybodroid on 2015-12-28 03:42:18 UTC

Comments

Answers