Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/de.fraunhofer.ipa.ros.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ros.ServiceClient
import ros.ServiceServer
import ros.Subscriber
import ros.Parameter
import ros.QualityOfService

/**
* This class contains custom validation rules.
Expand Down Expand Up @@ -42,23 +43,23 @@ class RosValidator extends AbstractRosValidator {
}}
@Check
def void checkNameConventionsPackage (Package rospackage) {
for (char c : rospackage.name.toCharArray){
if (Character.isUpperCase(c)){
error("The name of a package has to follow the ROS naming conventions: Capital letters are not allowed", null, INVALID_NAME);
}
}
for (char c : rospackage.name.toCharArray){
if (Character.isUpperCase(c)){
error("The name of a package has to follow the ROS naming conventions: Capital letters are not allowed", null, INVALID_NAME);
}
}
}
@Check
def void checkNameConventionsParameters (Parameter parameter) {
for (i : 0 ..< parameter.name.length) {
val c = parameter.name.charAt(i)
if (Character.isUpperCase(c)) {
val remaining = parameter.name.substring(i)
if (!remaining.contains(".")) {
warning("The name of a parameter has to follow the ROS naming conventions: Capital letters are not recommended", null, INVALID_NAME);
}
}
}
for (i : 0 ..< parameter.name.length) {
val c = parameter.name.charAt(i)
if (Character.isUpperCase(c)) {
val remaining = parameter.name.substring(i)
if (!remaining.contains(".")) {
warning("The name of a parameter has to follow the ROS naming conventions: Capital letters are not recommended", null, INVALID_NAME);
}
}
}
}

/* Customize Syntax Error Messages */
Expand Down Expand Up @@ -142,4 +143,24 @@ class RosValidator extends AbstractRosValidator {
// // allow the use of numbers
//

public static val INVALID_VALUE = 'invalidValue'
@Check
def void CheckQoS (QualityOfService qos){
CheckDuration(qos.leaseDuration)
CheckDuration(qos.lifespan)
CheckDuration(qos.deadline)
}

def void CheckDuration(String duration)
{
if(duration != 'infinite' && duration !== null){
try{
Integer.parseInt(duration)
}
catch (NumberFormatException e){
error("Durations of lease_duration, lifespan, deadline should be specified as a string of nanoseconds which can convert to int, or as infinite", null, INVALID_VALUE)
}
}
}

}
4 changes: 4 additions & 0 deletions plugins/de.fraunhofer.ipa.ros/model/ros.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@
defaultValueLiteral="reliable"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Durability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="transient_local"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Liveliness" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="LeaseDuration" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Lifespan" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Deadline" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TopicSpecMsgRef" eSuperTypes="PrimitivesTypes.ecore#//AbstractType">
<eStructuralFeatures xsi:type="ecore:EReference" name="Reference" lowerBound="1"
Expand Down
4 changes: 4 additions & 0 deletions plugins/de.fraunhofer.ipa.ros/model/ros.genmodel
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Depth"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Reliability"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Durability"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Liveliness"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/LeaseDuration"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Lifespan"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Deadline"/>
</genClasses>
<genClasses ecoreClass="ros.ecore#//TopicSpecMsgRef">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference ros.ecore#//TopicSpecMsgRef/Reference"/>
Expand Down
Loading