def update_geo_path(self): if (self.waypoints and self.zone and self.band): waypoints_geo = [] for point in self.waypoints: x, y = point geo = UTMPoint(x, y, zone=self.zone, band=self.band).toMsg() wp = WayPoint() wp.id = unique_id.toMsg(unique_id.fromRandom()) wp.position = geo waypoints_geo.append(wp) segments_geo = [] last_wp = waypoints_geo[0].id for wp in waypoints_geo: seg = RouteSegment() seg.id = unique_id.toMsg(unique_id.fromRandom()) seg.start = last_wp seg.end = wp.id last_wp = wp.id segments_geo.append(seg) self.route_network.points = waypoints_geo self.route_network.segments = segments_geo else: rospy.logwarn('[update_geo_path] waypoints, zone, and/or band\n' + '\thas not been set/updated.\n\tIgnoring...')
def test_segment_null_value(self): s = RouteSegment() put(s, 'another', 'anything') put(s, 'name') self.assertEqual(get(s, 'name'), '') put(s, 'name', 'myself') self.assertEqual(get(s, 'name'), 'myself')
def makeSeg(start, end, oneway=False): """ Make RouteSegment message. :param start: Initial UUID. :param end: Final UUID. :param oneway: True if segment is one-way. :returns: RouteSegment message. """ uu = geodesy.gen_uuid.makeUniqueID(PKG_URL + '/' + str(start) + '/' + str(end)) seg = RouteSegment(id=uu, start=UniqueID(uuid=start), end=UniqueID(uuid=end)) if oneway: seg.props.append(KeyValue(key='oneway', value='yes')) return seg
def makeSegment(id, start, end): return RouteSegment(id = UniqueID(id), start = UniqueID(start), end = UniqueID(end))