ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Pioneer_p3dx simulation on Gazebo, not stopping on key release

asked 2018-07-09 17:27:19 -0500

manuelmelvin gravatar image

updated 2018-07-09 17:38:10 -0500

I am working on Pioneer P3dx simulation on Gazebo.Using the package "ua_ros_p3dx". When I am using keyboard to control the robot, the robot is moving, but once release the key from the keyboard, still the robot moves. Its not getting stopped. Till I press any other key the robot continues on the previous command. Please help me to resolve the issue.

The link for the package I am using is https://github.com/RafBerkvens/ua_ros...

Thanks Melvin

edit retag flag offensive close merge delete

Comments

Can you please update your question with a link to the package that you're using

jayess gravatar image jayess  ( 2018-07-09 17:31:32 -0500 )edit

I have updated with the package link. Thank you

manuelmelvin gravatar image manuelmelvin  ( 2018-07-09 17:39:03 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-12 16:58:42 -0500

updated 2018-07-15 22:24:10 -0500

Hello @manuelmelvin,

Unfortunately, using the differential driver gazebo plugin like this will not work. But the good news is that you can use in a different way, like they do for Husky or Jackal robots ( https://github.com/s-mostafa-a/Origin... ).

Basically, it's about using the diff_drive_controller (http://wiki.ros.org/diff_drive_controller)

By doing this, you can set the variable cmd_vel_timeout as your needs.

I've cloned your repo and worked on one of my own, see below the main modifications I've done or if you prefer, check in my public repository the merge I've done to master branch (https://bitbucket.org/theconstructcore/p3dx/commits/ed1e237e2a36a1c2d23cd5edcbed2059cf0c88f2)

Yet, you can run my ROSJect using this ROSDS link (https://rds.theconstructsim.com/tc_projects/use_project_share_link/438ff787-1c07-44ff-8fb0-b7a21f4014b2)

Or watch this video to follow the instructions: https://www.youtube.com/watch?v=x8ied...

Here it goes the modifications:

p3dx_description/urdf/pioneer3dx.gazebo (just comment the plugin code)

<!--
    <gazebo>
        <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
            <alwaysOn>true</alwaysOn>
            <updateRate>100</updateRate>
            <leftJoint>base_right_wheel_joint</leftJoint>
            <rightJoint>base_left_wheel_joint</rightJoint>
            <wheelSeparation>0.39</wheelSeparation>
            <wheelDiameter>0.15</wheelDiameter>
            <torque>5</torque>
            <commandTopic>${ns}/cmd_vel</commandTopic>
            <odometryTopic>${ns}/odom</odometryTopic>
            <odometryFrame>odom</odometryFrame>
            <robotBaseFrame>base_link</robotBaseFrame>
        </plugin>
    </gazebo>
    -->

p3dx_description/urdf/pioneer3dx_wheel.xacro (change hardwareInterface value to VelocityJointInterface)

    <transmission name="${parent}_${suffix}_wheel_trans">
      <type>pr2_mechanism_model/SimpleTransmission</type>
      <joint name="base_${suffix}_wheel_joint">
        <hardwareInterface>VelocityJointInterface</hardwareInterface>
      </joint>
      <actuator name="base_${suffix}_wheel_motor">
        <mechanicalReduction>${reflect * 624/35 * 80/19}</mechanicalReduction>
      </actuator>
    </transmission>

p3dx_gazebo/launch/gazebo.launch (Spawn the differential drive controller)

<launch>

    <!-- these are the arguments you can pass this launch file, for example 
        paused:=true -->
    <arg name="paused" default="false" />
    <arg name="use_sim_time" default="true" />
    <arg name="gui" default="true" />
    <arg name="headless" default="false" />
    <arg name="debug" default="false" />

    <!-- We resume the logic in empty_world.launch, changing only the name of 
        the world to be launched -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <!--<arg name="world_name" value="$(find p3dx_gazebo)/worlds/p3dx.world" />-->
        <arg name="debug" value="$(arg debug)" />
        <arg name="gui" value="$(arg gui)" />
        <arg name="paused" value="$(arg paused)" />
        <arg name="use_sim_time" value="$(arg use_sim_time)" />
        <arg name="headless" value="$(arg headless)" />
    </include>

    <group ns="/p3dx">

        <!-- Load the URDF into the ROS Parameter Server -->

        <param name="robot_description"
            command="$(find xacro)/xacro.py --inorder '$(find p3dx_description)/urdf/pioneer3dx.xacro'" />

        <!-- Run a python script to the send a service call to gazebo_ros to spawn 
            a URDF robot -->
        <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
            respawn="false" output="screen" args="-urdf -param robot_description -model p3dx" />

        <rosparam command="load" file="$(find p3dx_control)/config/control.yaml" />

        <node name="base_controller_spawner" pkg="controller_manager" type="spawner"
            args="--namespace=/p3dx
            p3dx_joint_publisher
            p3dx_velocity_controller
            --shutdown-timeout 3"
            output="screen"/>

        <!-- ros_control p3rd launch file -->
        <!-- <include file="$(find p3dx_control)/launch/control.launch" /> -->
    </group>

</launch>

p3dx_control/config/control.yaml (create a new file to configure the controller)

p3dx_joint_publisher:
  type: "joint_state_controller/JointStateController"
  publish_rate: 50

p3dx_velocity_controller:
  type: "diff_drive_controller/DiffDriveController"
  left_wheel: 'base_right_wheel_joint'
  right_wheel: 'base_left_wheel_joint'
  publish_rate: 50
  pose_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.03]
  twist_covariance_diagonal: [0.001, 0.001, 0.001 ...
(more)
edit flag offensive delete link more

Comments

Thank you very much for your effort. It worked for me. great job marcoarruda

manuelmelvin gravatar image manuelmelvin  ( 2018-07-14 08:05:19 -0500 )edit

Great to know it helped you! Do you mind to check my answer as correct? Thanks!

marcoarruda gravatar image marcoarruda  ( 2018-07-20 13:19:04 -0500 )edit

Question Tools

Stats

Asked: 2018-07-09 17:27:19 -0500

Seen: 680 times

Last updated: Jul 15 '18