
Hi, I am learning build 3D model with urdf. I am following the book "Mastering ROS for robotics programming". I am confused since all of tutorials relating to urdf, I found online, require to start with a built package. I would like to know if I have a good urdf file, what is the minimum requirement to view this file in RViz? I did the steps below: I started with creating a package folder
$catkin_create_pkg mastering_ros_robot_description_pkg roscpp tf geometry_msgs urdf rviz xacro
I created a sub-folder name urdf and created this pan_tilt.urdf file:
<?xml version="1.0"?>
<robot name="pan_tilt">
<link name="base_link">
<visual>
<geometry>
<cylinder length="0.01" radius="0.2"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="yellow">
<color rgba="1 1 0 1"/>
</material>
</visual>
</link>
<joint name="pan_joint" type="revolute">
<parent link="base_link"/>
<child link="pan_link"/>
<origin xyz="0 0 0.1"/>
<axis xyz="0 0 1" />
<limit effort="300" velocity="0.1" lower="-3.14" upper="3.14"/>
</joint>
<link name="pan_link">
<visual>
<geometry>
<cylinder length="0.4" radius="0.04"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0.09"/>
<material name="red">
<color rgba="0 0 1 1"/>
</material>
</visual>
</link>
<joint name="tilt_joint" type="revolute">
<parent link="pan_link"/>
<child link="tilt_link"/>
<origin xyz="0 0 0.2"/>
<axis xyz="0 1 0" />
<limit effort="300" velocity="0.1" lower="-4.64" upper="-1.5"/>
</joint>
<link name="tilt_link">
<visual>
<geometry>
<cylinder length="0.4" radius="0.04"/>
</geometry>
<origin rpy="0 1.5 0" xyz="0 0 0"/>
<material name="green">
<color rgba="1 0 0 1"/>
</material>
</visual>
</link>
</robot>
I checked that the urdf file does not contain any error:
ubuntu@tegra-ubuntu:~/Documents/WorkSpaceMasteringRosRobot/mastering_ros_robot_d
escription_pkg/urdf$ check_urdf pan_tilt.urdf
robot name is: pan_tilt
---------- Successfully Parsed XML ---------------
root Link: base_link has 1 child(ren)
child(1): pan_link
child(1): tilt_link
I created another folder same level with urdf folder name launch. I created view_demo.launch file
<launch>
<arg name="model" />
<param name="robot_description" textfile="$(find mastering_ros_robot_description_pkg)/urdf/pan_tilt.urdf" />
<param name="use_gui" value="true"/>
<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" args="-d $(find mastering_ros_robot_description_pkg)/urdf.rviz" required="true" />
</launch>
From package folder, I ran this launch file and I got below error:
ubuntu@tegra-ubuntu:~/Documents/WorkSpaceMasteringRosRobot/mastering_ros_robot_d
escription_pkg$ roslaunch mastering_ros_robot_description_pkg view_demo.launch
[view_demo.launch] is neither a launch file in package [mastering_ros_robot_description_pkg] nor is [mastering_ros_robot_description_pkg] a launch file name
The traceback for the exception was written to the log file
Please tell me what I am missing and how to solve the problem. Thank you for your time reading and answering my question.
Regards, Thang Nguyen
Edit 1: Sorry, the code format does not work with my edit.
Thanks for your help I ran catkin_make to compile the package then I try to ran the view_demo.launch file again. I got an error with rviz. I am not sure what it is. Below is the message when I ran launch file.
- My question is I cannot find the .ros folder in ubuntu folder. How to access this log file?
- What is the error about?
- What is urdf.rviz file? I saw this file in the book code but I would like how to create this file as well as urdf.vcg. Does these files required by rviz?
Console:
ubuntu@tegra-ubuntu:~/Documents/WorkSpaceMasteringRosRobot$ roslaunch mastering_ros_robot_description_pkg view_demo.launch
... logging to /home/ubuntu/.ros/log/525e4ccc-7966-11e6-b943-00044b581868/roslaunch-tegra-ubuntu-1614.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://tegra-ubuntu:48702/
SUMMARY
PARAMETERS
- /robot_description: <?xml version="1....
- /rosdistro: indigo
- /rosversion: 1.11.19
- /use_gui: True
NODES
/
joint_state_publisher (joint_state_publisher/joint_state_publisher)
robot_state_publisher (robot_state_publisher/state_publisher)
rviz (rviz/rviz)
auto-starting new master
process[master]: started with pid [1625]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to 525e4ccc-7966-11e6-b943-00044b581868
process[rosout-1]: started with pid [1638]
started core service [/rosout]
process[joint_state_publisher-2]: started with pid [1641]
process[robot_state_publisher-3]: started with pid [1647]
process[rviz-4]: started with pid [1654]
================================================================================REQUIRED process [rviz-4] has died!
process has died [pid 1654, exit code -7, cmd /opt/ros/indigo/lib/rviz/rviz -d /home/ubuntu/Documents/WorkSpaceMasteringRosRobot/src/mastering_ros_robot_description_pkg/urdf.rviz __name:=rviz __log:=/home/ubuntu/.ros/log/525e4ccc-7966-11e6-b943-00044b581868/rviz-4.log].
log file: /home/ubuntu/.ros/log/525e4ccc-7966-11e6-b943-00044b581868/rviz-4*.log
Initiating shutdown!
================================================================================
[rviz-4] killing on exit
[robot_state_publisher-3] killing on exit
[joint_state_publisher-2] killing on exit
[joint_state_publisher-2] escalating to SIGTERM
[joint_state_publisher-2] escalating to SIGKILL
[rosout-1] killing on exit
[master] killing on exit
Shutdown errors:
- process[joint_state_publisher-2, pid 1641]: required SIGKILL. May still be running.
shutting down processing monitor...
... shutting down processing monitor complete
done
Edit 2: Error when run launch file directly from launch folder Screenshot launch file.png
Originally posted by Thang Nguyen on ROS Answers with karma: 93 on 2016-09-12
Post score: 1
Original comments
Comment by bhavyadoshi26 on 2016-09-12:
Did you build the package after creating it?
Also have you checked the $ROS_PACKAGE_PATH ?
Comment by Thang Nguyen on 2016-09-12:
I have not done this yet. Thank you for reminding me.
