URDF + RVIZ , RobotModel Not showing correctly
Hi, I am trying to simulate a car on RVIZ only using URDF and Launch file and seems to not be working. The wheels are in the middle of robot which makes no sense because when I view on on a URDF online view it displays it correctly. Been struggling for awhile now. Any help will be much appreciated. Thanks!
Online URDF viewer:
RVIZ:
URDF Code:
<?xml version='1.0'?>
<robot name="fourwheelrobot">
<!-- Base link -->
<link name="base_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="1 0.5 0.25"/>
</geometry>
<material name="yellow">
<color rgba="0.8 0.8 0 1"/>
</material>
</visual>
</link>
<!-- Front Right Wheel -->
<link name="f_r_wheel">
<visual>
<origin xyz="0 0 0" rpy="1.570795 0 0" />
<geometry>
<cylinder length="0.1" radius="0.2" />
</geometry>
<material name="black">
<color rgba="0.05 0.05 0.05 1"/>
</material>
</visual>
</link>
<joint name="joint_f_r_wheel" type="continuous">
<parent link="base_link"/>
<child link="f_r_wheel"/>
<origin xyz="0.25 -0.30 0" rpy="0 0 0" />
<axis xyz="0 1 0" rpy="0 0 0" />
</joint>
<!-- Back Right Wheel -->
<link name="b_r_wheel">
<visual>
<origin xyz="0 0 0" rpy="1.570795 0 0" />
<geometry>
<cylinder length="0.1" radius="0.2" />
</geometry>
<material name="black"/>
</visual>
</link>
<joint name="joint_b_r_wheel" type="continuous">
<parent link="base_link"/>
<child link="b_r_wheel"/>
<origin xyz="-0.25 -0.30 0" rpy="0 0 0" />
<axis xyz="0 1 0" rpy="0 0 0" />
</joint>
<!-- Front Left Wheel -->
<link name="f_l_wheel">
<visual>
<origin xyz="0 0 0" rpy="1.570795 0 0" />
<geometry>
<cylinder length="0.1" radius="0.2" />
</geometry>
<material name="black"/>
</visual>
</link>
<joint name="joint_f_l_wheel" type="continuous">
<parent link="base_link"/>
<child link="f_l_wheel"/>
<origin xyz="0.25 0.30 0" rpy="0 0 0" />
<axis xyz="0 1 0" rpy="0 0 0" />
</joint>
<!-- Back Left Wheel -->
<link name="b_l_wheel">
<visual>
<origin xyz="0 0 0" rpy="1.570795 0 0" />
<geometry>
<cylinder length="0.1" radius="0.2" />
</geometry>
<material name="black"/>
</visual>
</link>
<joint name="joint_b_l_wheel" type="continuous">
<parent link="base_link"/>
<child link="b_l_wheel"/>
<origin xyz="-0.25 0.30 0" rpy="0 0 0" />
<axis xyz="0 1 0" rpy="0 0 0" />
</joint>
Launch File:
<launch>
<param name="robot_description" textfile="$(find ros_robotics)/urdf/lauroRobot.urdf" />
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" required="true" />
</launch>
</robot>
Asked by MechLc on 2018-02-03 14:52:46 UTC
Answers
This is how I, successfully, displayed your model on my computer(using rosdistro melodic).
a. I copy-pasted your urdf file in a file named "fourwheel.urdf" and placed it in a folder catkin_ws/src/own_urdf/urdf. I also added a tag "< /robot>" in the end.
b. I also copy-pasted your launch file in the launch folder of under "own_urdf" folder.
I made following changes in your launch file.
1) In first line changed pkgname and filename to as per my pkgname and urdf-file
2) In 2nd line changed type and pkg to "joint_state_publisher_gui"
(If you do not have this pkg, u can install it.)
3) In third line changed type to "robot_state_publisher" instead of "state_publisher".
c. I ran the command "roslaunch own_urdf
d. In rviz window I changed the fixed_frame to "base_link" through drop-down arrow.
e. In the rviz window, I clicked "Add" to add the RobotModel and TF.
The robot model is now displaying correctly. If I move sliders on GUI window, the wheels in model in rviz window will appear to be turning. Since joint_f_l_wheel and joint_b_l_wheel are in front, you can see them better. You can zoom-in the model to see this movement more clearly. However, your robot will not move. Perhaps you need to add "transmission" to move the robot as a whole.
Asked by shiraz_baig on 2020-11-19 00:50:06 UTC
Comments
Works fine on my computer (once I moved the end robot tag from the launch file to the urdf). Is there any terminal output?
Asked by David Lu on 2018-02-05 08:55:22 UTC
were you able to solve your problem? how?
Asked by shiraz_baig on 2020-11-13 08:41:35 UTC