[feat] add mbot xacro

This commit is contained in:
jieshoudaxue
2023-07-20 11:12:08 +08:00
parent e6d255d049
commit d0e6749c23
8 changed files with 440 additions and 0 deletions
+197
View File
@@ -0,0 +1,197 @@
Panels:
- Class: rviz/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
Splitter Ratio: 0.5
Tree Height: 490
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Name: Time
SyncMode: 0
SyncSource: ""
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
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
- Alpha: 1
Class: rviz/RobotModel
Collision Enabled: false
Enabled: true
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
back_caster_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
base_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
front_caster_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
kinect_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
laser_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
left_wheel_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
right_wheel_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
stage_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
Name: RobotModel
Robot Description: robot_description
TF Prefix: ""
Update Interval: 0
Value: true
Visual Enabled: true
- Class: rviz/TF
Enabled: false
Filter (blacklist): ""
Filter (whitelist): ""
Frame Timeout: 15
Frames:
All Enabled: true
Marker Alpha: 1
Marker Scale: 1
Name: TF
Show Arrows: true
Show Axes: true
Show Names: true
Tree:
{}
Update Interval: 0
Value: false
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
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
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- 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: 1.6701574325561523
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: 0
Y: 0
Z: 0
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.36039790511131287
Target Frame: <Fixed Frame>
Yaw: 2.130397081375122
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 781
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd00000004000000000000015600000273fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b00000273000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f00000273fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b00000273000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b00000030700fffffffb0000000800540069006d00650100000000000004500000000000000000000003540000027300000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 1200
X: 60
Y: 60
+29
View File
@@ -0,0 +1,29 @@
digraph G {
node [shape=box];
"base_link" [label="base_link"];
"back_caster_link" [label="back_caster_link"];
"camera_link" [label="camera_link"];
"front_caster_link" [label="front_caster_link"];
"kinect_link" [label="kinect_link"];
"left_wheel_link" [label="left_wheel_link"];
"right_wheel_link" [label="right_wheel_link"];
"stage_link" [label="stage_link"];
"laser_link" [label="laser_link"];
node [shape=ellipse, color=blue, fontcolor=blue];
"base_link" -> "back_caster_joint" [label="xyz: -0.18 0 -0.095 \nrpy: 0 -0 0"]
"back_caster_joint" -> "back_caster_link"
"base_link" -> "camera_joint" [label="xyz: -0.17 0 0.1 \nrpy: 0 -0 0"]
"camera_joint" -> "camera_link"
"base_link" -> "front_caster_joint" [label="xyz: 0.18 0 -0.095 \nrpy: 0 -0 0"]
"front_caster_joint" -> "front_caster_link"
"base_link" -> "kinect_joint" [label="xyz: 0.15 0 0.11 \nrpy: 0 -0 0"]
"kinect_joint" -> "kinect_link"
"base_link" -> "left_wheel_joint" [label="xyz: 0 0.19 -0.05 \nrpy: 0 -0 0"]
"left_wheel_joint" -> "left_wheel_link"
"base_link" -> "right_wheel_joint" [label="xyz: 0 -0.19 -0.05 \nrpy: 0 -0 0"]
"right_wheel_joint" -> "right_wheel_link"
"base_link" -> "stage_joint" [label="xyz: 0 0 0.14 \nrpy: 0 -0 0"]
"stage_joint" -> "stage_link"
"stage_link" -> "laser_joint" [label="xyz: 0 0 0.085 \nrpy: 0 -0 0"]
"laser_joint" -> "laser_link"
}
Binary file not shown.
@@ -0,0 +1,18 @@
<launch>
<arg name="model" default="$(find xacro)/xacro '$(find mbot_description)/urdf/mbot_base.xacro'" />
<param name="robot_description" command="$(arg model)" />
<!-- 设置GUI参数,显示关节控制插件 -->
<param name="use_gui" value="true"/>
<!-- 运行joint_state_publisher节点,发布机器人的关节状态 -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<!-- 运行robot_state_publisher节点,发布tf -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<!-- 运行rviz可视化界面 -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mbot_description)/config/mbot_xacro.rviz" required="true" />
</launch>
+132
View File
@@ -0,0 +1,132 @@
<?xml version="1.0" ?>
<robot name="mbot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:property name="M_PI" value="3.1415926" />
<xacro:property name="wheel_joint_x" value="0" />
<xacro:property name="wheel_joint_y" value="0.19" />
<xacro:property name="wheel_joint_z" value="0.05" />
<xacro:property name="wheel_length" value="0.06" />
<xacro:property name="wheel_radius" value="0.06" />
<xacro:property name="caster_joint_x" value="0.18" />
<xacro:property name="caster_joint_y" value="0" />
<xacro:property name="caster_joint_z" value="0.095" />
<xacro:property name="caster_radius" value="0.015" />
<xacro:property name="base_length" value="0.16" />
<xacro:property name="base_radius" value="0.2" />
<xacro:property name="stage_length" value="0.12" />
<xacro:property name="stage_radius" value="0.1" />
<xacro:property name="camera_joint_x" value="0.17" />
<xacro:property name="camera_joint_y" value="0" />
<xacro:property name="camera_joint_z" value="0.1" />
<xacro:property name="kinect_joint_x" value="0.15" />
<xacro:property name="kinect_joint_y" value="0" />
<xacro:property name="kinect_joint_z" value="0.11" />
<xacro:property name="laser_joint_x" value="0" />
<xacro:property name="laser_joint_y" value="0" />
<xacro:property name="laser_joint_z" value="0.085" />
<material name="white">
<color rgba="1 1 1 0.9"/>
</material>
<material name="red">
<color rgba="1 0 0 1"/>
</material>
<material name="grey">
<color rgba="0.5 0.5 0.5 1"/>
</material>
<xacro:macro name="base_stage">
<link name="base_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<cylinder length="${base_length}" radius="${base_radius}"/>
</geometry>
<material name="red" />
</visual>
</link>
<joint name="stage_joint" type="fixed">
<origin xyz="0 0 ${(base_length + stage_length)/2}" rpy="0 0 0" />
<parent link="base_link"/>
<child link="stage_link" />
</joint>
<link name="stage_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<cylinder length="${stage_length}" radius="${stage_radius}"/>
</geometry>
<material name="red" />
</visual>
</link>
</xacro:macro>
<xacro:macro name="wheel" params="prefix reflect">
<joint name="${prefix}_wheel_joint" type="continuous">
<origin xyz="${wheel_joint_x} ${reflect*wheel_joint_y} ${-wheel_joint_z}" rpy="0 0 0" />
<parent link="base_link" />
<child link="${prefix}_wheel_link" />
<axis xyz="0 1 0" />
</joint>
<link name="${prefix}_wheel_link">
<visual>
<origin xyz="0 0 0" rpy="${M_PI/2} 0 0"/>
<geometry>
<cylinder length="${wheel_length}" radius="${wheel_radius}"/>
</geometry>
<material name="white" />
</visual>
</link>
</xacro:macro>
<xacro:macro name="caster" params="prefix reflect">
<joint name="${prefix}_caster_joint" type="continuous">
<origin xyz="${reflect*caster_joint_x} ${caster_joint_y} ${-caster_joint_z}" rpy="0 0 0" />
<parent link="base_link"/>
<child link="${prefix}_caster_link" />
<axis xyz="0 1 0" />
</joint>
<link name="${prefix}_caster_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="${caster_radius}" />
</geometry>
<material name="white" />
</visual>
</link>
</xacro:macro>
<xacro:base_stage />
<xacro:wheel prefix="left" reflect="1"/>
<xacro:wheel prefix="right" reflect="-1"/>
<xacro:caster prefix="front" reflect="1"/>
<xacro:caster prefix="back" reflect="-1"/>
<xacro:include filename="$(find mbot_description)/urdf/sensor/camera.xacro" />
<xacro:usb_camera joint_x="${camera_joint_x}" joint_y="${camera_joint_y}" joint_z="${camera_joint_z}"/>
<xacro:include filename="$(find mbot_description)/urdf/sensor/kinect.xacro" />
<xacro:kinect joint_x="${kinect_joint_x}" joint_y="${kinect_joint_y}" joint_z="${kinect_joint_z}"/>
<xacro:include filename="$(find mbot_description)/urdf/sensor/laser.xacro" />
<xacro:laser joint_x="${laser_joint_x}" joint_y="${laser_joint_y}" joint_z="${laser_joint_z}"/>
</robot>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" ?>
<robot name="mbot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="usb_camera" params="joint_x joint_y joint_z">
<joint name="camera_joint" type="fixed">
<origin xyz="${-joint_x} ${joint_y} ${joint_z}" rpy="0 0 0" />
<parent link="base_link"/>
<child link="camera_link" />
</joint>
<link name="camera_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.03 0.04 0.04" />
</geometry>
<material name="grey" />
</visual>
</link>
</xacro:macro>
</robot>
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" ?>
<robot name="mbot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="kinect" params="joint_x joint_y joint_z">
<joint name="kinect_joint" type="fixed">
<origin xyz="${joint_x} ${joint_y} ${joint_z}" rpy="0 0 0" />
<parent link="base_link"/>
<child link="kinect_link" />
</joint>
<link name="kinect_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 1.5708" />
<geometry>
<mesh filename="package://mbot_description/meshes/kinect.dae" />
</geometry>
</visual>
</link>
</xacro:macro>
</robot>
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" ?>
<robot name="mbot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="laser" params="joint_x joint_y joint_z">
<joint name="laser_joint" type="fixed">
<origin xyz="${joint_x} ${joint_y} ${joint_z}" rpy="0 0 0" />
<parent link="stage_link"/>
<child link="laser_link" />
</joint>
<link name="laser_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<cylinder length="0.05" radius="0.05"/>
</geometry>
<material name="grey"/>
</visual>
</link>
</xacro:macro>
</robot>