源码下载
第一个是mpc-ros的代码,第二个是机器人模型包
git clone https://github.com/Geonhee-LEE/mpc_ros.git
git clone https://github.com/CzJaewan/servingbot.git
在一个工作空间下编译,本人是Noetic版本,要做修改
修改mpc_ros/launch下的ref_trajectory_tracking_gazebo.launch
<param name="robot_description" command="$(find xacro)/xacro $(find servingbot_description)/urdf/servingbot.urdf.xacro.py" if="$(eval model == 'serving_bot')"/>
去掉.py
<param name="robot_description" command="$(find xacro)/xacro $(find servingbot_description)/urdf/servingbot.urdf.xacro" if="$(eval model == 'serving_bot')"/>
修改mpc_ros/script下的mpc_trajectory_generation.py。注释掉两个global trajectory_type,两处位置如下
def generation_desired_path():
'''
Create desired path
'''
rospy.loginfo("generation_desired_path()")
desired_path = Path()
iter = 1000
if trajectory_type == "circle":
if __name__ == '__main__':
rospy.init_node('path_node')
rospy.loginfo("path_node is started!!")
trajectory_type = rospy.get_param('~trajectory_type')
odom_sub = rospy.Subscriber('/odom', Odometry, odom_cb)
修改后运行
roslaunch mpc_ros ref_trajectory_tracking_gazebo.launch