实验四 蓝桥ROS1三维建模与仿真 适用kinetic/melodic/noetic
【摘要】
需要先完成实验1+2+3,不要直接看本实验。
实验三补充:
要求:
自定义机器人3D模型,创建一个URDF文件、xacro文件、Gazebo仿真
环境:
www.lanqiao.cn/courses/854
记录:
实验四补充
由于时间紧,实验复习聚焦到urdf+Gazebo。
tree:
s...
需要先完成实验1+2+3,不要直接看本实验。
实验三补充:
要求:
自定义机器人3D模型,创建一个URDF文件、xacro文件、Gazebo仿真
环境:
www.lanqiao.cn/courses/854
记录:
实验四补充
由于时间紧,实验复习聚焦到urdf+Gazebo。
tree:
shiyanlou:urdf/ $ roslaunch urdf_tutorial display.launch model:=07-physics.urdf
urdf:
-
<?xml version="1.0"?>
-
<robot name="physics">
-
-
<material name="blue">
-
<color rgba="0 0 0.8 1"/>
-
</material>
-
<material name="black">
-
<color rgba="0 0 0 1"/>
-
</material>
-
<material name="white">
-
<color rgba="1 1 1 1"/>
-
</material>
-
-
<link name="base_link">
-
<visual>
-
<geometry>
-
<cylinder length="0.6" radius="0.2"/>
-
</geometry>
-
<material name="blue"/>
-
</visual>
-
<collision>
-
<geometry>
-
<cylinder length="0.6" radius="0.2"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="10"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<link name="right_leg">
-
<visual>
-
<geometry>
-
<box size="0.6 0.1 0.2"/>
-
</geometry>
-
<origin rpy="0 1.57075 0" xyz="0 0 -0.3"/>
-
<material name="white"/>
-
</visual>
-
<collision>
-
<geometry>
-
<box size="0.6 0.1 0.2"/>
-
</geometry>
-
<origin rpy="0 1.57075 0" xyz="0 0 -0.3"/>
-
</collision>
-
<inertial>
-
<mass value="10"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
<joint name="base_to_right_leg" type="fixed">
-
<parent link="base_link"/>
-
<child link="right_leg"/>
-
<origin xyz="0 -0.22 0.25"/>
-
</joint>
-
-
<link name="right_base">
-
<visual>
-
<geometry>
-
<box size="0.4 0.1 0.1"/>
-
</geometry>
-
<material name="white"/>
-
</visual>
-
<collision>
-
<geometry>
-
<box size="0.4 0.1 0.1"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="10"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="right_base_joint" type="fixed">
-
<parent link="right_leg"/>
-
<child link="right_base"/>
-
<origin xyz="0 0 -0.6"/>
-
</joint>
-
-
<link name="right_front_wheel">
-
<visual>
-
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
-
<geometry>
-
<cylinder length="0.1" radius="0.035"/>
-
</geometry>
-
<material name="black"/>
-
</visual>
-
<collision>
-
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
-
<geometry>
-
<cylinder length="0.1" radius="0.035"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="1"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="right_front_wheel_joint" type="continuous">
-
<axis rpy="0 0 0" xyz="0 1 0"/>
-
<parent link="right_base"/>
-
<child link="right_front_wheel"/>
-
<origin rpy="0 0 0" xyz="0.133333333333 0 -0.085"/>
-
</joint>
-
-
<link name="right_back_wheel">
-
<visual>
-
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
-
<geometry>
-
<cylinder length="0.1" radius="0.035"/>
-
</geometry>
-
<material name="black"/>
-
</visual>
-
<collision>
-
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
-
<geometry>
-
<cylinder length="0.1" radius="0.035"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="1"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="right_back_wheel_joint" type="continuous">
-
<axis rpy="0 0 0" xyz="0 1 0"/>
-
<parent link="right_base"/>
-
<child link="right_back_wheel"/>
-
<origin rpy="0 0 0" xyz="-0.133333333333 0 -0.085"/>
-
</joint>
-
-
<link name="left_leg">
-
<visual>
-
<geometry>
-
<box size="0.6 0.1 0.2"/>
-
</geometry>
-
<origin rpy="0 1.57075 0" xyz="0 0 -0.3"/>
-
<material name="white"/>
-
</visual>
-
<collision>
-
<geometry>
-
<box size="0.6 0.1 0.2"/>
-
</geometry>
-
<origin rpy="0 1.57075 0" xyz="0 0 -0.3"/>
-
</collision>
-
<inertial>
-
<mass value="10"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="base_to_left_leg" type="fixed">
-
<parent link="base_link"/>
-
<child link="left_leg"/>
-
<origin xyz="0 0.22 0.25"/>
-
</joint>
-
-
<link name="left_base">
-
<visual>
-
<geometry>
-
<box size="0.4 0.1 0.1"/>
-
</geometry>
-
<material name="white"/>
-
</visual>
-
<collision>
-
<geometry>
-
<box size="0.4 0.1 0.1"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="10"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="left_base_joint" type="fixed">
-
<parent link="left_leg"/>
-
<child link="left_base"/>
-
<origin xyz="0 0 -0.6"/>
-
</joint>
-
-
<link name="left_front_wheel">
-
<visual>
-
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
-
<geometry>
-
<cylinder length="0.1" radius="0.035"/>
-
</geometry>
-
<material name="black"/>
-
</visual>
-
<collision>
-
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
-
<geometry>
-
<cylinder length="0.1" radius="0.035"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="1"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="left_front_wheel_joint" type="continuous">
-
<axis rpy="0 0 0" xyz="0 1 0"/>
-
<parent link="left_base"/>
-
<child link="left_front_wheel"/>
-
<origin rpy="0 0 0" xyz="0.133333333333 0 -0.085"/>
-
</joint>
-
-
<link name="left_back_wheel">
-
<visual>
-
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
-
<geometry>
-
<cylinder length="0.1" radius="0.035"/>
-
</geometry>
-
<material name="black"/>
-
</visual>
-
<collision>
-
<origin rpy="1.57075 0 0" xyz="0 0 0"/>
-
<geometry>
-
<cylinder length="0.1" radius="0.035"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="1"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="left_back_wheel_joint" type="continuous">
-
<axis rpy="0 0 0" xyz="0 1 0"/>
-
<parent link="left_base"/>
-
<child link="left_back_wheel"/>
-
<origin rpy="0 0 0" xyz="-0.133333333333 0 -0.085"/>
-
</joint>
-
-
<joint name="gripper_extension" type="prismatic">
-
<parent link="base_link"/>
-
<child link="gripper_pole"/>
-
<limit effort="1000.0" lower="-0.38" upper="0" velocity="0.5"/>
-
<origin rpy="0 0 0" xyz="0.19 0 0.2"/>
-
</joint>
-
-
<link name="gripper_pole">
-
<visual>
-
<geometry>
-
<cylinder length="0.2" radius="0.01"/>
-
</geometry>
-
<origin rpy="0 1.57075 0 " xyz="0.1 0 0"/>
-
</visual>
-
<collision>
-
<geometry>
-
<cylinder length="0.2" radius="0.01"/>
-
</geometry>
-
<origin rpy="0 1.57075 0 " xyz="0.1 0 0"/>
-
</collision>
-
<inertial>
-
<mass value="0.05"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="left_gripper_joint" type="revolute">
-
<axis xyz="0 0 1"/>
-
<limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
-
<origin rpy="0 0 0" xyz="0.2 0.01 0"/>
-
<parent link="gripper_pole"/>
-
<child link="left_gripper"/>
-
</joint>
-
-
<link name="left_gripper">
-
<visual>
-
<origin rpy="0.0 0 0" xyz="0 0 0"/>
-
<geometry>
-
<mesh filename="package://urdf_tutorial/meshes/l_finger.dae"/>
-
</geometry>
-
</visual>
-
<collision>
-
<geometry>
-
<mesh filename="package://urdf_tutorial/meshes/l_finger.dae"/>
-
</geometry>
-
<origin rpy="0.0 0 0" xyz="0 0 0"/>
-
</collision>
-
<inertial>
-
<mass value="0.05"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="left_tip_joint" type="fixed">
-
<parent link="left_gripper"/>
-
<child link="left_tip"/>
-
</joint>
-
-
<link name="left_tip">
-
<visual>
-
<origin rpy="0.0 0 0" xyz="0.09137 0.00495 0"/>
-
<geometry>
-
<mesh filename="package://urdf_tutorial/meshes/l_finger_tip.dae"/>
-
</geometry>
-
</visual>
-
<collision>
-
<geometry>
-
<mesh filename="package://urdf_tutorial/meshes/l_finger_tip.dae"/>
-
</geometry>
-
<origin rpy="0.0 0 0" xyz="0.09137 0.00495 0"/>
-
</collision>
-
<inertial>
-
<mass value="0.05"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="right_gripper_joint" type="revolute">
-
<axis xyz="0 0 -1"/>
-
<limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
-
<origin rpy="0 0 0" xyz="0.2 -0.01 0"/>
-
<parent link="gripper_pole"/>
-
<child link="right_gripper"/>
-
</joint>
-
-
<link name="right_gripper">
-
<visual>
-
<origin rpy="-3.1415 0 0" xyz="0 0 0"/>
-
<geometry>
-
<mesh filename="package://urdf_tutorial/meshes/l_finger.dae"/>
-
</geometry>
-
</visual>
-
<collision>
-
<geometry>
-
<mesh filename="package://urdf_tutorial/meshes/l_finger.dae"/>
-
</geometry>
-
<origin rpy="-3.1415 0 0" xyz="0 0 0"/>
-
</collision>
-
<inertial>
-
<mass value="0.05"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="right_tip_joint" type="fixed">
-
<parent link="right_gripper"/>
-
<child link="right_tip"/>
-
</joint>
-
-
<link name="right_tip">
-
<visual>
-
<origin rpy="-3.1415 0 0" xyz="0.09137 0.00495 0"/>
-
<geometry>
-
<mesh filename="package://urdf_tutorial/meshes/l_finger_tip.dae"/>
-
</geometry>
-
</visual>
-
<collision>
-
<geometry>
-
<mesh filename="package://urdf_tutorial/meshes/l_finger_tip.dae"/>
-
</geometry>
-
<origin rpy="-3.1415 0 0" xyz="0.09137 0.00495 0"/>
-
</collision>
-
<inertial>
-
<mass value="0.05"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<link name="head">
-
<visual>
-
<geometry>
-
<sphere radius="0.2"/>
-
</geometry>
-
<material name="white"/>
-
</visual>
-
<collision>
-
<geometry>
-
<sphere radius="0.2"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="2"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="head_swivel" type="continuous">
-
<parent link="base_link"/>
-
<child link="head"/>
-
<axis xyz="0 0 1"/>
-
<origin xyz="0 0 0.3"/>
-
</joint>
-
-
<link name="box">
-
<visual>
-
<geometry>
-
<box size="0.08 0.08 0.08"/>
-
</geometry>
-
<material name="blue"/>
-
<origin xyz="-0.04 0 0"/>
-
</visual>
-
<collision>
-
<geometry>
-
<box size="0.08 0.08 0.08"/>
-
</geometry>
-
</collision>
-
<inertial>
-
<mass value="1"/>
-
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
-
</inertial>
-
</link>
-
-
<joint name="tobox" type="fixed">
-
<parent link="head"/>
-
<child link="box"/>
-
<origin xyz="0.1814 0 0.1414"/>
-
</joint>
-
-
</robot>
launch:
-
<launch>
-
-
<arg name="model" default="$(find urdf_tutorial)/urdf/r2d2.xacro"/>
-
<arg name="gui" default="true" />
-
<arg name="rvizconfig" default="$(find urdf_tutorial)/rviz/urdf.rviz" />
-
-
<param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
-
<param name="use_gui" value="$(arg gui)"/>
-
-
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
-
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
-
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
-
-
</launch>
Gazebo:
xacro
sudo apt install ros-kinetic-xacro
gazebo环境
思考:
1. 仿真一个四轮小机器人:
代码参考:gitcode.net/ZhangRelay/ros_book
效果如下
2. 仿真案例学习:
代码参考:gitcode.net/ZhangRelay/urdf_tutorial
效果如下
文章来源: zhangrelay.blog.csdn.net,作者:zhangrelay,版权归原作者所有,如需转载,请联系作者。
原文链接:zhangrelay.blog.csdn.net/article/details/124750233
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)