• 大小:
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-17
  • 语言: 其他
  • 标签: ROS  

资源简介

ROS by example入门实例(中文版+源码).zip

资源截图

代码片段和文件信息

#!/usr/bin/env python

“““
    follower.py - Version 1.1 2013-12-20
    
    Follow a “person“ by tracking the nearest object in x-y-z space.
    
    based on the follower application by Tony Pratkanis at:
    
    http://ros.org/wiki/turtlebot_follower
    
    Created for the Pi Robot Project: http://www.pirobot.org
    Copyright (c) 2012 Patrick Goebel.  All rights reserved.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details at:
    
    http://www.gnu.org/licenses/gpl.html
“““

import rospy
from roslib import message
from sensor_msgs import point_cloud2
from sensor_msgs.msg import PointCloud2
from geometry_msgs.msg import Twist
from math import copysign

class Follower():
    def __init__(self):
        rospy.init_node(“follower“)
        
        # Set the shutdown function (stop the robot)
        rospy.on_shutdown(self.shutdown)
        
        # The dimensions (in meters) of the box in which we will search
        # for the person (blob). These are given in camera coordinates
        # where x is left/righty is up/down and z is depth (forward/backward)
        self.min_x = rospy.get_param(“~min_x“ -0.2)
        self.max_x = rospy.get_param(“~max_x“ 0.2)
        self.min_y = rospy.get_param(“~min_y“ -0.3)
        self.max_y = rospy.get_param(“~max_y“ 0.5)
        self.max_z = rospy.get_param(“~max_z“ 1.2)
        
        # The goal distance (in meters) to keep between the robot and the person
        self.goal_z = rospy.get_param(“~goal_z“ 0.6)
        
        # How far away from the goal distance (in meters) before the robot reacts
        self.z_threshold = rospy.get_param(“~z_threshold“ 0.05)
        
        # How far away from being centered (x displacement) on the person
        # before the robot reacts
        self.x_threshold = rospy.get_param(“~x_threshold“ 0.05)
        
        # How much do we weight the goal distance (z) when making a movement
        self.z_scale = rospy.get_param(“~z_scale“ 1.0)

        # How much do we weight left/right displacement of the person when making a movement        
        self.x_scale = rospy.get_param(“~x_scale“ 2.5)
        
        # The maximum rotation speed in radians per second
        self.max_angular_speed = rospy.get_param(“~max_angular_speed“ 2.0)
        
        # The minimum rotation speed in radians per second
        self.min_angular_speed = rospy.get_param(“~min_angular_speed“ 0.0)
        
        # The max linear speed in meters per second
        self.max_linear_speed = rospy.get_param(“~max_linear_speed“

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件    54899979  2019-07-16 11:24  ROS入门实例(中文版).pdf
     目录           0  2019-07-16 11:30  rbx1-indigo-devel\
     文件         578  2018-02-24 21:57  rbx1-indigo-devel\README.md
     目录           0  2019-07-16 11:30  rbx1-indigo-devel\rbx1\
     文件         103  2018-02-24 21:57  rbx1-indigo-devel\rbx1\CMakeLists.txt
     文件         793  2018-02-24 21:57  rbx1-indigo-devel\rbx1\package.xml
     文件         809  2018-02-24 21:57  rbx1-indigo-devel\rbx1-prereq.sh
     目录           0  2019-07-16 11:30  rbx1-indigo-devel\rbx1_apps\
     文件         108  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\CMakeLists.txt
     目录           0  2019-07-16 11:30  rbx1-indigo-devel\rbx1_apps\launch\
     文件         523  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\launch\follower.launch
     文件        1814  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\launch\follower2.launch
     文件        1184  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\launch\head_tracker_app.launch
     文件         677  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\launch\object_follower.launch
     文件         329  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\launch\object_tracker.launch
     文件         586  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\mainpage.dox
     目录           0  2019-07-16 11:30  rbx1-indigo-devel\rbx1_apps\nodes\
     文件        6663  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\nodes\follower.py
     文件        6060  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\nodes\follower2.py
     文件       11946  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\nodes\object_follower.py
     文件        6452  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\nodes\object_tracker.py
     文件         870  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\package.xml
     目录           0  2019-07-16 11:30  rbx1-indigo-devel\rbx1_apps\src\
     文件           0  2018-02-24 21:57  rbx1-indigo-devel\rbx1_apps\src\__init__.py
     目录           0  2019-07-16 11:30  rbx1-indigo-devel\rbx1_bringup\
     文件         110  2018-02-24 21:57  rbx1-indigo-devel\rbx1_bringup\CMakeLists.txt
     目录           0  2019-07-16 11:30  rbx1-indigo-devel\rbx1_bringup\config\
     文件        1084  2018-02-24 21:57  rbx1-indigo-devel\rbx1_bringup\config\fake_pi_arbotix.yaml
     文件         374  2018-02-24 21:57  rbx1-indigo-devel\rbx1_bringup\config\fake_turtlebot_arbotix.yaml
     文件         759  2018-02-24 21:57  rbx1-indigo-devel\rbx1_bringup\config\fake_turtlebot_with_head_arbotix.yaml
     文件         232  2018-02-24 21:57  rbx1-indigo-devel\rbx1_bringup\config\openni_params.yaml
............此处省略270个文件信息

评论

共有 条评论