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

asked 2015-12-28 02:42:18 -0500

cybodroid gravatar image

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 <robotnamespace> doesn't affect anything. As you can see my motive is to just move manycar2 and not all the instances.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by cybodroid
close date 2016-03-20 07:08:45.772093