【问题标题】:Origin of a ROS map representationROS地图表示的起源
【发布时间】:2018-03-30 20:51:20
【问题描述】:

我正在使用 ROS 及其 map_server 节点。

我不明白地图的原始元数据信息是什么意思(概念上)。根据官方文档:

origin : 地图左下角像素的二维姿态,如 (x, y, yaw),yaw 为逆时针旋转(yaw=0 表示不旋转)。 目前系统的许多部分都忽略了偏航。

不是机器人的初始位姿吗?但是它建立了占用网格的一些感兴趣的区域?

为什么这个值对导航堆栈如此重要?

你能给我一个简单的例子,说明同一张地图有不同的起源吗?

【问题讨论】:

    标签: datagrid maps ros robot


    【解决方案1】:

    原点一般是程序开始时机器人的位置。所以是的,机器人的初始姿势。当我使用它时,它可以作为机器人的原始位置。通常,当使用原点时,您会创建当前位置的深层副本。

    def initPose(self):
        origin = copy.deepcopy(self._current)
    
        q = [origin.orientation.x,
            origin.orientation.y,
            origin.orientation.z,
            origin.orientation.w]  # quaternion nonsense
    
        (roll, pitch, yaw) = euler_from_quaternion(q)
        return (self._current.position.x, self._current.position.y, yaw)
    
        # self._odom_list.waitForTransform('YOUR_STRING_HERE', 'YOUR_STRING_HERE', rospy.Time(0), rospy.Duration(1.0))
    

    但我也使用原点作为函数的原点。

    def navToPose(self, goal):
    # self._odom_list.waitForTransform('map', 'base_footprint', rospy.Time(0), rospy.Duration(1.0))
    # transGoal = self._odom_list.transformPose('base_footprint', goal) # transform the nav goal from the global coordinate system to the robot's coordinate system
        origin = copy.deepcopy(self._current)
    
        q = [origin.orientation.x,
             origin.orientation.y,
             origin.orientation.z,
             origin.orientation.w]  # quaternion nonsense
    
        (roll, pitch, yaw) = euler_from_quaternion(q)
         qc = [self._current.orientation.x,
               self._current.orientation.y,
               self._current.orientation.z,
               self._current.orientation.w]
        (rollc, pitchc, yawc) = euler_from_quaternion(qc)
        x = goal.pose.position.x
        y = goal.pose.position.y
        cx = origin.position.x
        cy = self._current.position.y
    
        print('current', cx, cy)
        print(x, y)
        theta = math.atan2(y-cy, x-cx)
        print ('angle is ', theta)
        self.rotate(theta)
        distance = (((x - cx) ** 2) + ((y - cy) ** 2)) ** .5
        print ('distance is ', distance)
        self.driveStraight(0.5, distance)
    

    所以一般来说,我更多地将它用作另一个变量。

    取决于占用网格的完成方式。有时原点将指的是它在网格上的开始位置。让程序知道它是否还在地图上。这可能会产生此处显示的问题:https://answers.ros.org/question/285602/static-map-corner-at-origin-for-navigation-stack/(至少从我的经历来看)

    有关导航堆栈的更多信息,请访问:http://wiki.ros.org/navigation 在这里:https://www.dis.uniroma1.it/~nardi/Didattica/CAI/matdid/robot-programming-ROS-introduction-to-navigation.pdf

    【讨论】:

      【解决方案2】:

      来自ros消息定义(http://docs.ros.org/api/nav_msgs/html/msg/MapMetaData.html):

       # The origin of the map [m, m, rad].  This is the real-world pose of the
       # cell (0,0) in the map.
      

      这是地图左下角的坐标在参考框架中

      机器人及其位置与地图原点无关。

      这里有一些细节和漂亮的插图:https://answers.ros.org/question/205521/robot-coordinates-in-map/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-05-15
        • 2018-05-03
        • 2022-12-13
        • 2017-06-24
        • 1970-01-01
        • 2017-05-30
        • 2020-12-08
        • 1970-01-01
        相关资源
        最近更新 更多