# Copyright (c) 2020 Jeff Irion and contributors## This file originated from the `graphslam` package:## https://github.com/JeffLIrion/python-graphslam"""A ``Vertex`` class."""import matplotlib.pyplot as plt# pylint: disable=too-few-public-methodsclass Vertex:"""A class for representing a vertex in Graph SLAM.Parameters----------vertex_id : intThe vertex's unique IDpose : graphslam.pose.se2.PoseSE2The pose associated with the vertexvertex_index : int, NoneThe vertex's index in the graph's ``vertices`` listAttributes----------id : intThe vertex's unique IDindex : int, NoneThe vertex's index in the graph's ``vertices`` listpose : graphslam.pose.se2.PoseSE2The pose associated with the vertex"""def __init__(self, vertex_id, pose, vertex_index=None):self.id = vertex_idself.pose = poseself.index = vertex_indexdef to_g2o(self):"""Export the vertex to the .g2o format.Returns-------strThe vertex in .g2o format"""return "VERTEX_SE2 {} {} {} {}\n".format(self.id, self.pose[0], self.pose[1], self.pose[2])def plot(self, color='r', marker='o', markersize=3):"""Plot the vertex.Parameters----------color : strThe color that will be used to plot the vertexmarker : strThe marker that will be used to plot the vertexmarkersize : intThe size of the plotted vertex"""x, y = self.pose.positionplt.plot(x, y, color=color, marker=marker, markersize=markersize)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。