Unable to render model in RViz
I'm attempting to follow this tutorial for controlling a robot in a Gazebo simulation. I can view my model in Rviz by itself just fine. I can view my model in Gazebo by itself just fine. But when I run the tutorial's command:
roslaunch mybot_gazebo mybot_gazebo.launch
to load both Rviz and Gazebo simultaneously along with a controller and state publisher, Gazebo renders the model, but doesn't seem to simulate physics even though the simulation is running and consuming 100% CPU, and RViz renders nothing at all in the 3d panel even though the left-hand panel shows no errors:
At the terminal, I see the warning:
Warning: Controller Spawner couldn't find the expected controller_manager ROS interface.
What's causing this?
My model in mybot_description/models/mybot.urdf.xacro:
<?xml version="1.0"?>
<robot name="mybot"
xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="box_inertia" params="mass x y z">
<inertia
ixx="${mass*(y*y+z*z)/12}" ixy="0" ixz="0"
iyy="${mass*(x*x+z*z)/12}" iyz="0" izz="${mass*(x*x+z*z)/12}" />
</xacro:macro>
<xacro:include filename="$(find mybot_description)/models/materials.urdf.xacro" />
<!-- width in meters -->
<property name="torso_x_size" value="0.1" />
<!-- length in meters -->
<property name="torso_y_size" value="0.205" />
<!-- height in meters -->
<property name="torso_z_size" value="0.03" />
<!-- torso mass (not including legs) in kg -->
<property name="torso_mass" value="0.920" />
<!-- distance from ground to shoulders when standing at full height -->
<property name="total_leg_height" value="0.158" />
<!-- mass of a single upper leg piece in kg -->
<property name="upper_leg_mass" value="0.010" />
<property name="upper_leg_depth" value="0.003" />
<property name="upper_leg_length" value="0.04" />
<property name="upper_leg_thickness" value="0.005" />
<link name="base_footprint">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.001 0.001 0.001" />
</geometry>
</visual>
<inertial>
<mass value="0.0001" />
<origin xyz="0 0 0" />
<inertia
ixx="0.0001" ixy="0.0" ixz="0.0"
iyy="0.0001" iyz="0.0" izz="0.0001" />
</inertial>
</link>
<gazebo reference="base_footprint">
<turnGravityOff>false</turnGravityOff>
</gazebo>
<joint name="base_footprint_joint" type="fixed">
<origin xyz="0 0 ${total_leg_height}" rpy="0 0 0" />
<parent link="base_footprint"/>
<child link="base_link" />
</joint>
<link name="base_link">
<visual>
<geometry>
<box size="${torso_x_size} ${torso_y_size} ${torso_z_size}" />
</geometry>
<material name="red"/>
</visual>
<collision>
<geometry>
<box size="${torso_x_size} ${torso_y_size} ${torso_z_size}" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="${torso_mass}" />
<xacro:box_inertia
mass="${torso_mass}"
x="${torso_x_size}" y="${torso_y_size}" z="${torso_z_size}" />
</inertial>
</link>
<gazebo reference="base_link">
<material>Gazebo/Red</material>
<turnGravityOff>false</turnGravityOff>
</gazebo>
<xacro:macro name="leg" params="name reflect_x reflect_y">
<link name="${name}">
<visual>
<geometry>
<box size="${upper_leg_depth} ${upper_leg_length} ${upper_leg_thickness}" />
</geometry>
<origin xyz="${upper_leg_depth/2*reflect_x} ${upper_leg_length/2} 0" rpy="0 0 0"/>
<material name="blue" />
</visual>
<collision>
<geometry>
<box size="${upper_leg_depth} ${upper_leg_length} ${upper_leg_thickness}" />
</geometry>
<origin xyz="${upper_leg_depth/2*reflect_x} ${upper_leg_length/2} 0" rpy="0 0 0"/>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="${upper_leg_mass}" />
<xacro:box_inertia
mass="${upper_leg_mass}"
x="${upper_leg_depth}" y="${upper_leg_length}" z="${upper_leg_thickness}" />
</inertial>
</link>
<gazebo reference="${name}">
<mu1 value="1.0"/>
<mu2 value="1.0"/>
<kp value="10000000.0" />
<kd value="1.0" />
<fdir1 value="1 0 0"/>
<material>Gazebo/Blue</material>
<turnGravityOff>false</turnGravityOff>
</gazebo>
<joint name="torso_to_${name}_joint" type="continuous">
<parent link="base_link"/>
<child link="${name}"/>
<origin xyz="${(torso_x_size/2)*reflect_x} ${torso_y_size/2*reflect_y} ${-torso_z_size*0.25}" />
<axis xyz="1 0 0" rpy="0 0 0" />
<limit effort="100" velocity="100"/>
<joint_properties damping="0.0" friction="0.0"/>
</joint>
<gazebo reference="torso_to_${name}_joint">
</gazebo>
<transmission name="torso_to_${name}_joint_trans">
<type>transmission_interface/SimpleTransmission</type>
<joint name="torso_to_${name}_joint">
<hardwareInterface>EffortJointInterface</hardwareInterface>
</joint>
<actuator name="torso_to_${name}_joint_motor">
<hardwareInterface>EffortJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
</xacro:macro>
<xacro:leg name="front_right_leg" reflect_x="1" reflect_y="1" />
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/mybot</robotNamespace>
</plugin>
</gazebo>
</robot>
My mybotcontrol/config/jointposition_control.yaml:
mybot:
# Publish all joint states -----------------------------------
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
# Position Controllers ---------------------------------------
torso_to_front_right_leg_joint_position_controller:
type: effort_controllers/JointPositionController
joint: torso_to_front_right_leg_joint
pid: {p: 100.0, i: 0.01, d: 10.0}
And my gazebo launch file:
<launch>
<!-- roslaunch arguments -->
<arg name="show_rviz" default="true"/>
<arg name="paused" default="false"/>
<arg name="debug" default="false"/>
<arg name="gui" default="true"/>
<!-- 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 mybot_description)/models/mybot.urdf.xacro'" />
<!-- push robot_description to factory and spawn robot in gazebo -->
<node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
args="-urdf -param robot_description -model mybot" />
<!-- robot visualization in Rviz -->
<group if="$(arg show_rviz)">
<node name="rviz" pkg="rviz" type="rviz" output="screen" args="-d $(find mybot_gazebo)/config/gazebo.rviz"/>
<!-- load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find mybot_control)/config/joint_position_control.yaml" command="load" />
<!-- load the controllers -->
<node name="mybot_controller" pkg="controller_manager" type="spawner" output="screen"
args="joint_state_controller" />
<!-- publish all the frames to TF -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
<param name="publish_frequency" value="50"/> <!-- Hz -->
</node>
</group>
</launch>
and my mybot_gazebo/config/gazebo.rviz:
Panels:
- Class: rviz/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
Splitter Ratio: 0.5
Tree Height: 434
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.588679
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: ""
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.03
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Fixed Frame: base_link
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Topic: /initialpose
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 10
Enable Stereo Rendering:
Stereo Eye Separation: 0.06
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: 0
Y: 0
Z: 0
Name: Current View
Near Clip Distance: 0.01
Pitch: 0.785398
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 0.785398
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 738
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd00000004000000000000013c00000241fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006100fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003f00000241000000d700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f00000241fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003f00000241000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000005000000003efc0100000002fb0000000800540069006d0065010000000000000500000002f500fffffffb0000000800540069006d00650100000000000004500000000000000000000002a90000024100000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 1280
X: 0
Y: 27
Asked by Cerin on 2015-05-19 00:05:04 UTC
Comments