python可以用来写导航吗_Turbot与python编程-实现多点导航

Turbot与python教程-实现多点导航

说明:

介绍如何实现通过python控制turbot实现多点导航

代码:

实现代码:

#!/usr/bin/env python

# TurtleBot must have minimal.launch & amcl_demo.launch

# navMultiPoints.py

import rospy

import actionlib

from actionlib_msgs.msg import *

from geometry_msgs.msg import Pose, PoseWithCovarianceStamped, Point, Quaternion, Twist

from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal

from random import sample

from math import pow, sqrt

class NavTest():

def __init__(self):

rospy.init_node('nav_test', anonymous=True)

rospy.on_shutdown(self.shutdown)

# How long in seconds should the robot pause at each location?

self.rest_time = rospy.get_param("~rest_time", 10)

# Are we running in the fake simulator?

self.fake_test = rospy.get_param("~fake_test", False)

# Goal state return values

goal_states = ['PENDING', 'ACTIVE', 'PREEMPTED',

'SUCCEEDED', 'ABORTED', 'REJECTED',

'PREEMPTING', 'RECALLING', 'RECALLED',

'LOST']

# Set up the goal locations. Poses are defined in the map frame.

# An easy way to find the pose coordinates is to point-and-click

# Nav Goals in RViz when running in the simulator.

# Pose coordinates are then displayed in the terminal

# that was used to launch RViz.

locations = dict()

locations['hall_foyer'] = Pose(Point(0.643, 4.720, 0.000), Quaternion(0.000, 0.000, 0.223, 0.975))

locations['hall_kitchen'] = Pose(Point(-1.994, 4.382, 0.000), Quaternion(0.000, 0.000, -0.670, 0.743))

location

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值