如何在gazebo进行 joint的转动控制
【摘要】 总结 如何在gazebo进行 joint的转动控制
下面总结 如何在gazebo进行 joint的转动控制
xacro文件
设置两个link
<link name="rotate_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry >
<box size="${size_rotate_link_x} ${size_rotate_link_y} ${size_rotate_link_z}" />
</geometry>
<material name="LightGray" />
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry >
<box size="${size_rotate_link_x} ${size_rotate_link_y} ${size_rotate_link_z}" />
</geometry>
</collision>
<inertial>
<mass value="${massGain*1}"/>
<inertia ixx="${massGain*1}" ixy="0.0" ixz="0.0" iyy="${massGain*1}" iyz="0.0" izz="${massGain*1}"/>
</inertial>
</link>
<gazebo reference="rotate_link">
<material>Gazebo/Grey</material>
<turnGravityOff>true</turnGravityOff>
</gazebo>
<link name="rotate_platform_base_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry >
<box size="${size_rotate_platform_base_link_x} ${size_rotate_platform_base_link_y} ${size_rotate_platform_base_link_z}" />
</geometry>
<material name="LightGray" />
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry >
<box size="${size_rotate_platform_base_link_x} ${size_rotate_platform_base_link_y} ${size_rotate_platform_base_link_z}" />
</geometry>
</collision>
<inertial>
<mass value="${massGain*1}"/>
<inertia ixx="${massGain*1}" ixy="0.0" ixz="0.0" iyy="${massGain*1}" iyz="0.0" izz="${massGain*1}"/>
</inertial>
</link>
<gazebo reference="rotate_platform_base_link">
<material>Gazebo/Black</material>
<turnGravityOff>true</turnGravityOff>
</gazebo>
</xacro:macro>
两个基本的link
设置完后,设置 joint
设置joint
<joint name="rotate_joint" type="continuous">
<parent link="rotate_platform_base_link"/>
<child link="rotate_link"/>
<origin xyz="0.075 0 0.225" rpy="0 0 0" />
<axis xyz="1 0 0" />
<limit effort="10" velocity="1000" />
</joint>
- continuous 进行速度控制 一直转
- revolute 进行位置控制 有上下限
设置transmission
<transmission name="rotate_joint_transmission">
<type>transmission_interface/SimpleTransmission</type>
<joint name="rotate_joint">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="motor1">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
设置 gazebo
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/rotate_platform</robotNamespace>
<controlPeriod>0.01</controlPeriod>
<robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
</plugin>
</gazebo>
xacro设置完毕
配置yaml文件
rotate_platform:
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
rotate_velocity_controller:
type: effort_controllers/JointVelocityController
joint: rotate_joint
pid: {p: 1, i: 0.0, d: 0.0, i_clamp: 0.0}
joint的名字要和上面对应
配置launch文件
<rosparam file="$(find slam_sensor_sim_gazebo)/config/rotate_control.yaml" command="load"/>
<node name="controller_manager" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/rotate_platform" args="joint_state_controller rotate_velocity_controller --shutdown-timeout 3"/>
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)