资源简介
可以再gazebo中实现沿墙算法,颜色检测以及路径规划等功能
代码片段和文件信息
#!/usr/bin/env python
‘‘‘
Copyright (c) 2015 Mark Silliman
All rights reserved.
Redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS“ AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
‘‘‘
# TurtleBot must have minimal.launch & amcl_demo.launch
# running prior to starting this script
# For simulation: launch gazebo world & amcl_demo prior to run this script
import rospy
from move_base_msgs.msg import MovebaseAction MovebaseGoal
import actionlib
from actionlib_msgs.msg import *
from geometry_msgs.msg import Pose Point Quaternion
from image_converter import Image_converter
class GoToPose():
def __init__(self):
self.goal_sent = False
# What to do if shut down (e.g. Ctrl-C or failure)
rospy.on_shutdown(self.shutdown)
# Tell the action client that we want to spin a thread by default
self.move_base = actionlib.SimpleActionClient(“move_base“ MovebaseAction)
print(“Wait for the action server to come up“)
# Allow up to 5 seconds for the action server to come up
self.move_base.wait_for_server(rospy.Duration(5))
def goto(self pos quat):
# Send a goal
self.goal_sent = True
goal = MovebaseGoal()
goal.target_pose.header.frame_id = ‘map‘
goal.target_pose.header.stamp = rospy.Time.now()
goal.target_pose.pose = Pose(Point(pos[‘x‘] pos[‘y‘] 0.000) Quaternion(quat[‘r1‘] quat[‘r2‘] quat[‘r3‘] quat[‘r4‘]))
# Start moving
self.move_base.send_goal(goal)
# Allow TurtleBot up to 60 seconds to complete task
success = self.move_base.wait_for_result(rospy.Duration(60))
state = self.move_base.get_sta
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5864 2020-07-29 11:39 go_to_specific_point_on_map.py
文件 2703 2020-07-29 11:39 image_converter.py
文件 772 2020-07-29 11:39 main.py
文件 5290 2020-07-29 11:39 wall_follower.py
- 上一篇:chengdu_map_new 成都市shp格式地图
- 下一篇:手写数字识别
评论
共有 条评论