1.
有些包找不到
rospackage profile
在ros的包中package.xml中添加
<depend>gazebo_ros</depend>
<exec_depend>gazebo</exec_depend>
<export>
<!-- Other tools can request additional information be placed here -->
<gazebo_ros gazebo_media_path="${prefix}"/>
<gazebo_ros gazebo_model_path="${prefix}/models"/>
</export>
${prefix}代表当前包的路径,这样ros命令打开gazebo之后,gazebo就会自动有包下的models路径,就能添加models下的模型
2.
gazebo ros_control可以用pid控制为轮子模拟弹簧的效果,默认pid控制位置环为0,ros_control在joint type=“revolute”时失效,只在type=“continuous”时有效
3.
多轮差速驱动:
wheel_radius参数 该插件可以直接在urdf 轮子的collision中定义的cylinder读取,也可直接在yaml文件下自己给出,
wheel_separation不给出会导致小车无法转弯,因为轮距默认为0
husky_velocity_controller:
type: "diff_drive_controller/DiffDriveController"
left_wheel: ['FrontLeftJoint1','FrontLeftJoint2','BackLeftJoint1','BackLeftJoint2']
right_wheel: ['FrontRightJoint1','FrontRightJoint2','BackRightJoint1','BackRightJoint2']
publish_rate: 50
pose_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 0.03]
twist_covariance_diagonal: [0.001, 0.001, 0.001, 1000000.0, 1000000.0, 0.03]
cmd_vel_timeout: 0.25
#wheel_radius
wheel_separation : 0.629
k_l: 0.1
k_r: 0.1
# Odometry fused with IMU is published by robot_localization, so
# no need to publish a TF based on encoders alone.
enable_odom_tf: false
# Wheel separation and radius multipliers
wheel_separation_multiplier: 1.5 # default: 1.0
wheel_radius_multiplier : 1.0 # default: 1.0
# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
linear:
x:
has_velocity_limits : true
max_velocity : 2.0 # m/s
has_acceleration_limits: true
max_acceleration : 20.0 # m/s^2
angular:
z:
has_velocity_limits : true
max_velocity : 4.0 # rad/s
has_acceleration_limits: true
max_acceleration : 25.0 # rad/s^2
4.
gazebo轮子摩擦力设置对小车转弯抖动有重要影响
it should be possible to set mu to adjust friction in the direction of the y axis and mu2 to adjust friction in the direction of the x axis of the robot (as fdir2 is calculated to be perpendicular to both fdir1 and the contact normal).
My wheel cylinder is spinning around it´s y axis, so setting
<fdir1>0 1 0</fdir1>
也就是 垂直轮子前进方向朝外的方向是mu1摩擦系数的方向 ,轮子的前进方向是mu2摩擦系数的方向,所以转弯出现剧烈抖动甚至翻车的原因是mu1系数过大,需要调小。最终我mu1=0.5,mu2=1转弯时是非常ok的。
5、
在运行gazebo的过程中,出现了 黑屏 和下面的错误:
[gazebo-2] process has died [pid 28003, exit code 255, cmd /opt/ros/indigo/lib/gazebo_ros/gzserver worlds/empty.world __name:=gazebo __log:=/home/exbot/.ros/log/3bd6002c-c882-11e8-8b6c-000c299fff92/gazebo-2.log].
log file: /home/exbot/.ros/log/3bd6002c-c882-11e8-8b6c-000c299fff92/gazebo-2*.log
运行下面的命令即可:
killall gzserver
killall gzclient
6、
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" if="$(arg is7dof)"
args="-urdf -model $(arg kinova_robotName) -param robot_description
-J $(arg kinova_robotType)_joint_1 0.0
-J $(arg kinova_robotType)_joint_2 2.9
-J $(arg kinova_robotType)_joint_3 0.0
-J $(arg kinova_robotType)_joint_4 1.3
-J $(arg kinova_robotType)_joint_5 -2.07
-J $(arg kinova_robotType)_joint_6 1.4
-J $(arg kinova_robotType)_joint_7 0.0
-J $(arg kinova_robotType)_joint_finger_1 1.0
-J $(arg kinova_robotType)_joint_finger_2 1.0
-J $(arg kinova_robotType)_joint_finger_3 1.0" />
-J 的意思是在运行前将joint移动到那个位置
7、use_sim_time = true以后如果没有/clock话题中的时钟,ros::time将会卡住,导致rivz无法显示
<param name="use_sim_time" value="true"/>