Ask Your Question
0

model not moving in Rviz but is moving in Gazebo

asked 2016-01-05 21:45:32 -0600

ngoldfarb gravatar image

Hello,

I am trying to create costume robot. I have been trying to follow this tutorial. www.romin.upm.es/wiki/index.php?title...

I can get the robot up in Gazebo and move it with my controller but I cannnot get it to move in Rviz. My goal is to use the navigation stack to create paths for the robot to follow. (if someone know a way to do this with out Rviz I am all for it) I am controlling it with joystick inputs and have independently controlled wheels(balls).

Thank you for any help. I have spent so many hours on this.

Here is my Xacro description file and launch file.

omnishot.urdf.xacro <robot name="omnishot" xmlns:xacro="http://www.ros.org/wiki/xacro">

  <!-- Included URDF/XACRO Files -->
  <xacro:include filename="$(find omni_shot)/urdf/materials.urdf.xacro" />
  <xacro:include filename="$(find omni_shot)/urdf/ball.urdf.xacro" />

  <!-- PROPERTY LIST -->
  <!--All units in m-kg-s-radians unit system -->
  <property name="M_PI" value="3.1415926535897931" />

  <!-- Main Body-base -->
  <property name="base_size" value=".84" /> 
  <property name="base_height" value="0.66" /> 
  <property name="leg" value="0.3" /> 
  <property name="base_mass" value="300" /> <!-- in kg-->
 <property name="M_SCALE" value="1" />
  <!--Inertial macros for the box and cylinder. Units are kg*m^2-->
  <macro name="box_inertia" params="m x y z">
    <inertia  ixx="${m*(y*y+z*z)/12}" ixy = "0" ixz = "0"
              iyy="${m*(x*x+z*z)/12}" iyz = "0"
              izz="${m*(x*x+z*z)/12}" /> 
  </macro>

  <!-- BASE-FOOTPRINT -->
  <!-- base_footprint is a fictitious link(frame) that is on the ground right below base_link origin -->
  <link name="odom">


    <visual>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <geometry>
            <box size="0.001 0.001 0.001" />
        </geometry>
    </visual>
  </link>

  <gazebo reference="base_footprint">
    <turnGravityOff>false</turnGravityOff>
  </gazebo>

  <joint name="base_footprint_joint" type="fixed">
  <origin xyz="0 0 ${ball_radius - base_z_origin_to_ball_origin}" rpy="0 0 0" />
    <parent link="odom"/>
    <child link="base_link" />
  </joint>

  <!-- BASE-LINK -->
  <!--Actual body/chassis of the robot-->
  <link name="base_link">
    <inertial>
      <mass value="${base_mass}" />
      <origin xyz="0 0 0" />
      <!--The 3x3 rotational inertia matrix. -->
      <box_inertia  m="${base_mass}" x="${base_size}" y="${base_size}" z="${base_height}"/> 
    </inertial>    
    <visual>
      <origin xyz="0 0 .38" rpy="0 0 0" />
      <geometry>
         <mesh filename="file:///home/nathaniel/Documents/Omnibot/code/catkin_ws/src/omni_shot/models/omniShotFlip.stl" scale="${M_SCALE} ${M_SCALE} ${M_SCALE}"/>
      </geometry>
      <material name="Yellow" />
    </visual>  
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <box size="${base_size} ${base_size} ${base_height}"/>
      </geometry>
    </collision>     
  </link>
  <gazebo reference="base_link">
    <material>Gazebo/Yellow</material>
    <turnGravityOff>false</turnGravityOff>
  </gazebo>

  <!-- WHEELs -->

 <ball name="m1" parent="base_link" x="0"  y="${leg}"  move="0"/>
 <ball name="m2" parent="base_link" x="${-leg}" y="0"  move="1"/>
 <ball name="m3" parent="base_link" x="0"  y="${-leg}" move="0"/>
 <ball name="m4" parent="base_link" x="${leg}"  y="0"  move="1"/>



 <gazebo>
  <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
    <robotNamespace>/mybot</robotNamespace>
    <robotBaseFrame>base_footprint</robotBaseFrame>
    <commandTopic>cmd_vel</commandTopic>
      <odometryTopic>odom</odometryTopic>
      <odometryFrame>odom</odometryFrame>
      <odometryRate>20.0</odometryRate>
  </plugin>
</gazebo>

</robot>

ball.urdf.xacro

<?xml version="1.0"?>
<robot name="ball" xmlns:xacro="http://www ...
(more)
edit retag flag offensive close merge delete

Comments

Hey ngoldfarb, were you able to solve your problem? I'm facing the same problem at the moment... My robot is moving in gazebo, but it is staying at the initial pose in rviz, so that I am not able to create a map

gleb gravatar imagegleb ( 2016-09-05 11:09:19 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
3

answered 2016-01-06 00:29:22 -0600

Humpelstilzchen gravatar image

updated 2016-01-06 09:07:58 -0600

ok for starters you have a link named "odom" in your urdf. This is probably not what you want, because this way the joint of base_link to odom (the position of the robot in the odom frame) can not change.

Your robot will not move unless the tf between odom and base_link is updated.

Please take a look at the Gazebo Ros tutorials on how to use the differential or skid steering plugin.

edit flag offensive delete link more

Comments

I changed to "odom" frame to "base_footprint" and it did not change anything.The problem is that I am trying to simulate a holonomic robot, with a unique wheel layout. I need to have control over each wheel on the robot.

ngoldfarb gravatar imagengoldfarb ( 2016-01-06 08:43:06 -0600 )edit

Maybe take a look at the PlanarMovePlugin, I've never used it but from the description it should be able to move your bot in any direction.

Humpelstilzchen gravatar imageHumpelstilzchen ( 2016-01-06 09:06:39 -0600 )edit

If i use the planermoveplugin do I control the individual wheel speeds or the speed of the robot?

ngoldfarb gravatar imagengoldfarb ( 2016-01-06 14:18:01 -0600 )edit
1

answered 2017-03-30 07:25:40 -0600

Arun Kumar gravatar image

Hi, I had similar problem where my robot was able to move in gazebo but was fixed in rviz.Only the wheels were moving.I checked Fixed Frame attribute under Global Options in Rviz and found out that it had "base_link".I solved it by changing it to "map".

edit flag offensive delete link more
0

answered 2018-08-08 21:49:19 -0600

FerdeLance gravatar image

Similar to the answer by @Arun Kumar. I changed mine from "base_link" to odom and it worked perfectly.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2016-01-05 21:45:32 -0600

Seen: 2,367 times

Last updated: Aug 08 '18