def parameter_value( cls, type_defs: TypesDict, scene: CScene, project: CProject, action_id: str, parameter_id: str ) -> Pose: try: ap, ori = project.bare_ap_and_orientation(cls.orientation_id(project, action_id, parameter_id)) except Arcor2Exception as e: raise ParameterPluginException("Failed to get scene/project data.") from e return Pose(ap.position, ori.orientation)
def parameter_ast( cls, type_defs: TypesDict, scene: CScene, project: CProject, action_id: str, parameter_id: str ) -> Attribute: ori_ap, ori = project.bare_ap_and_orientation(cls.orientation_id(project, action_id, parameter_id)) return Attribute( value=Attribute( value=Attribute( value=Name(id="aps", ctx=Load()), attr=ori_ap.name, ctx=Load() # TODO this should not be hardcoded ), attr="poses", # TODO this should not be hardcoded ctx=Load(), ), attr=ori.name, ctx=Load(), )
def abs_pose_from_ap_orientation(scene: CScene, project: CProject, orientation_id: str) -> Pose: """Returns absolute Pose without modifying anything within the project. :param orientation_id: :return: """ ap, ori = project.bare_ap_and_orientation(orientation_id) pose = Pose(ap.position, ori.orientation) parent_id = ap.parent while parent_id: parent = get_parent_pose(scene, project, parent_id) pose = make_pose_abs(parent.pose, pose) parent_id = parent.parent_id return pose