What are the default input and output ports of a model that is loaded via
model = parser.AddModelFromFile("myfile.sdf")
?
In particular, I am wondering what the order of variables is. I'm quite confused since I am loading a robot with 10 Joints, thus I would expect
plant.get_state_output_port(model).size()
to be 20. I.e. 10 Joint positions, and 10 Joint velocities. However, when loading the robot the above yields 16, which to me seems rather strange. This also raises the question of how the variables are ordered, i.e. first all positions or by joint?
The sdf file I was loading is:
<?xml version="1.0"?>
<sdf version="1.7">
<model name="two_planar_cc_segments">
<link name="robot_base">
<pose> 0 0 0 0 0 0</pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="robot_base_col">
<geometry>
<cylinder>
<length> 0.0001 </length>
<radius> 0.01 </radius>
</cylinder>
</geometry>
</collision>
<visual name="robot_base_vis">
<material>
<diffuse>1.0 0.0 0.0 1.0</diffuse>
</material>
<geometry>
<cylinder>
<length> 0.0001 </length>
<radius> 0.01 </radius>
</cylinder>
</geometry>
</visual>
</link>
<!-- This is the first CC Segment -->
<link name="s1l0">
<pose relative_to="robot_base"> 0 0 0 1.570796327 0 0 </pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s1l0_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s1l0_vis">
<material>
<diffuse>1.0 1.0 1.0 1.0</diffuse>
</material>
<geometry>
<empty></empty>
</geometry>
</visual>
</link>
<joint name="s1q0" type="revolute">
<pose relative_to="robot_base"> 0 0 0 0 0 0</pose>
<parent> robot_base </parent>
<child> s1l0 </child>
<axis>
<xyz> 0 0 1 </xyz>
</axis>
</joint>
<link name="s1l1">
<pose relative_to="s1l0"> 0 0 0 0 0 0 </pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s1l1_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s1l1_vis">
<material>
<diffuse>1.0 1.0 1.0 1.0</diffuse>
</material>
<geometry>
<empty></empty>
</geometry>
</visual>
</link>
<joint name="s1q1" type="revolute">
<pose relative_to="s1q0">0 0 0 1.570796327 0 0 </pose>
<parent> s1l0 </parent>
<child> s1l1 </child>
<axis>
<xyz>0 0 1</xyz>
</axis>
</joint>
<link name="s1l2">
<pose relative_to="s1l1"> 0 0 0 1.570796327 0 0</pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s1l2_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s1l2_vis">
<material>
<diffuse>0.0 1.0 0.0 1.0</diffuse>
</material>
<geometry>
<cylinder>
<length> 0.0001 </length>
<radius> 0.01 </radius>
</cylinder>
</geometry>
</visual>
</link>
<joint name="s1q2" type="prismatic">
<pose relative_to="s1q1">0 0 0 0 0 0 </pose>
<parent> s1l1 </parent>
<child> s1l2 </child>
<axis>
<xyz>0 1 0</xyz>
<dynamics>
<friction>1</friction>
<damping>1</damping>
</dynamics>
<limit>
<lower>0.0</lower>
<upper>0.1</upper>
</limit>
</axis>
</joint>
<link name="s1l3">
<pose relative_to="s1l2"> 0 0 0 0 0 0</pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s1l3_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s1l3_vis">
<material>
<diffuse>0.0 0.0 1.0 1.0</diffuse>
</material>
<geometry>
<cylinder>
<length> 0.0001 </length>
<radius> 0.01 </radius>
</cylinder>
</geometry>
</visual>
</link>
<joint name="s1q3" type="prismatic">
<pose relative_to="s1q2">0 0 0 -1.570796327 0 0 </pose>
<parent> s1l2 </parent>
<child> s1l3 </child>
<axis>
<xyz>0 0 1</xyz>
<dynamics>
<friction>1</friction>
<damping>1</damping>
</dynamics>
<limit>
<lower>0.0</lower>
<upper>0.1</upper>
</limit>
</axis>
</joint>
<link name="s1l4">
<pose relative_to="s1l3"> 0 0 0 1.570796327 0 0</pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s1l4_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s1l4_vis">
<material>
<diffuse>0.0 0.0 1.0 1.0</diffuse>
</material>
<geometry>
<empty></empty>
</geometry>
</visual>
</link>
<joint name="s1q4" type="revolute">
<pose relative_to="s1q3">0 0 0 0 0 0 </pose>
<parent> s1l3 </parent>
<child> s1l4 </child>
<axis>
<xyz>0 1 0</xyz>
</axis>
</joint>
<frame name="s1-ee-link">
<pose relative_to="s1q4">0 0 0 0 0 0</pose>
</frame>
<!-- Till Here -->
<!-- This is the first CC Segment -->
<link name="s2l0">
<pose relative_to="s1l4"> 0 0 0 0 0 0 </pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s2l0_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s2l0_vis">
<material>
<diffuse>1.0 1.0 1.0 1.0</diffuse>
</material>
<geometry>
<empty></empty>
</geometry>
</visual>
</link>
<joint name="s2q0" type="revolute">
<pose relative_to="s1l4"> 0 0 0 1.570796327 0 0</pose>
<parent> s1l4 </parent>
<child> s2l0 </child>
<axis>
<xyz> 0 0 1 </xyz>
</axis>
</joint>
<link name="s2l1">
<pose relative_to="s2l0"> 0 0 0 0 0 0 </pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s2l1_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s2l1_vis">
<material>
<diffuse>1.0 1.0 1.0 1.0</diffuse>
</material>
<geometry>
<empty></empty>
</geometry>
</visual>
</link>
<joint name="s2q1" type="revolute">
<pose relative_to="s2q0">0 0 0 1.570796327 0 0 </pose>
<parent> s2l0 </parent>
<child> s2l1 </child>
<axis>
<xyz>0 0 1</xyz>
</axis>
</joint>
<link name="s2l2">
<pose relative_to="s2l1"> 0 0 0 1.570796327 0 0</pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s2l2_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s2l2_vis">
<material>
<diffuse>0.0 1.0 0.0 1.0</diffuse>
</material>
<geometry>
<cylinder>
<length> 0.0001 </length>
<radius> 0.01 </radius>
</cylinder>
</geometry>
</visual>
</link>
<joint name="s2q2" type="prismatic">
<pose relative_to="s2q1">0 0 0 0 0 0 </pose>
<parent> s2l1 </parent>
<child> s2l2 </child>
<axis>
<xyz>0 1 0</xyz>
<dynamics>
<friction>1</friction>
<damping>1</damping>
</dynamics>
<limit>
<lower>0.0</lower>
<upper>0.1</upper>
</limit>
</axis>
</joint>
<link name="s2l3">
<pose relative_to="s2l2"> 0 0 0 0 0 0</pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s2l3_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s2l3_vis">
<material>
<diffuse>0.0 0.0 1.0 1.0</diffuse>
</material>
<geometry>
<cylinder>
<length> 0.0001 </length>
<radius> 0.01 </radius>
</cylinder>
</geometry>
</visual>
</link>
<joint name="s2q3" type="prismatic">
<pose relative_to="s2q2">0 0 0 -1.570796327 0 0 </pose>
<parent> s2l2 </parent>
<child> s2l3 </child>
<axis>
<xyz>0 0 1</xyz>
<dynamics>
<friction>1</friction>
<damping>1</damping>
</dynamics>
<limit>
<lower>0.0</lower>
<upper>0.1</upper>
</limit>
</axis>
</joint>
<link name="s2l4">
<pose relative_to="s2l3"> 0 0 0 1.570796327 0 0</pose>
<inertial>
<mass>0.01</mass>
<inertia>
<ixx>0.001</ixx>
<ixy>0.0</ixy>
<ixz>0.0</ixz>
<iyy>0.001</iyy>
<iyz>0.0</iyz>
<izz>0.001</izz>
</inertia>
</inertial>
<collision name="s2l4_col">
<geometry>
<empty></empty>
</geometry>
</collision>
<visual name="s2l4_vis">
<material>
<diffuse>0.0 0.0 1.0 1.0</diffuse>
</material>
<geometry>
<empty></empty>
</geometry>
</visual>
</link>
<joint name="s2q4" type="revolute">
<pose relative_to="s2q3">0 0 0 0 0 0 </pose>
<parent> s2l3 </parent>
<child> s2l4 </child>
<axis>
<xyz>0 1 0</xyz>
</axis>
</joint>
<frame name="s2-ee-link">
<pose relative_to="s2q4">0 0 0 0 0 0</pose>
</frame>
<!-- Till Here -->
</model>
</sdf>
As Xuchen mentioned, it's because your model is by default floating.
If you wish to fixture the model, then you should get the desired coordinates you want; alternatively, you may need to mask the DoFs you want.
Example: quick deepnote ipynb
I made a URDF-File for a 4-wheeled Robot. I would like to test it in Gazebo. I have it working so far. I have 4 wheels, they also turn. I confirmed this by turning on View -> Wireframe. I am using the skid_steer_drive_controller and rosrun teleop_twist_keyboard teleop_twist_keyboard.py. I can see the wheels turning but the Robot does not move.
I am using an offset for my base_footprint, otherwise my robot collapses and starts jiggeling. I also took this offset in the z-Axis in account for the wheels.
I took this urdf as basis, here so i did not declare friction:
This is my URDF:
<?xml version="1.0" ?>
<robot name="explorer">
<link name="world">
</link>
<!-- -->
<link name="base_footprint">
<visual>
<origin xyz="0 0 0.046"/>
<geometry>
<box size="0.235 0.094 0.049"/>
</geometry>
<material name="gray">
<color rgba=".2 .2 .2 1" />
</material>
</visual>
<inertial>
<origin xyz="0 0 0.046"/>
<mass value="0.6174" />
<inertia ixx="2.84523645e-3" ixy="0.0" ixz="0" iyy="3.1763172e-3" iyz="0" izz="5.7814365e-4" />
</inertial>
<collision>
<origin xyz="0 0 0.046"/>
<geometry>
<box size="0.235 0.094 0.049"/>
</geometry>
</collision>
</link>
<joint name="dummy_joint" type="fixed">
<parent link="world"/>
<child link="base_footprint"/>
</joint>
<!-- -->
<link name="wheel_rf">
<inertial>
<mass value="0.036" />
<inertia ixx="9.2562e-5" ixy="0.0" ixz="0" iyy="9.2562e-5" iyz="0" izz="2.9124e-5" />
</inertial>
<visual>
<geometry>
<cylinder radius="0.033" length="0.026"/>
</geometry>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder radius="0.033" length="0.026"/>
</geometry>
</collision>
</link>
<joint name="wheel_rf_joint" type="continuous">
<origin xyz="0.04 0.063 0.033" rpy="1.57 0.0 0.0"/>
<parent link="base_footprint"/>
<child link="wheel_rf"/>
<axis xyz="0.0 0.0 1.0"/>
</joint>
<link name="wheel_lf">
<inertial>
<mass value="0.036" />
<inertia ixx="9.2562e-5" ixy="0.0" ixz="0" iyy="9.2562e-5" iyz="0" izz="2.9124e-5" />
</inertial>
<visual>
<geometry>
<cylinder radius="0.033" length="0.026"/>
</geometry>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder radius="0.033" length="0.026"/>
</geometry>
</collision>
</link>
<joint name="wheel_lf_joint" type="continuous">
<origin xyz="0.04 -0.063 0.033" rpy="1.57 0.0 0.0"/>
<parent link="base_footprint"/>
<child link="wheel_lf"/>
<axis xyz="0.0 0.0 1.0"/>
</joint>
<!-- -->
<link name="wheel_rb">
<inertial>
<mass value="0.036" />
<inertia ixx="9.2562e-5" ixy="0.0" ixz="0" iyy="9.2562e-5" iyz="0" izz="2.9124e-5" />
</inertial>
<visual>
<geometry>
<cylinder radius="0.033" length="0.026"/>
</geometry>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder radius="0.033" length="0.026"/>
</geometry>
</collision>
</link>
<joint name="wheel_rb_joint" type="continuous">
<origin xyz="-0.04 0.063 0.033" rpy="1.57 0.0 0.0"/>
<parent link="base_footprint"/>
<child link="wheel_rb"/>
<axis xyz="0.0 0.0 1.0"/>
</joint>
<!-- -->
<link name="wheel_lb">
<inertial>
<mass value="0.036" />
<inertia ixx="9.2562e-5" ixy="0.0" ixz="0" iyy="9.2562e-5" iyz="0" izz="2.9124e-5" />
</inertial>
<visual>
<geometry>
<cylinder radius="0.033" length="0.026"/>
</geometry>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder radius="0.033" length="0.026"/>
</geometry>
</collision>
</link>
<joint name="wheel_lb_joint" type="continuous">
<origin xyz="-0.04 -0.063 0.033" rpy="1.57 0.0 0.0"/>
<parent link="base_footprint"/>
<child link="wheel_lb"/>
<axis xyz="0.0 0.0 1.0"/>
</joint>
<!-- Gazebo colors to links as upper defined colors are only visible in RVIZ-->
<gazebo reference="base_footprint">
<material>Gazebo/Black</material>
</gazebo>
<gazebo reference="wheel_rf">
<material>Gazebo/Orange</material>
</gazebo>
<gazebo reference="wheel_lf">
<material>Gazebo/Orange</material>
</gazebo>
<gazebo reference="wheel_rb">
<material>Gazebo/Orange</material>
</gazebo>
<gazebo reference="wheel_lb">
<material>Gazebo/Orange</material>
</gazebo>
<!-- DIFFENERNTIAL DRIVEEEEEEEEEEEEE -->
<gazebo>
<plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
<updateRate>100.0</updateRate>
<robotNamespace>/</robotNamespace>
<leftFrontJoint>wheel_lf_joint</leftFrontJoint>
<rightFrontJoint>wheel_rf_joint</rightFrontJoint>
<leftRearJoint>wheel_lb_joint</leftRearJoint>
<rightRearJoint>wheel_rb_joint</rightRearJoint>
<wheelSeparation>0.08</wheelSeparation>
<wheelDiameter>0.066</wheelDiameter>
<robotBaseFrame>base_footprint</robotBaseFrame>
<torque>20</torque>
<topicName>cmd_vel</topicName>
<broadcastTF>false</broadcastTF>
</plugin>
</gazebo>
</robot>
I'm trying to attach a simple camera to the tool tip of my robot (Kuka lwr). The problem is that the camera view is always changing as shown in the video:
https://polimi365-my.sharepoint.com/:v:/g/personal/10522502_polimi_it/EXuBinkz9NRJlq9O5L5lSo8B7VvdVAVFOAfmaITn106_4A?e=6i3bw3
It seems like the camera is colliding with something or there is a sort of conflict. At the beginning I though it was a material problem (maybe the camera was set inside the box) but setting it transparent didn't solve the problem. I couldn't find any similar issue on the web so I hope someone can help me! For the camera, I followed the tutorial (http://gazebosim.org/tutorials?tut=ro...) adding the camera description in my .urdf.xacro file and the camera plugin in the .gazebo.xacro file.
Here is the camera description in the xacro file:
<joint name="${name}_joint_camera" type="fixed">
<parent link="tool_ee"/>
<child link="${name}_link_camera"/>
<origin xyz="0 0 0.06" rpy="0 0 0"/>
<axis xyz="1 0 0" />
</joint>
<link name="${name}_link_camera">
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.05 0.05 0.05"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.05 0.05 0.05"/>
</geometry>
</visual>
<inertial>
<mass value="1e-5" />
<origin xyz="0 0 0" rpy="0 0 0"/>
<inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001" />
</inertial>
</link>
<joint name="camera_optical_joint" type="fixed">
<origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/>
<parent link="${name}_link_camera"/>
<child link="camera_link_optical"/>
</joint>
<link name="camera_link_optical">
</link>
Here the camera plugin of in the gazebo file:
<gazebo reference="lwr_link_camera">
<mu1>0.2</mu1>
<mu2>0.2</mu2>
<material>Gazebo/Transparent</material>
</gazebo>
<!-- Camera -->
<gazebo reference="lwr_link_camera">
<sensor type="camera" name="camera_sensor1">
<update_rate>30.0</update_rate>
<camera name="head">
<horizontal_fov>1.3962634</horizontal_fov>
<image>
<width>800</width>
<height>800</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.02</near>
<far>300</far>
</clip>
<noise>
<type>gaussian</type>
<!-- Noise is sampled independently per pixel on each frame.
That pixel's noise value is added to each of its color
channels, which at that point lie in the range [0,1]. -->
<mean>0.0</mean>
<stddev>0.007</stddev>
</noise>
</camera>
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<alwaysOn>true</alwaysOn>
<updateRate>0.0</updateRate>
<cameraName>/camera1</cameraName>
<imageTopicName>image_raw</imageTopicName>
<cameraInfoTopicName>camera_info</cameraInfoTopicName>
<frameName>camera_link_optical</frameName>
<hackBaseline>0.0</hackBaseline>
<distortionK1>0.0</distortionK1>
<distortionK2>0.0</distortionK2>
<distortionK3>0.0</distortionK3>
<distortionT1>0.0</distortionT1>
<distortionT2>0.0</distortionT2>
<CxPrime>0</CxPrime>
<Cx>0.0</Cx>
<Cy>0.0</Cy>
<focalLength>0.0</focalLength>
</plugin>
</sensor>
</gazebo>
Any help is appreciated! Thanks!
I need some help with a problem I encountered while adding ultrasonic sensors to a robot (loosely based on Linorobot), already equipped with an RPlidar. Hw/Sw: Raspi3B w/ Ubuntu 16.04.6 LTS, ROS kinetic, a Teensy, 2 Nano.
The robot was working fine with just the lidar, but I need to be able to detect correctly glass and some reflective surfaces, so I'm adding the ultrasonic sensors.
The hardware and microcontroller (rosserial) parts seem to be working fine, I suspect it's an error from my part, maybe related to namespaces or transform frames... or maybe I'm missing something gargantuan. I checked and re-checked against online tutorials, examples and other questions similar to this one, but I couldn't identify the culprit.
After executing the launch files I get the standard messages (same as before trying to setup the ultrasonic sensors), plus:
[ INFO] [1631195261.554945536]: global_costmap/sonar_layer: ALL as input_sensor_type given
[ INFO] [1631195261.596176257]: RangeSensorLayer: subscribed to topic /ultrasound_front
and I guess that's good.
Unfortunately from that moment onward I get (with increasingly high figures, of course):
[ WARN] [1631195265.533631740]: No range readings received for 4.02 seconds, while expected at least every 2.00 seconds.
here's a sensor message (from "rostopic echo /ultrasound_front"):
----
header:
seq: 1124
stamp:
secs: 1631192726
nsecs: 301432058
frame_id: "sonar_front"
radiation_type: 0
field_of_view: 0.259999990463
min_range: 0.0
max_range: 100.0
range: 52.0
----
So, the topic is published and the massages should be ok...
My costmap_common_params.yaml:
map_type: costmap
transform_tolerance: 1
footprint: [[-0.25, -0.25], [-0.25, 0.25], [0.25, 0.25], [0.25, -0.25]]
inflation_layer:
inflation_radius: 0.28
cost_scaling_factor: 3
obstacle_layer:
obstacle_range: 2.5
raytrace_range: 3.0
observation_sources: scan
observation_persistence: 0.0
scan:
data_type: LaserScan
topic: scan
marking: true
clearing: true
sonar_layer:
frame: sonar_front
topics: ["/ultrasound_front"]
no_readings_timeout: 2.0
clear_on_max_reading: true
clear_threshold: 0.2
mark_threshold: 0.80
My global_costmap_params.yaml:
global_costmap:
global_frame: /map
robot_base_frame: /base_footprint
update_frequency: 1
publish_frequency: 0.5
static_map: true
transform_tolerance: 1
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: sonar_layer, type: "range_sensor_layer::RangeSensorLayer"}
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
My local_costmap_params.yaml:
local_costmap:
global_frame: /odom
robot_base_frame: /base_footprint
update_frequency: 1
publish_frequency: 5.0
static_map: false
rolling_window: true
width: 3
height: 3
resolution: 0.02
transform_tolerance: 1
observation_persistence: 0.0
plugins:
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: sonar_layer, type: "range_sensor_layer::RangeSensorLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
And my barebone URDF:
<?xml version="1.0"?>
<robot name="linorobot">
<link name="base_link">
<visual>
<geometry>
<box size="0.50 0.33 0.09"/>
</geometry>
<origin rpy="0 0 0" xyz="0.0 0.00 0.085"/>
<material name="blue">
<color rgba="0 0 .8 1"/>
</material>
</visual>
</link>
<link name="perception_deck">
<visual>
<geometry>
<box size="0.18 0.33 0.08"/>
</geometry>
<origin rpy="0 0 0" xyz="0.0 0.0 0.17"/>
<material name="blue">
<color rgba="0 0 .8 1"/>
</material>
</visual>
</link>
<link name="wheel_left_front">
<visual>
<geometry>
<cylinder length="0.03" radius="0.06"/>
</geometry>
<origin rpy="1.57 0 0" xyz="0.163 0.222 0.03"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<link name="wheel_right_front">
<visual>
<geometry>
<cylinder length="0.03" radius="0.06"/>
</geometry>
<origin rpy="1.57 0 0" xyz="0.163 -0.222 0.03"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<link name="wheel_left_rear">
<visual>
<geometry>
<cylinder length="0.03" radius="0.06"/>
</geometry>
<origin rpy="1.57 0 0" xyz="-0.163 0.222 0.03"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<link name="wheel_right_rear">
<visual>
<geometry>
<cylinder length="0.03" radius="0.06"/>
</geometry>
<origin rpy="1.57 0 0" xyz="-0.163 -0.222 0.03"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<link name="laser">
<visual>
<geometry>
<cylinder length="0.065" radius="0.035"/>
</geometry>
<origin rpy="0 0 0" xyz="0.0 0.0 0.2825"/>
<material name="black"/>
</visual>
</link>
<link name="chassis">
<visual>
<geometry>
<box size="0.5 0.5 0.8"/>
</geometry>
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
<material name="silver">
<color rgba="192 192 192 0.6"/>
</material>
</visual>
</link>
<link name="sonar_front">
<visual>
</geometry>
<origin rpy="1.5708 0.2618 0" xyz="-0.21 0.0 0.235"/>
<material name="silver">
<color rgba="192 192 192 0.6"/>
</material>
</visual>
</link>
<link name="sonar_rear">
<visual>
<geometry>
<box size="0.02 0.025 0.07"/>
</geometry>
<origin rpy="1.5708 0.2618 3.1416" xyz="0.23 0.0 0.235"/>
<material name="silver">
<color rgba="192 192 192 0.6"/>
</material>
</visual>
</link>
<link name="sonar_left">
<visual>
<geometry>
<box size="0.02 0.025 0.07"/>
</geometry>
<origin rpy="1.5708 -0.2618 1.5708" xyz="0.0 0.18 0.235"/>
<material name="silver">
<color rgba="192 192 192 0.6"/>
</material>
</visual>
</link>
<link name="sonar_right">
<visual>
<geometry>
<box size="0.02 0.025 0.07"/>
</geometry>
<origin rpy="1.5708 -0.2618 -1.5708" xyz="0.0 -0.19 0.235"/>
<material name="silver">
<color rgba="192 192 192 0.6"/>
</material>
</visual>
</link>
<joint name="base_to_wheel_left_front" type="fixed">
<parent link="base_link"/>
<child link="wheel_left_front"/>
<origin xyz="0 0 0"/>
</joint>
<joint name="base_to_wheel_right_front" type="fixed">
<parent link="base_link"/>
<child link="wheel_right_front"/>
<origin xyz="0 0 0"/>
</joint>
<joint name="base_to_wheel_left_rear" type="fixed">
<parent link="base_link"/>
<child link="wheel_left_rear"/>
<origin xyz="0 0 0"/>
</joint>
<joint name="base_to_wheel_right_rear" type="fixed">
<parent link="base_link"/>
<child link="wheel_right_rear"/>
<origin xyz="0 0 0"/>
</joint>
<joint name="base_to_laser" type="fixed">
<parent link="base_link"/>
<child link="laser"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_left_sonar" type="fixed">
<parent link="base_link"/>
<child link="sonar_left"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_right_sonar" type="fixed">
<parent link="base_link"/>
<child link="sonar_right"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_rear_sonar" type="fixed">
<parent link="base_link"/>
<child link="sonar_rear"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_front_sonar" type="fixed">
<parent link="base_link"/>
<child link="sonar_front"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_perception_deck" type="fixed">
<parent link="base_link"/>
<joint name="base_to_laser" type="fixed">
<parent link="base_link"/>
<child link="laser"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_left_sonar" type="fixed">
<parent link="base_link"/>
<child link="sonar_left"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_right_sonar" type="fixed">
<parent link="base_link"/>
<child link="sonar_right"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_rear_sonar" type="fixed">
<parent link="base_link"/>
<child link="sonar_rear"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_front_sonar" type="fixed">
<parent link="base_link"/>
<child link="sonar_front"/>
<origin xyz="0.0 0.0 0.0"/>
</joint>
<joint name="base_to_perception_deck" type="fixed">
<parent link="base_link"/>
<child link="perception_deck"/>
<origin xyz="0 0 0.0"/>
</joint>
<joint name="base_to_chassis" type="fixed">
<parent link="base_link"/>
<child link="chassis"/>
<origin xyz="0 0 0.44"/>
</joint>
</robot>
Thanks!
EDITS
after getting the messages, "rostopic hz /ultrasound_front" gives:
subscribed to [/ultrasound_front]
average rate: 3.494
min: 0.267s max: 0.305s std dev: 0.01919s window: 3
average rate: 3.384
min: 0.250s max: 0.353s std dev: 0.03533s window: 6
average rate: 3.362
min: 0.250s max: 0.353s std dev: 0.02813s window: 9
average rate: 3.352
min: 0.250s max: 0.353s std dev: 0.02625s window: 13
average rate: 3.349
min: 0.250s max: 0.353s std dev: 0.02447s window: 16
average rate: 3.344
min: 0.250s max: 0.353s std dev: 0.02547s window: 20
average rate: 3.341
min: 0.250s max: 0.353s std dev: 0.02368s window: 23
average rate: 3.256
min: 0.250s max: 0.490s std dev: 0.04349s window: 26
average rate: 3.336
min: 0.110s max: 0.490s std dev: 0.05406s window: 30
average rate: 3.335
min: 0.110s max: 0.490s std dev: 0.05176s window: 33
and so on. Publishing interval in the MCU code is 250ms.
"max_range:1.0" in "rostopic echo /ultrasound_front" has been corrected (was an error in the original MCU code), the behaviour doesn't change. I modified the output above to reflect the current version.
"rostopic info /ultrasound_front", after the massages started, gives: (Thank you #BTables!)
Type: sensor_msgs/Range
Publishers:
* /rosserial_NANO_sensors (http://192.168.2.54:34525/)
Subscribers:
* /move_base (http://192.168.2.54:40149/)
I finally solved some of the problems that emerged after adding the ultrasound sensors. Because of the nature of the errors, and the extremely large amount of different hw/sw configurations possible, I will put here my findings, with some more general info, hoping to help others:
Double check the UNIT of MEASURE used in the range fields in the microcontroller code. For example, the library and examples I used and referred to had everything in cm.
This isn't good for ROS navigation layer, the range/distance numbers passed in the messages should be in meters (min_range, max_range, range).
HOWEVER the microcontroller code could be passing the data, and using some internal calculations or logic, in centimeters (like here 'https://www.intorobotics.com/how-to-use-sensor_msgs-range-ros-for-multiple-sensors-with-rosserial/', for example), so some changes are probably needed (also regarding the logic behind the clearing of the costmap, but that's a problem for another question).
A message rate of 20Hz should be ok, it should not produce missing data messages, sync errors, etc. However please note that it's possible this frequency has to be modified, depending on the hardware involved.
The costmap YAML parameter clear_on_max_reading behaviour depends on how the data is presented by your ultrasound sensor (or sensors) MCU code. It's a good idea to try both settings and check which one is more appropriate for your case. You can then modify the MCU code to accomodate for the library logic behind this setting (or the other way around, modifying the libraries).
Verify that your RVIZ configuration contains all the necessary information to visualize your ultrasound (range) sensor data (http://wiki.ros.org/rviz/DisplayTypes/Range)
The URDF usually gives clear messages if something related to the transforms and related data is not working, once the real problems are solved, it's possible to see the cones and axes in Rviz (IF the unit of measure isn't too small!), so it's easy to correct orientation and position errors.
Use check_urdf to verify the validity of the URDF file (http://wiki.ros.org/urdf#Verification), and urdf_to_graphiz to have a visual representation with some more data, that could give some clues on malfunctions or errors (http://wiki.ros.org/urdf#Visualization). Also rqt_graph with enable_statistics set to "true" can give useful clues (http://wiki.ros.org/rqt_graph).
i make a ball model at gazebo by making sdf file but it's not moving
how can i make a ball rolling?
my sdf code right below
<?xml version='1.0'?>
<sdf version='1.4'>
<model name="sphere">
<link name='base_link'>
<pose>0 0 .1 0 0 0</pose>
<collision name='collision'>
<geometry>
<sphere>
<radius>0.03</radius>
</sphere>
</geometry>
</collision>
<visual name='visual'>
<geometry>
<sphere>
<radius>0.03</radius>
</sphere>
</geometry>
<material>
<diffuse>1 0 0 1</diffuse>
<ambient>1 0 0 1</ambient>
</material>
</visual>
</link>
</model>
</sdf>
help me!!!