0
$\begingroup$

Rosanswers logo

Hello,

I am trying to create costume robot. I have been trying to follow this tutorial. www.romin.upm.es/wiki/index.php?title=ROS%3ATutorials/Build_Your_Own_URDF_Robot

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

  <!-- 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.ros.org/wiki/xacro">
 
  <!-- balls -->
  <property name="ball_radius" value="0.121285" /> 
  <property name="ball_mass" value="0.625" /> <!-- in kg-->
 
  <property name="base_x_origin_to_ball_origin" value="0.25" />
  <property name="base_y_origin_to_ball_origin" value="0.3" />
  <property name="base_z_origin_to_ball_origin" value="0.0" />
 
  <macro name="sphere_inertia" params="m r">
    <inertia  ixx="${(2*m*r*r)/5}" ixy = "0" ixz = "0"
              iyy="${(2*m*r*r)/5}" iyz = "0"
              izz="${(2*m*r*r)/5}" /> 
  </macro>
 
  <xacro:macro name="ball" params="name parent x y  move"> <!--fb : front, back ; lr: left, right -->

    <link name="${name}_ball">
      
      <collision>
        <origin xyz="0 0 0" rpy="${(M_PI/2)} 0 0" />
        <geometry>
          <sphere radius="${ball_radius}" />
        </geometry>
      </collision>
      <inertial>
        <mass value="${ball_mass}" />
        <origin xyz="0 0 0" />
        <sphere_inertia  m="${ball_mass}" r="${ball_radius}" />
      </inertial>
    </link>
 
    <gazebo reference="${name}_ball">
      <mu1 value="1000.0"/>
      <mu2 value="0.1"/>
      <kp  value="10000000.0" />
      <kd  value="1.0" />
      <fdir1 value="1 0 0"/>
      <material>Gazebo/Grey</material>
      <turnGravityOff>false</turnGravityOff>
    </gazebo>
 
    <joint name="${name}_ball_joint" type="continuous">
      <parent link="${parent}"/>
      <child link="${name}_ball"/>
      <origin xyz="${x} ${y} -0.25" rpy="0 0 ${move*(M_PI/2)}" /> 
      <axis xyz="0 1 0" rpy="0 0 0" />
      <limit effort="100" velocity="100"/>
      <joint_properties damping="1.0" friction="1.0"/>
    </joint>
    
   

    <!-- Transmission is important to link the joints and the controller -->
    <transmission name="${name}_ball_joint_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="${name}_ball_joint">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
       </joint>
      <actuator name="${name}_ball_joint_motor">
        <mechanicalReduction>1</mechanicalReduction>
      </actuator>
    </transmission>
 
  </xacro:macro>
</robot>
omnishot.launch
  <!-- 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="worlds/empty.world" />
    <arg name="paused" value="$(arg paused)" />
    <arg name="debug" value="$(arg debug)" />
    <arg name="gui" value="$(arg gui)" />
    <arg name="use_sim_time" value="true" />
    <arg name="headless" value="false" />
  </include>
 
  <!-- urdf xml robot description loaded on the Parameter Server-->
  <param name="robot_description" command="$(find xacro)/xacro.py '$(find omni_shot)/urdf/omnishot.urdf.xacro'" />
 
  <!-- push robot_description to factory and spawn robot in gazebo -->
  <node name="labrob_spawn" pkg="gazebo_ros" type="spawn_model" output="screen" 
    args="-urdf -param robot_description -model omnishot" />

  <node name="rviz" pkg="rviz" type="rviz" required="true" />
    <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find omni_shot)/config/config.yaml" command="load" />
    <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" output="screen" respawn="false" ns="/mybot" args="joint_state_controller
                                              m1_effort_controller
                                              m2_effort_controller
                                              m3_effort_controller
                                              m4_effort_controller" />
 
    
  <node name="simMotors" pkg="omni_shot" type="simVel.py"/>
 
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen">
    
    <remap from="/joint_states" to="/mybot/joint_states" />
  </node>

</launch>

Originally posted by ngoldfarb on ROS Answers with karma: 127 on 2016-01-05

Post score: 0


Original comments

Comment by gleb on 2016-09-05:
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

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Humpelstilzchen with karma: 1504 on 2016-01-06

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by ngoldfarb on 2016-01-06:
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.

Comment by Humpelstilzchen on 2016-01-06:
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.

Comment by ngoldfarb on 2016-01-06:
If i use the planermoveplugin do I control the individual wheel speeds or the speed of the robot?

$\endgroup$
0
$\begingroup$

Rosanswers logo

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".


Originally posted by Arun Kumar with karma: 11 on 2017-03-30

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

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


Originally posted by FerdeLance with karma: 43 on 2018-08-08

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.