For the robot we have to create a model of the robot to represent the robot within simulations and so it will be aware of its size. This will require a package to be created which will have dependencies on other packages. These packages are roscpp, tf, geometry_msgs, urdf, rviz, and xacro. We will also put our .stl files in a meshes folder within the description folder. We will get back to this later. Right now we will do the robot model design, or at least, gather information for building the robot model URDF.
First, we make a simple sketch of the robot with measurements of the dimensions of the robot and where the wheels should go. This is my simple sketch:
The measurements are in millimeters, which is nice because the URDF files have parts in meters.
The external and internal dimensions should be useful for determining the positioning of the casters.
The drive wheels will be mounted .143547 meters from the back of the robot and .4441 meters apart.
Most of the measurements should be built within the .stl files.
*measurements are as close to real as an amateur can model.
The Frame is 77.508 mm above the ground.
The wheels shouldn't need the height distance as long as it originates at 0 on the Z plane.
*Not much of this is useful.
WARNING! Assumptions must be made!
I do not know if the .stl files are oriented in the correct way.
This is due to the differences between what CAD software sets the Z axis and what the ROS software sets as the Z axis.
It will be assumed that the files are oriented the correct way and that they are in meters not inches.
I will try to test this before I release the package and this page.
The robot is 657.359 mm long, 444.1 mm wide and. I am hoping that the .stl file is placed in the center of creation land and has equal distant front and back left and right, being bisected by its center, both ways. I am saying that the robots center is the center of the origin. So any joint of the robot is a function of its distance from the center of the frame.stl. In the center, x and y should both be zero.
The back of the robot should be -328.6795 mm and both the wheels should be mounted at -185.1325 mm (143.547 + (-328.6795)). The left side is -222.05 mm and the right side is 222.05 mm. The casters should be placed at 310.584 (328.6795-18.0955), and 207.05(distance between inside and outside measurements divided by 2). Wheels at 222.05,-185.1325 and -222.05,-185.1325. The casters should be placed at 310.584, 207.05 and 310.584, -207.05.
The wheels will be considered as joints. The drive wheels will be of a continuous joint type, while the casters will be fixed type of joints.
I am guessing the weight will be about 30ish lbs or 18ish Kg and the wheels are about 3.3 lbs or 1.5 Kg.
The robot gets a name, the first part of the robot mentioned is the base_link, the visual geometry is a STL file, found within the meshes folder--named frame.stl . It is rotated 0,0,0, created on the point of 0,0,0 and is the color red, which is given by the rgba code. The wheels and colors were also added. The rear wheel joint types have been changed to continuous. Collision and inertial information (like a outline of the dimensions) has been entered. Shoot, it is getting long!
<robot name="lawnmow">
<!-- * * * Link Definitions * * * -->
<link name="base_link">
<visual>
<geometry>
<mesh scale=".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/frame.stl"/>
</geometry>
<origin rpy="1.55 0 0" xyz="0 0 -.050"/>
<material name="red">
<color rgba="1 0 0 1"/>
</material>
</visual>
</link>
<link name="rr_wheel">
<visual>
<!-- origin xyz="0 0 0" rpy="1.58 0 0"/-->
<geometry>
<mesh scale=".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/wheel.stl"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<link name="lr_wheel">
<visual>
<!-- origin xyz="0 0 0" rpy="1.58 0 0"/-->
<geometry>
<mesh scale=".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/wheel.stl"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<link name="lf_wheel">
<visual>
<!--origin xyz="0 0 0" rpy="1.58 0 0"/-->
<geometry>
<mesh scale=".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/caster.stl"/>
</geometry>
<origin rpy="0 -1.55 0" xyz="0 0 0"/>
<material name="black">
<color rgba="1 0 0 1"/>
</material>
</visual>
</link>
<link name="rf_wheel">
<visual>
<!--origin xyz="0 0 0" rpy="1.58 0 0"/-->
<geometry>
<mesh scale= ".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/caster.stl"/>
</geometry>
<origin rpy="0 -1.55 0" xyz="0 0 0"/>
<material name="black">
<color rgba="1 0 0 1"/>
</material>
</visual>
</link>
<!-- * * * Joint Definitions * * * -->
<joint name="rr_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="rr_wheel"/>
<origin xyz="0.04 0.12 .18" rpy="0 0 0"/>
</joint>
<joint name="lr_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="lr_wheel"/>
<origin xyz="-0.5 0.12 .18" rpy="0 0 0"/>
</joint>
<joint name="lf_wheel_joint" type="fixed">
<parent link="base_link"/>
<child link="lf_wheel"/>
<origin xyz="-0.4 0.605 .35" rpy=".1 0 3.1"/>
</joint>
<joint name="rf_wheel_joint" type="fixed">
<parent link="base_link"/>
<child link="rf_wheel"/>
<origin xyz="0.016 0.605 .35" rpy=".1 0 3.1"/>
</joint>
</robot>
This is without inertial and collision information.
Proof! Melon Farmers.
I believe that the inertial, collision, and gazebo control data should look like this:
<robot name="lawnmow">
<!-- * * * Link Definitions * * * -->
<link name="base_link">
<visual>
<geometry>
<mesh scale=".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/frame.stl"/>
</geometry>
<origin rpy="1.55 0 0" xyz="0 0 -.050"/>
<material name="red">
<color rgba="1 0 0 1"/>
</material>
</visual>
<collision>
<origin rpy="1.55 0 0" xyz="0 0 -.050"/>
<geometry>
<box size="0.657359 0.4441 0.085"/>
</geometry>
</collision>
<inertial>
<mass value="18"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<link name="rr_wheel">
<visual>
<!-- origin xyz="0 0 0" rpy="1.58 0 0"/-->
<geometry>
<mesh scale=".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/wheel.stl"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
<collision>
<origin xyz="0.04 0.12 .18" rpy="1.58 0 0"/>
<geometry>
<cylinder radius="0.167022" length="0.07"/>
</geometry>
</collision>
<inertial>
<mass value="1.5"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<link name="lr_wheel">
<visual>
<!-- origin xyz="0 0 0" rpy="1.58 0 0"/-->
<geometry>
<mesh scale=".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/wheel.stl"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
<collision>
<origin xyz="-0.5 0.12 .18" rpy="1.58 0 0"/>
<geometry>
<cylinder radius="0.167022" length="0.07"/>
</geometry>
</collision>
<inertial>
<mass value="1.5"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<link name="lf_wheel">
<visual>
<!--origin xyz="0 0 0" rpy="1.58 0 0"/-->
<geometry>
<mesh scale=".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/caster.stl"/>
</geometry>
<origin rpy="0 -1.55 0" xyz="0 0 0"/>
<material name="black">
<color rgba="1 0 0 1"/>
</material>
</visual>
<collision>
<origin xyz="-0.4 0.605 .35" rpy="1.58 0 0"/>
<geometry>
<cylinder radius="0.167022" length="0.07"/>
</geometry>
</collision>
<inertial>
<mass value="1.5"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<link name="rf_wheel">
<visual>
<!--origin xyz="0 0 0" rpy="1.58 0 0"/-->
<geometry>
<mesh scale= ".0010 .0010 .0010" filename="file://home/home/matt/lawnmow_ws/src/lawnmow_description/meshes/caster.stl"/>
</geometry>
<origin rpy="0 -1.55 0" xyz="0 0 0"/>
<material name="black">
<color rgba="1 0 0 1"/>
</material>
</visual>
<collision>
<origin xyz="0.016 0.605 .35" rpy="1.58 0 0"/>
<geometry>
<cylinder radius="0.167022" length="0.07"/>
</geometry>
</collision>
<inertial>
<mass value="1.5"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<!-- * * * Joint Definitions * * * -->
<joint name="rr_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="rr_wheel"/>
<origin xyz="0.04 0.12 .18" rpy="0 0 0"/>
</joint>
<joint name="lr_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="lr_wheel"/>
<origin xyz="-0.5 0.12 .18" rpy="0 0 0"/>
</joint>
<joint name="lf_wheel_joint" type="fixed">
<parent link="base_link"/>
<child link="lf_wheel"/>
<origin xyz="-0.4 0.605 .35" rpy=".1 0 3.1"/>
</joint>
<joint name="rf_wheel_joint" type="fixed">
<parent link="base_link"/>
<child link="rf_wheel"/>
<origin xyz="0.016 0.605 .35" rpy=".1 0 3.1"/>
</joint>
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<publish_tf>1</publish_tf>
<left_wheel_joint_name>wheel_left_joint</left_wheel_joint_name>
<right_wheel_joint_name>wheel_right_joint</right_wheel_joint_name>
<wheel_separation>.4441</wheel_separation>
<wheel_diameter>0.330896</wheel_diameter>
<torque>180.0</torque>
<velocity_command_timeout>0.6</velocity_command_timeout>
<imu_name>imu</imu_name>
</plugin>
</gazebo>
</robot>
Oh please, let this be correct.
4/14/17
4/27/17 - I have found that the above code to be garbage, and the Xacro files from the Xacro, Gazebo, and Control page should be used instead.