| // ***************************************************************************** |
| // Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // which accompanies this distribution, and is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| // |
| // Contributors: |
| // Pierre Allard - initial API and implementation |
| // Regent L'Archeveque |
| // Sebastien Gemme |
| // |
| // SPDX-License-Identifier: EPL-1.0 |
| // ***************************************************************************** |
| |
| @GenModel(prefix="ApogyAddonsMobilityPathplanners", |
| childCreationExtenders="true", |
| extensibleProviderFactory="true", |
| copyrightText="******************************************************************************* |
| Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| All rights reserved. This program and the accompanying materials |
| are made available under the terms of the Eclipse Public License v1.0 |
| which accompanies this distribution, and is available at |
| http://www.eclipse.org/legal/epl-v10.html |
| |
| Contributors: |
| Pierre Allard - initial API and implementation |
| Regent L'Archeveque, |
| Sebastien Gemme |
| |
| SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************", |
| modelName="ApogyAddonsMobilityPathplanners", |
| suppressGenModelAnnotations="false") |
| @GenModel(dynamicTemplates="true", templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates") |
| @GenModel(modelDirectory="/org.eclipse.apogy.addons.mobility.pathplanners/src-gen") |
| @GenModel(editDirectory="/org.eclipse.apogy.addons.mobility.pathplanners.edit/src-gen") |
| |
| package org.eclipse.apogy.addons.mobility.pathplanners |
| |
| import org.eclipse.apogy.addons.geometry.paths.WayPointPath |
| import org.eclipse.apogy.common.geometry.data.CoordinatesSamplingShape |
| import org.eclipse.apogy.common.geometry.data.Mesh |
| import org.eclipse.apogy.common.geometry.data.PolygonSamplingShape |
| import org.eclipse.apogy.common.geometry.data3d.CartesianCoordinatesSet |
| import org.eclipse.apogy.common.geometry.data3d.CartesianPolygon |
| import org.eclipse.apogy.common.geometry.data3d.CartesianPositionCoordinates |
| import org.eclipse.apogy.common.geometry.data3d.CartesianTriangle |
| import org.eclipse.apogy.common.processors.Exception |
| import org.eclipse.apogy.common.processors.Processor |
| import org.eclipse.apogy.common.topology.GroupNode |
| import org.eclipse.apogy.common.topology.Node |
| import org.eclipse.apogy.common.Apogy |
| |
| /** |
| * A path planner that produces a WayPoinPath. |
| */ |
| class WayPointPathPlanner extends Processor<CartesianCoordinatesSet, WayPointPath> |
| { |
| /** |
| * Plan a path between a current position and a destination. |
| * @param currentPosition The current position. |
| * @param destinationPosition The destination position. |
| * @return A path between the current and destination positions. |
| * @throws An exception if no path is found. |
| */ |
| op WayPointPath plan(CartesianPositionCoordinates currentPosition, CartesianPositionCoordinates destinationPosition) throws Exception |
| |
| refers transient CartesianPositionCoordinates currentPosition |
| refers transient CartesianPositionCoordinates currentDestination |
| } |
| |
| /** |
| * A path planner that produces a WayPoinPath based on a triangular mesh. |
| */ |
| class MeshWayPointPathPlanner <T extends CartesianPolygon> extends WayPointPathPlanner |
| { |
| /** |
| * The mesh to use for path planning. |
| */ |
| refers transient Mesh<CartesianPositionCoordinates, CartesianPolygon> mesh |
| } |
| |
| /** |
| * Represent a zone to be excluded from trajectory generated by path planners that |
| * support exclusion zones. |
| */ |
| abstract class ExclusionZone extends Node |
| { |
| /** |
| * Whether a given point is inside the ExclusionZone. |
| * @param point The point. |
| * @return True if the point is inside, false otherwise. |
| */ |
| op boolean isInside(CartesianPositionCoordinates point) |
| |
| /** |
| * Whether a line defined by its end points crosses the ExclusionZone. |
| * @param from The line first point. |
| * @param to The line second point. |
| * @return True if the line crosses the zone,false otherwise. |
| */ |
| op boolean intersects(CartesianPositionCoordinates from, CartesianPositionCoordinates to) |
| } |
| |
| /** |
| * Represent an exclusion zone defined as a circle. |
| */ |
| @Apogy(hasCustomClass="true") |
| class CircularExclusionZone extends ExclusionZone, CoordinatesSamplingShape<CartesianPositionCoordinates>, PolygonSamplingShape<CartesianPositionCoordinates, CartesianTriangle> |
| { |
| /** |
| * The radius of the cylinder. |
| */ |
| @Apogy(units="m") |
| double radius |
| |
| /** |
| * Whether to invert the sampling (true = points inside, false = point outside). |
| */ |
| boolean invertSamplingShape |
| } |
| |
| /** |
| * Path Planner Facade. |
| */ |
| @Apogy(isSingleton="true", hasCustomClass="true") |
| class ApogyAddonsMobilityPathplannersFacade |
| { |
| /** |
| * Creates a Circular Exclusion Zone. |
| * @param radius The zone radius. |
| * @param parent The parent node to which to attach the Circular Exclusion Zone. |
| */ |
| op CircularExclusionZone createCircularExclusionZone(@Apogy(units="m") double radius, GroupNode parent) |
| } |