| // ***************************************************************************** |
| // 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="ApogyCore", |
| 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="ApogyCore", |
| multipleEditorPages="false", |
| suppressGenModelAnnotations="false", |
| fileExtensions="sym") |
| @GenModel(dynamicTemplates="true", templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates") |
| @GenModel(modelDirectory="/org.eclipse.apogy.core/src-gen") |
| @GenModel(editDirectory="/org.eclipse.apogy.core.edit/src-gen") |
| |
| package org.eclipse.apogy.core |
| |
| import org.eclipse.apogy.common.Apogy |
| import org.eclipse.apogy.common.emf.Described |
| import org.eclipse.apogy.common.emf.EComparator |
| import org.eclipse.apogy.common.emf.IFilter |
| import org.eclipse.apogy.common.emf.Named |
| import org.eclipse.apogy.common.math.Matrix4x4 |
| import org.eclipse.apogy.common.math.Tuple3d |
| import org.eclipse.apogy.common.topology.AggregateGroupNode |
| import org.eclipse.apogy.common.topology.GroupNode |
| import org.eclipse.apogy.common.topology.Node |
| import org.eclipse.apogy.common.topology.TransformNode |
| import org.eclipse.apogy.common.topology.bindings.BindingsSet |
| import org.eclipse.apogy.core.invocator.AbstractResult |
| import org.eclipse.apogy.core.invocator.AbstractType |
| import org.eclipse.apogy.core.invocator.Environment |
| import org.eclipse.apogy.core.invocator.InitializationData |
| import org.eclipse.apogy.core.invocator.OperationCall |
| import org.eclipse.apogy.core.invocator.OperationCallResult |
| import org.eclipse.apogy.core.invocator.ResultsList |
| import org.eclipse.apogy.core.invocator.Type |
| import org.eclipse.apogy.core.invocator.TypeApiAdapter |
| import org.eclipse.apogy.core.invocator.TypeMember |
| import org.eclipse.emf.ecore.EObject |
| |
| /* Types definitions. */ |
| type Map<K,V> wraps java.util.Map |
| type List<T> wraps java.util.List |
| type Collection<T> wraps java.util.Collection |
| type Exception wraps java.lang.Exception |
| type Comparator<T> wraps java.util.Comparator |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Apogy Core Facade. |
| * |
| * ------------------------------------------------------------------------- */ |
| @Apogy(isSingleton="true", hasCustomClass="true") |
| class ApogyCoreFacade |
| { |
| /** |
| * Create the 4 by 4 homogeneous matrix that represent the absolute pose of a pose initially |
| * defined as a relative pose in an ApogySystem frame. |
| * @param apogySystem The ApogySytem in which to interpret the relative pose. |
| * @param relativePose The relative pose in the Apogy System frame. |
| * @return The absolute pose expressed in 4 by 4 homogeneous matrix. |
| */ |
| op Matrix4x4 computeAbsolutePoseMatrix(ApogySystem apogySystem, Matrix4x4 relativePose) |
| |
| /* |
| * Creates a Result Node associated with a specified PositionedResult result. |
| * @param result The specified PositionedResult. |
| * @return The ResultNode. |
| */ |
| op ResultNode createResultNode(PositionedResult result) |
| |
| /* |
| * Searches and returns the {@link ApogySystem} instance based on the specified fullyQualifiedName. |
| * @param environment Environment from which the search will be performed. |
| * @param param fullyQualifiedName Fully qualified name that refers the {@link ApogySystem} instance. |
| * @return Reference to the {@link ApogySystem} that matches the fully qualified name or null if not found. |
| */ |
| op ApogySystem getApogySystem(Environment environment, String fullyQualifiedName) |
| |
| /** |
| * Searches and returns the {@link ApogySystem} instance based on the specified implementation of that system. |
| * @param environment Environment from which the search will be performed. |
| * @param instance EObject that is the current instance of the ApogySystem we are looking for. |
| * @return Reference to the {@link ApogySystem} for which the current instance matches the specified one or null if not found. |
| */ |
| op ApogySystem getApogySystem(Environment environment, EObject instance) |
| |
| /** |
| * Loads an ApogySystem from a specified absolute path. |
| * @param apogySystemFileAbsolutePath The absolute path to the ApogySystem file. |
| * @return The ApogySystem loaded from the file, |
| * @throws An exception if the load from file failed. |
| */ |
| op ApogySystem loadApogySystemFromFile(String apogySystemFileAbsolutePath) throws Exception |
| |
| /** |
| * Saves a specified ApogySystem to file. |
| * @param apogySystem The ApogySystem to save. |
| * @param apogySystemFileAbsolutePath The absolute path to the file. |
| * @throws An exception if the save to file failed. |
| */ |
| op void saveApogySystemToFile(ApogySystem apogySystem, String apogySystemFileAbsolutePath) throws Exception |
| |
| /* |
| * Loads FeatureOfInterest from file. |
| * @param url The URL locating the file. |
| * @return The list of loaded FeatureOfInterest. |
| * @throws An Exception if the file could not be loaded. |
| */ |
| op List<FeatureOfInterest> loadFeatureOfInterestFromFile(String url) throws Exception |
| |
| /* |
| * Saves a list of FeatureOfInterest to file (in CSV format). |
| * @param path The path to the file. |
| * @param foiList The list of FeatureOfInterest. |
| * @throws An Exception if the file could not be saved. |
| */ |
| op void saveFeatureOfInterestToFile(String path, List<FeatureOfInterest> foiList) throws Exception |
| } |
| |
| |
| class ApogyTopology |
| { |
| @GenModel(children="true", notify="true", property="Readonly") |
| refers derived transient GroupNode rootNode |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Apogy System. |
| * |
| * ------------------------------------------------------------------------- */ |
| @Apogy(hasCustomItemProvider="true") |
| class ApogySystem extends Type |
| { |
| @GenModel(children="true", createChild="true", property="None") |
| contains TopologyRoot topologyRoot |
| contains BindingsSet bindingSet |
| contains ConnectionPointsList [0..1] connectionPointsList opposite apogySystem |
| contains AssemblyLinksList[0..1] assemblyLinksList |
| refers AbstractType[0..1] poseProvider |
| |
| // Used in the ApogySystem copies only. |
| refers transient PoseProvider [0..1] poseProviderInstance |
| } |
| |
| @Apogy(hasCustomClass="true") |
| class ApogySystemApiAdapter extends TypeApiAdapter, PoseProvider |
| { |
| contains AbstractApogySystemPoseCorrector[0..1] poseCorrector opposite apogySystemApiAdapter |
| op Matrix4x4 createResultMatrix(OperationCall operationCall) |
| |
| @GenModel(children="true", createChild="false") |
| refers transient ApogySystem [0..1] apogySystem |
| } |
| |
| class ConnectionPointsList |
| { |
| @GenModel(property="None") |
| container ApogySystem[1] apogySystem opposite connectionPointsList |
| contains ConnectionPoint[0..*] connectionPoints opposite pointsList |
| } |
| |
| class ConnectionPoint extends Named, Described |
| { |
| @GenModel(property="None") |
| container ConnectionPointsList[1] pointsList opposite connectionPoints |
| refers GroupNode node |
| } |
| |
| @Apogy(hasCustomItemProvider="true") |
| class AssemblyLink extends Named, Described |
| { |
| /* |
| * The parent type member of the link. |
| */ |
| @GenModel(propertyCategory="LINK_PARENT") |
| refers TypeMember [0..1] parentTypeMember |
| |
| /* |
| * The destination type member of the link. |
| */ |
| @GenModel(propertyCategory="LINK_CHILD") |
| refers TypeMember [1] subSystemTypeMember |
| |
| /* |
| * The connection on the parent member of the link. |
| */ |
| @GenModel(propertyCategory="LINK_PARENT") |
| refers ConnectionPoint [1] parentConnectionPoint |
| |
| /* |
| * The transformation to position the subsystem |
| * relative to the connection point. |
| */ |
| @GenModel(propertyCategory="LINK_TOPOLOGY") |
| contains Matrix4x4 [0..1] transformationMatrix |
| |
| /* |
| * Any geometry topology used to represent interface hardware. |
| * This topology will be attached to the connection point. |
| */ |
| @GenModel(propertyCategory="LINK_TOPOLOGY") |
| contains Node [0..1] geometryNode |
| |
| @GenModel(property="Readonly", propertyCategory="LINK_PARENT") |
| refers transient ApogySystem [0..1] parentInstance |
| |
| @GenModel(property="Readonly", propertyCategory="LINK_CHILD") |
| refers transient ApogySystem [0..1] subSystemInstance |
| } |
| |
| class AssemblyLinksList{ |
| contains AssemblyLink [0..*] assemblyLinks |
| } |
| |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Apogy System API. |
| * |
| * ------------------------------------------------------------------------- */ |
| |
| class PoseProvider |
| { |
| contains Matrix4x4 [0..1] poseTransform |
| } |
| |
| /** |
| * Class that provide an absolute pose (i.e. a transform relative to the worksite.) |
| */ |
| class AbsolutePoseProvider extends PoseProvider |
| { |
| } |
| |
| /* |
| * Class that provides pose correction. |
| */ |
| abstract class AbstractApogySystemPoseCorrector |
| { |
| /** |
| * The ApogySystemApiAdapter that this PoseCorrector is associated with. |
| */ |
| refers ApogySystemApiAdapter apogySystemApiAdapter opposite poseCorrector |
| |
| /** |
| * Method that applies the correction to the system pose. |
| * @param originalPose The original pose estimate. |
| * @return The corrected pose. |
| */ |
| op Matrix4x4 applyCorrection(Matrix4x4 originalPose) |
| |
| /* |
| * Whether the Pose Corrector is enabled. |
| */ |
| @GenModel(notify="true", propertyCategory="SETTINGS_INFO") |
| boolean enabled = "false" |
| } |
| |
| class ApogyInitializationData extends InitializationData |
| { |
| contains Matrix4x4 [0..1] initialPoseTransform |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Positioned classes |
| * |
| * ------------------------------------------------------------------------- */ |
| @Apogy(hasCustomClass="true") |
| class Positioned |
| { |
| @GenModel(children="true", notify="true", property="Editable", propertyCategory="POSITION_INFO") |
| contains Matrix4x4[1] pose |
| } |
| |
| /* |
| * A feature of interest. |
| */ |
| @Apogy(hasCustomItemProvider="true") |
| class FeatureOfInterest extends Positioned, Named, Described |
| { |
| } |
| |
| /* |
| * List of Feature Of Interest |
| */ |
| @Apogy(hasCustomItemProvider="true") |
| class FeatureOfInterestList extends Named, Described |
| { |
| contains FeatureOfInterest[0..*] featuresOfInterest |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Topology. |
| * |
| * ------------------------------------------------------------------------- */ |
| class TopologyRoot |
| { |
| contains Node originNode |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Positioned Results. |
| * |
| * ------------------------------------------------------------------------- */ |
| |
| class PositionedResult extends AbstractResult, Positioned, Named |
| { |
| } |
| |
| @Apogy(hasCustomItemProvider="true") |
| class OperationCallPositionedResult extends OperationCallResult, PositionedResult |
| { |
| /* |
| * Pose relative to the system that produced the result. |
| * */ |
| @GenModel(children="true", notify="true", property="Readonly", propertyCategory="POSITION_INFO") |
| contains Matrix4x4[1] relativePose |
| } |
| |
| /* |
| * Class representing a result that is no related to an ops call. |
| */ |
| class UserDefinedResult extends PositionedResult, Named, Described |
| { |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Specialized Nodes. |
| * |
| * ------------------------------------------------------------------------- */ |
| |
| /* |
| * A specialized Topology node representing a ApogyResult. |
| */ |
| @Apogy(hasCustomItemProvider="true") |
| class ResultNode extends AggregateGroupNode |
| { |
| /* |
| * The ApogyResult represented by this node. |
| */ |
| refers transient PositionedResult result |
| } |
| |
| /* |
| * A specialized Topology node representing a ResultsList. |
| */ |
| @Apogy(hasCustomClass="true", hasCustomItemProvider="true") |
| class ResultsListNode extends AggregateGroupNode |
| { |
| refers transient ResultsList resultsList |
| } |
| |
| @Apogy(hasCustomClass="true", hasCustomItemProvider="true") |
| class FeatureOfInterestNode extends TransformNode |
| { |
| /* |
| * The Feature Of Interest represented by this node. |
| */ |
| refers transient FeatureOfInterest featureOfInterest |
| } |
| |
| @Apogy(hasCustomClass="true") |
| class FeatureOfInterestListNode extends AggregateGroupNode |
| { |
| refers transient FeatureOfInterestList featureOfInterestList |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Other Generic Classes. |
| * |
| * ------------------------------------------------------------------------- */ |
| |
| /* |
| * Represent an Object for which some attributes needs update to be done either automatically or |
| * manually triggered. |
| */ |
| @Apogy(hasCustomClass="true") |
| abstract class Updatable |
| { |
| /* |
| * Whether or not the object is busy updating. |
| */ |
| @GenModel(notify = "true", property="Readonly", propertyCategory="UPDATABLE") |
| transient boolean updating = "false" |
| |
| /* |
| * Whether or not the object auto update is enabled. |
| */ |
| @GenModel(propertyCategory="UPDATABLE") |
| boolean autoUpdateEnabled |
| |
| /* |
| * Returns the default value of autoUpdateEnabled; |
| */ |
| op boolean getDefaultAutoUpdateEnabled() |
| |
| /* |
| * Update method. |
| */ |
| op void update() throws Exception |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Comparators. |
| * |
| * ------------------------------------------------------------------------- */ |
| |
| /* |
| * Comparator that compares Positioned elements based on their distance |
| * to a given position. |
| */ |
| @Apogy(hasCustomClass="true") |
| class DistanceComparator<T extends Positioned> extends EComparator<T> |
| { |
| /* |
| * The position against which the distance comparison is made. |
| */ |
| contains Tuple3d position |
| } |
| |
| /* ------------------------------------------------------------------------- |
| * |
| * Filters. |
| * |
| * ------------------------------------------------------------------------- */ |
| |
| /* |
| * Filter that filters Positioned based on their distance to a given point. |
| */ |
| @Apogy(hasCustomClass="true") |
| class DistanceFilter<T extends Positioned> extends IFilter<T> |
| { |
| /* |
| * Whether or not a Positioned at exactly maximumDistance is allowed thru. |
| */ |
| boolean inclusive = "true" |
| /* |
| * The maximum distance from the position. |
| */ |
| @GenModel(notify="true") |
| @Apogy(units = "m") |
| double maximumDistance = "10.0" |
| |
| /* |
| * The position from which the distance is computed. |
| */ |
| contains Tuple3d position |
| } |