def center_point1(): outdir = get_comptests_output_dir() templates = load_tile_types() for k, v in templates.items(): if isinstance(v, LaneSegment): area = RectangularArea((-2, -2), (3, 3)) dest = os.path.join(outdir, k) N = len(v.control_points) betas = list(np.linspace(-2, N + 1, 20)) betas.extend(range(N)) betas = sorted(betas) transforms = [] for timestamp in betas: beta = timestamp p = v.center_point(beta) # print('%s: %s' % (beta, geo.SE2.friendly(p))) transform = SE2Transform.from_SE2(p) transforms.append(transform) c = SampledSequence[SE2Transform](betas, transforms) v.set_object("a", PlacedObject(), ground_truth=c) draw_static(v, dest, area=area)
def get_sampling_points(ob0: PlacedObject) -> List[Timestamp]: points = set() def f(ob: PlacedObject) -> PlacedObject: # print(ob) if hasattr(ob, "get_sampling_points"): if not isinstance(ob, GenericSequence): raise ZValueError(ob=ob) sp = ob.get_sampling_points() if sp == GenericSequence.CONTINUOUS: pass else: points.update(sp) # else: # logger.info(f'not a seq: {type(ob)}') return ob ob0.filter_all(f) return sorted(points)
def f(ob: PlacedObject) -> PlacedObject: # print(ob) if hasattr(ob, "get_sampling_points"): if not isinstance(ob, GenericSequence): raise ZValueError(ob=ob) sp = ob.get_sampling_points() if sp == GenericSequence.CONTINUOUS: pass else: points.update(sp) # else: # logger.info(f'not a seq: {type(ob)}') return ob
def remove_stuff_and_children(ob, toremove): assert isinstance(ob, PlacedObject) children = {} for child_name, child in ob.children.items(): if child_name in toremove: pass else: children[child_name] = child srs = {} for sr_name, sr in ob.spatial_relations.items(): if sr.b[0] in toremove: pass else: srs[sr_name] = sr return PlacedObject(children=children, spatial_relations=srs)
def __init__(self, tag=None, **kwargs): PlacedObject.__init__(self, **kwargs) self.tag = tag
def __init__(self, tag=None, **kwargs): # noinspection PyArgumentList PlacedObject.__init__(self, **kwargs) self.tag = tag