代码复现:amr-lmpcc

本文最后更新于:2020年7月22日 下午

项目地址:https://github.com/tud-amr/amr-lmpcc

Tag Content
硬件环境 树莓派3B+,思岚A1雷达
软件环境 ubuntu 16.04,ROS kinetic
实验目的 重现代码
注意事项 项目为gazebo仿真环境,本文为实际环境

1. 下载编译

1.1 下载编译过程

1.先使用如下命令更新软件包

1
2
sudo apt-get update
sudo apt-get upgrade

2.下载编译

1
2
3
4
5
6
7
8
9
10
sudo apt-get install ros-kinetic-jackal-control ros-kinetic-jackal-gazebo ros-kinetic-jackal-simulator ros-kinetic-jackal-description ros-kinetic-jackal-desktop ros-kinetic-jackal-navigation ros-kinetic-jackal-viz
sudo apt install ros-kinetic-people-msgs
cd [workspace]/src
git clone https://github.com/bbrito/pedsim_ros.git -b four_persons
git clone https://github.com/spencer-project/spencer_messages.git
git clone https://github.com/srl-freiburg/spencer_tracking_rviz_plugin.git
git clone https://github.com/tud-amr/amr-lmpcc.git
cd ../
rosdep install --from-paths src --ignore-src -r -y
catkin_make -j1
  • 然后会提示如下错误❌:
1
2
3
4
5
/lmpcc/catkin_ws/src/pedsim_ros/pedsim_visualizer/src/sim_visualizer.cpp:107:12: error: ‘spencer_tracking_msgs::TrackedPerson {aka struct spencer_tracking_msgs::TrackedPerson_<std::allocator<void> >}’ has no member named ‘goal’
person.goal.position.x = agent_state.goal.position.x;
^
/lmpcc/catkin_ws/src/pedsim_ros/pedsim_visualizer/src/sim_visualizer.cpp:108:12: error: ‘spencer_tracking_msgs::TrackedPerson {aka struct spencer_tracking_msgs::TrackedPerson_<std::allocator<void> >}’ has no member named ‘goal’
person.goal.position.y = agent_state.goal.position.y;
  • 解决方案:

由于不使用这个pedsim_visualizer这个包,直接找到错误代码的位置将其注释掉,然后再次编译,

  • 会提示如下错误❌:
1
/lmpcc/catkin_ws/src/pedsim_ros/pedsim_gazebo_plugin/src/actor_poses_plugin.cpp:8:46: fatal error: gazebo-9/gazebo/physics/physics.hh: No such file or directory
  • 解决方案:

直接将pedsim_gazebo_plugin这个包删除,再次编译,

  • 会提示如下错误❌:
1
/lmpcc/catkin_ws/src/amr-lmpcc/lmpcc/include/lmpcc/lmpcc_controller.h:134:31: fatal error: lmpcc/LmpccConfig.h: No such file or directory
  • 解决方案:

在这里使用如下命令单独编译lmpcc包。

1
2
3
catkin_make -DCATKIN_WHITELIST_PACKAGES="lmpcc"
# 注意使用完上述命令,一定要紧接着使用以下命令再次编译
catkin_make -DCATKIN_WHITELIST_PACKAGES=""

至此,编译工作完成。

注:

  1. 第一次编译时一定要使用catkin_make -j1,因为某些包可能依赖于其他包,所以最好使用单线程编译。
  2. 上述编译过程是为了在实际环境中使用做的,如果要在仿真环境中运行,还需自己解决遇到的编译问题,而不是像这样直接把对应包删除。

1.2 参考资料

2. 初步运行测试

2.1 准备工作

由于此次测试打算使用提前定义的障碍物,故需要修改

$(find lmpcc_obstacle_feed)/config/lmpcc_obstacle_feed_config.yaml

1
2
3
# Obstacle feed mode (0 = sensor mode, 1 = OptiTrack mode, 2 = predefined obstacles, 4 = Pedsim)
# need to recompile after changing!
obstacle_feed_mode: 2 # before 4

此时调用roslaunch lmpcc_obstacle_feed map_lmpcc_obstacle_feed.launch

会提示如下错误❌

1
2
terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 3) >= this->size() (which is 3)

这是因为$(find lmpcc_obstacle_feed)/config/lmpcc_obstacle_feed_config.yaml

中的predefined_obstacles只有3个障碍物,而detected_obstacles中的obstacle_number等于4

故有如下解决方案:

  • predefined_obstacles中再定义一个障碍物

注:如果直接将obstacle_number改为 3 会导致节点lmpcc与节点lmpcc_obstacle_feed的冲突,目前还没有找到原因。

2.2 运行测试

2.2.1 测试过程

分别在3个不同的终端运行如下命令:

1
2
3
roslaunch lmpcc_obstacle_feed map_lmpcc_obstacle_feed.launch
roslaunch static_collision_avoidance static_collision_avoidance.launch
roslaunch lmpcc robot_lmpcc.launch

2.2.2 运行结果

使用如下命令:

1
rqt_graph

得到当前的节点图。