gazebo-controller for car-like robot
Hello everyone,
I can't seem to find a working controller for my car-like robot. This is the model I am using:
<?xml version="1.0"?>
<robot name="$(arg roboname)" xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- Included URDF/XACRO Files -->
<xacro:include filename="$(find chassis_description)/urdf/materials.urdf.xacro" />
<xacro:include filename="$(find chassis_description)/urdf/chassis_wheels.urdf.xacro" />
<!-- PROPERTY LIST -->
<!--All units in m-kg-s-radians unit system -->
<property name="M_PI" value="3.1415926535897931" />
<!-- Main Body-base -->
<property name="base_x_size" value="4.68" />
<property name="base_y_size" value="1.27" />
<property name="base_z_size" value="0.2" />
<property name="base_mass" value="800" /> <!-- in kg-->
<!--Inertial macros for the box and cylinder. Units are kg*m^2-->
<macro name="box_inertia" params="m x y z">
<inertia ixx="${m*(y*y+z*z)/12}" ixy = "0" ixz = "0"
iyy="${m*(x*x+z*z)/12}" iyz = "0"
izz="${m*(x*x+z*z)/12}" />
</macro>
<!-- BASE-FOOTPRINT -->
<!-- base_footprint is a fictitious link(frame) that is on the ground right below base_link origin -->
<link name="base_footprint">
<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>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.001 0.001 0.001" />
</geometry>
</visual>
</link>
<gazebo reference="base_footprint">
<turnGravityOff>false</turnGravityOff>
</gazebo>
<joint name="base_footprint_joint" type="fixed">
<origin xyz="0 0 ${wheel_radius - base_z_origin_to_wheel_origin}" rpy="0 0 0" />
<parent link="base_footprint"/>
<child link="base_link" />
</joint>
<!-- BASE-LINK -->
<!--Actual body/chassis of the robot-->
<link name="base_link">
<inertial>
<mass value="${base_mass}" />
<origin xyz="0 0 0" />
<!--The 3x3 rotational inertia matrix. -->
<box_inertia m="${base_mass}" x="${base_x_size}" y="${base_y_size}" z="${base_z_size}"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="${base_x_size} ${base_y_size} ${base_z_size}"/>
</geometry>
<material name="Grey" />
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0 " />
<geometry>
<box size="${base_x_size} ${base_y_size} ${base_z_size}"/>
</geometry>
</collision>
</link>
<gazebo reference="base_link">
<material>Gazebo/Grey</material>
<turnGravityOff>false</turnGravityOff>
</gazebo>
<!-- WHEELs -->
<wheel fb="front" lr="right" parent="front_right_wheel_steering_block" translateX="1" translateY="-1" flipY="-1" base_x_origin_to_wheel_origin="1.66"/>
<wheel fb="front" lr="left" parent="front_left_wheel_steering_block" translateX="1" translateY="1" flipY="-1" base_x_origin_to_wheel_origin="1.66"/>
<wheel fb="back" lr="right" parent="base_link" translateX="-1" translateY="-1" flipY="-1" base_x_origin_to_wheel_origin="1.14"/>
<wheel fb="back" lr="left" parent="base_link" translateX="-1" translateY="1" flipY="-1" base_x_origin_to_wheel_origin="1.14"/>
<joint name="front_right_wheel_joint" type="continuous">
<parent link="front_right_wheel_steering_block"/>
<child link="front_right_wheel"/>
<origin xyz="0 0 0.125" rpy="1.570796 0 0" />
<axis xyz="0 1 0" rpy="0 0 0" />
<limit effort="100" velocity="100"/>
<joint_properties damping="0.0" friction="0.0"/>
</joint>
<joint name="front_left_wheel_joint" type="continuous">
<parent link="front_left_wheel_steering_block"/>
<child link="front_left_wheel"/>
<origin xyz="0 0 0.125" rpy="-1.570796 0 0" />
<axis xyz="0 1 0" rpy="0 0 0" />
<limit effort="100" velocity="100"/>
<joint_properties damping="0.0" friction="0.0"/>
</joint>
<joint name="back_left_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="back_left_wheel"/>
<origin xyz="-1.14 0.785 -0.1" rpy="0 0 0" />
<axis xyz="0 1 0" rpy="0 0 0" />
<limit effort="100" velocity="100"/>
<joint_properties damping="0.0" friction="0.0"/>
</joint>
<joint name="back_right_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="back_right_wheel"/>
<origin xyz="-1.14 -0.785 -0.1" rpy="0 0 0" />
<axis xyz="0 1 0" rpy="0 0 0" />
<limit effort="100" velocity="100"/>
<joint_properties damping="0.0" friction="0.0"/>
</joint>
<link name="front_right_wheel_steering_block">
<inertial>
<mass value="1"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<cylinder length="0.05" radius="0.05"/>
</geometry>
<material name="Grey" />
</visual>
<collision name="collision">
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="0.05" radius="0.05"/>
</geometry>
</collision>
</link>
<link name="front_left_wheel_steering_block">
<inertial>
<mass value="1"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<cylinder length="0.05" radius="0.05"/>
</geometry>
<material name="Grey" />
</visual>
<collision name="collision">
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="0.05" radius="0.05"/>
</geometry>
</collision>
</link>
<joint name="front_left_steering_joint" type="revolute">
<parent link="base_link"/>
<child link="front_left_wheel_steering_block"/>
<origin rpy="-${M_PI/2} 0 0" xyz="1.66 0.635 -0.1"/>
<axis xyz="0 1 0"/>
<limit effort="10.0" lower="-0.604015" upper="0.445345" velocity="0.0"/>
</joint>
<joint name="front_right_steering_joint" type="revolute">
<parent link="base_link"/>
<child link="front_right_wheel_steering_block"/>
<origin rpy="${M_PI/2} 0 0" xyz="1.66 -0.635 -0.1"/>
<axis xyz="0 1 0"/>
<limit effort="10.0" lower="-0.604015" upper="0.445345" velocity="0.0"/>
</joint>
<gazebo reference="front_right_steering_link">
<mu1>0.6</mu1>
<mu2>0.5</mu2>
<kp>1000000</kp>
<kd>0.1</kd>
<minDepth>0.01</minDepth>
<maxVel>10.0</maxVel>
</gazebo>
<gazebo reference="front_left_steering_link">
<mu1>0.6</mu1>
<mu2>0.5</mu2>
<kp>1000000</kp>
<kd>0.1</kd>
<minDepth>0.01</minDepth>
<maxVel>10.0</maxVel>
</gazebo>
<!-- motors and transmissions for the two front wheels and steering -->
<transmission name="tran1">
<type>transmission_interface/SimpleTransmission</type>
<joint name="front_right_wheel_joint">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="motor1">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<transmission name="tran2">
<type>transmission_interface/SimpleTransmission</type>
<joint name="front_left_wheel_joint">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="motor2">
<hardwareInterface>VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<transmission name="rack_and_pinion_left">
<type>transmission_interface/SimpleTransmission</type>
<joint name="front_left_steering_joint">
<hardwareInterface>PositionJointInterface</hardwareInterface>
</joint>
<actuator name="eps_left">
<hardwareInterface>PositionJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<transmission name="rack_and_pinion_right">
<type>transmission_interface/SimpleTransmission</type>
<joint name="front_right_steering_joint">
<hardwareInterface>PositionJointInterface</hardwareInterface>
</joint>
<actuator name="eps_right">
<hardwareInterface>PositionJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
<!-- Hokuyo Laser -->
<link name="hokuyo_link">
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<box size="0.1 0.1 0.1"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<!--<box size="0.1 0.1 0.1"/>-->
<mesh filename="package://chassis_description/meshes/hokuyo.dae"/>
</geometry>
</visual>
<inertial>
<mass value="1e-5" />
<origin xyz="0 0 0" rpy="0 0 0"/>
<inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
</inertial>
</link>
<joint name="laser_joint" type="fixed">
<axis xyz="0 1 0" />
<origin xyz="${base_x_size/2-0.05} 0 ${base_z_size/2+0.05}" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="hokuyo_link"/>
</joint>
<gazebo reference="hokuyo_link">
<sensor type="ray" name="head_hokuyo_sensor">
<pose>0 0 0 0 0 0</pose>
<visualize>true</visualize>
<update_rate>40</update_rate>
<ray>
<scan>
<horizontal>
<samples>2000</samples>
<resolution>1</resolution>
<min_angle>-3.141593</min_angle>
<max_angle>3.141593</max_angle>
</horizontal>
</scan>
<range>
<min>0.10</min>
<max>6</max>
<resolution>0.02</resolution>
</range>
<noise>
<type>gaussian</type>
<!-- Noise parameters based on published spec for Hokuyo laser
achieving "+-30mm" accuracy at range < 10m. A mean of 0.0m and
stddev of 0.01m will put 99.7% of samples within 0.03m of the true
reading. -->
<mean>0.0</mean>
<stddev>0.01</stddev>
</noise>
</ray>
<plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
<robotNamespace>/$(arg roboname)</robotNamespace>
<topicName>/$(arg roboname)/scan</topicName>
<frameName>hokuyo_link</frameName>
</plugin>
</sensor>
</gazebo>
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/$(arg roboname)</robotNamespace>
<robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
</plugin>
</gazebo>
<gazebo>
<plugin filename="libgazebo_ros_joint_state_publisher.so" name="joint_state_publisher">
<jointName>back_left_wheel_joint, back_right_wheel_joint, front_left_steering_joint, front_right_steering_joint, front_right_wheel_joint, front_left_wheel_joint</jointName>
<robotNamespace>/$(arg roboname)</robotNamespace>
<updateRate>50.0</updateRate>
<alwaysOn>true</alwaysOn>
</plugin>
</gazebo>
<gazebo>
<plugin name="cmdvel_controller" filename="libazcargazebo.so">
<robotNamespace>/$(arg roboname)</robotNamespace>
</plugin>
</gazebo>
</robot>
Please can anyone suggest a controller node to me? Any help will be greatly appreciated.
Thank you in advance.
Asked by gleb on 2016-08-31 10:54:30 UTC
Comments
Hello gled, did you find a controller node?
Asked by macrot51 on 2019-05-14 09:02:10 UTC