1
$\begingroup$

I get my URDF using SW2URDF plugin in SolidWorks. Iam following this instruction. From the instruction, I need to add link and joint as "world" and set the child link to the base link, (It is needed since Im having an warning "The root link base_link has an inertia specified in the URDF, but KDL does not support a root link with an inertia." and the model is not appearing if not added). One thing I noticed is that the xyz origin of the joint "world" is 0.17 which makes my model floating in gazebo.

<joint 
  name="world_joint" 
  type="fixed">
  <parent 
    link="world"/>    
  <child 
    link="base_link"/>
  <origin 
    rpy="0 0 0" 
    xyz="0.0 0.0 0.17"/>
</joint>

enter image description here I dont know why but Im expecting that the gravity should take effect, that even it is floating, the model should drop once it is running. Then, I checked the "link" from the "ground_plane" under "Model" tab and the gravity is set to False, I tried to click it to change to True but it always goes to False.

I also tried to change the xyz origin of the "world" joint, expecting that the model should have contact in the ground:

<joint 
  name="world_joint" 
  type="fixed">
  <parent 
    link="world"/>    
  <child 
    link="base_link"/>
  <origin 
    rpy="0 0 0" 
    xyz="0.0 0.0 0.0"/>
</joint>

But all the models are on the center. What could be the problem? enter image description here The model is good only when the z value is 0.17.

BTW, Im doing a differential drive robot. I also added libgazebo_ros_diff_drive to drive the wheels, no problem with that as the wheels are moving when I publish in /cmd_vel, but the robot is not moving as it is floating.

$\endgroup$
2
  • $\begingroup$ My advice is to install an existing wheeled-robot simulation and study it to understand how the different parts work. If you are using gazebo-classic, this is a popular one: wiki.ros.org/turtlebot3_simulations In particular, you must have the correct .world file, or the simulator behavior is not going to be what you expect. $\endgroup$
    – Mike973
    Commented Nov 9, 2023 at 13:14
  • $\begingroup$ Thanks for the comment, I have the mir_robot package as base reference of the urdf. I also studied turtlebot3. both packages is xacro file instead of urdf but I think it is just the same, would you advise to convert the urdf to xacro? For the world file, Im just using the empty world of gazebo, but both of the packages have their own empty world, do I need to create my own world too? $\endgroup$
    – racaraca69
    Commented Nov 12, 2023 at 13:22

2 Answers 2

2
$\begingroup$

The instructions to attach the base link to "world" would apply if you're modeling a robot with a fixed base, e.g. a fixed robot arm. For mobile robots, you should not need this joint. You can instead set an initial z offset when spawning the robot into Gazebo (i.e, in the launch file) so it's not buried in the ground when simulation starts.

$\endgroup$
2
  • $\begingroup$ This is what I thought at first, why do I need fixed link from world to base_link. But when I delete the link and joint of the world, Im having this error "The root link base_link has an inertia specified in the URDF, but KDL does not support a root link with an inertia" and upon searching, the solution is to have a dummy fixed link where the child link of the joint is the base_link. I also tried to set the z axis when spawning the model, but since I dont have fixed link on my base_link, I still have the same problem (second picture) $\endgroup$
    – racaraca69
    Commented Nov 12, 2023 at 13:16
  • $\begingroup$ Update: I already got it to work now, I use the turtlebot3 as reference (thanks Mike973). It still does have the fixed link, then I format my urdf to xacro, create empty world and it works, but I have a new problem because my left wheel is not appearing on gazebo. important part is that the model is on the ground, I still dont know whether any of these (formating urdf to xacro and creating empty world) solves the problem. Thanks for your comment . $\endgroup$
    – racaraca69
    Commented Nov 12, 2023 at 14:38
2
$\begingroup$

I resolved it by changing the model (redesigning the model on Solidworks)

All the wheels should be touching the floor, in my case the caster wheel is above the ground by 1mm and gazebo is not happy with that making it difficult to check the coordinate system and axis of the part.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.