5

Gazebo行人作为动态障碍

 1 year ago
source link: https://charon-cheung.github.io/2023/05/21/ROS/ROS%20Kinetic%E7%9F%A5%E8%AF%86/Gazebo%E8%A1%8C%E4%BA%BA%E4%BD%9C%E4%B8%BA%E5%8A%A8%E6%80%81%E9%9A%9C%E7%A2%8D/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Gazebo行人作为动态障碍 | 沉默杀手

Gazebo行人作为动态障碍
2023-05-21|ROSROS Kinetic知识|
Word count: 853|Reading time: 4 min

Gazebo自带的一些模型,比如人行走和奔跑的模型,在/usr/share/gazebo-11/media/modelsGazebo的行人模型不是障碍,机器人开过去撞不上,Rviz里也不会作为障碍,只能找插件让它变成障碍。

Gazebo模型碰撞的插件actor_collisions,按照说明进行编译后,如果执行gazebo ../actor_collisions.world正常,那么说明安装成功了。然后将libActorCollisionsPlugin.so文件复制到/opt/ros/noetic/lib

<actor name="actor">
<!-- 插件 -->
<plugin name="actor_collisions_plugin" filename="libActorCollisionsPlugin.so">
<!-- 行人全身关节,不需修改 -->
<scaling collision="LHipJoint_LeftUpLeg_collision" scale="
0.01
0.001
0.001
"/>
......
<scaling collision="RightFingerBase_RightHandIndex1_collision" scale="
4.0
4.0
3.0
"/>
</plugin>
<!-- 行人的初始位姿 -->
<pose>3 -3 0.9 1.57 0 0</pose>
<!-- 使用哪个模型 -->
<skin>
<filename>walk.dae</filename>
<scale>1.0</scale>
</skin>

<animation name="walking">
<filename>walk.dae</filename>
<scale>1.000000</scale>
<interpolate_x>true</interpolate_x>
</animation>

循环行走的逻辑,使用script,手动确定每个时间点的位姿,尽量保证循环行走的平滑性。

<script>
<loop>true</loop>
<delay_start>0.000000</delay_start>
<auto_start>true</auto_start>

<trajectory id="0" type="walking">
<waypoint>
<time>0.000000</time>
<pose>0.000000 1.000000 0.000000 0.000000 0.000000 0.000000</pose>
</waypoint>
<waypoint>
<time>0.500000</time>
<pose>0.195090 0.980785 0.000000 0.000000 0.000000 -0.196350</pose>
</waypoint>


<waypoint>
<time>18.000000</time>
<pose>-0.195090 0.980785 0.000000 0.000000 0.000000 0.196345</pose>
</waypoint>
</trajectory>
</script>

插件的缺点:

  1. 插件的collision参数难以准确设置
  2. 行走的时间和位姿难以保证平滑性

第1个缺点不好解决,不同的模型需要单独设置参数。针对第2个缺点,我发现了插件gazebo_ros_actor_plugin,这个插件可以对行人进行速度控制。

两种模式(follow_mode): velocity模式,使用teleop_twist_keyboard进行手动控制; path模式,按照path_publisher.py指定路径行走。

对于可控制actor移动的模式,world文件加入下面内容

<actor name="actor">
<pose>3 -3 0.9 1.57 0 0</pose>

<skin>
<filename>walk.dae</filename>
<scale>1.0</scale>
</skin>

<animation name="walking">
<filename>walk.dae</filename>
<scale>1.000000</scale>
<interpolate_x>true</interpolate_x>
</animation>

<plugin name="actor_plugin" filename="libgazebo_ros_actor_command.so">
<!-- <follow_mode>path</follow_mode> -->
<follow_mode>velocity</follow_mode>
<vel_topic>/gazebo_cmd_vel</vel_topic>
<path_topic>/cmd_path</path_topic>
<animation_factor>4.0</animation_factor>
<linear_tolerance>0.1</linear_tolerance>
<linear_velocity>1</linear_velocity>
<angular_tolerance>0.0872</angular_tolerance>
<angular_velocity>2.5</angular_velocity>
<default_rotation>1.57</default_rotation>
</plugin>
</actor>


但问题在于,这个插件的行人和默认的一样,不是障碍,如果能将两个插件结合就好了。

但是同时加载两个插件后,Gazebo里的行人不能正常显示,要么是频繁在站立和躺着之间切换,要么就是原地走,但没有往前动。如果旋转,行人没反应。显然是两个插件冲突了。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK