(ros2/ros)__urdf文件: <Transmissions>

发布时间:2024年01月05日

Transmissions()

For every non-fixed joint, we need to specify a transmission, which tells Gazebo what to do with the joint. Let's start with the head joint. Add the following to your?URDF:

不看不知道,每个在gazebo里面需要运动的关节都需要添加<Transmissions>标签,例如如果你有一个小车只是需要移动位置,可以只在地盘的base_footprint添加一个<Transmissions>就可以了,

反正你的轮子转向的时候又不需要模拟出轮胎的转向,但是如果你需要模拟出小车转向的时候,

轮胎的转动,这个时候就需要在轮胎关节部分---joint部分添加<Transmissions>,这样gazebo里面的-------那个书里面好像不是这么写的啊,书里面就没有Transmissions,

? ? ? ? 在书里面好像是关节只要定义运动方式就可以了,也没有说要添加Transmissions

切换行号显示

? 1   <transmission name="head_swivel_trans">
? 2     <type>transmission_interface/SimpleTransmission</type>
? 3     <actuator name="$head_swivel_motor">
? 4       <mechanicalReduction>1</mechanicalReduction>
? 5     </actuator>
? 6     <joint name="head_swivel">
? 7       <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
? 8     </joint>
? 9   </transmission>
  • For introductory purposes, just treat most of this chunk of code as boilerplate.
  • The first thing to note is the joint element. The name should match the joint declared earlier.
  • The hardwareInterface will be important as we explore the plugins.

You can run this URDF with our previous launch configuration.??roslaunch?urdf_sim_tutorial?09-joints.launch?model:=urdf/10-firsttransmission.urdf.xacro??

Now, the head is displayed properly in RViz because the head joint is listed in the joint_states messages.

header:
  seq: 220
  stamp:
    secs: 4
    nsecs: 707000000
  frame_id: ''
name: ['head_swivel']
position: [-2.9051283156888985e-08]
velocity: [7.575990694887896e-06]
effort: [0.0]

We could continue adding transmissions for all the non-fixed joints (and we will) so that all the joints are properly published. But, there's more to life than just looking at robots. We want to control them. So, let's get another controller in here.

//? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /? ? ? ? ? ? ? ? ? ?/? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?//

Joint Control()

Here's?the next controller config we're adding.

type: "position_controllers/JointPositionController"
joint: head_swivel

This specifies to use the a?JointPositionController?from the?position_controllers?package to control the head_swivel transmission. Note that hardware interface in the URDF for this joint matches the controller type.

Now we can launch this with the added config as before??roslaunch?urdf_sim_tutorial?10-head.launch?

Now Gazebo is subscribed to a new topic, and you can then control the position of the head by publishing a value in ROS.?rostopic?pub?/r2d2_head_controller/command?std_msgs/Float64?"data:?-0.707"

When this command is published, the position will immediately change to the specified value. This is because we did not specify any limits for the joint in our urdf. However, if we change the joint, it will move gradually.

切换行号显示

? 1   <joint name="head_swivel" type="continuous">
? 2     <parent link="base_link"/>
? 3     <child link="head"/>
? 4     <axis xyz="0 0 1"/>
? 5     <origin xyz="0 0 ${bodylen/2}"/>
? 6     <limit effort="30" velocity="1.0"/>
? 7   </joint>

?roslaunch?urdf_sim_tutorial?10-head.launch?model:=urdf/11-limittransmission.urdf.xacro

文章来源:https://blog.csdn.net/geniusChinaHN/article/details/135404751
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。