Skip to content

Commit 7facff1

Browse files
authored
Merge pull request #229 from ipa320/rebase/kas-lab/qos_update
Rebase/kas lab/qos update
2 parents 0b8edca + dd59db1 commit 7facff1

31 files changed

Lines changed: 5808 additions & 4486 deletions

File tree

plugins/de.fraunhofer.ipa.ros.parent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,4 @@
197197
</plugin>
198198
</plugins>
199199
</build>
200-
</project>
200+
</project>

plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/validation/RosValidator.xtend

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import ros.ServiceClient
1414
import ros.ServiceServer
1515
import ros.Subscriber
1616
import ros.Parameter
17+
import ros.QualityOfService
1718

1819
/**
1920
* This class contains custom validation rules.
@@ -42,23 +43,23 @@ class RosValidator extends AbstractRosValidator {
4243
}}
4344
@Check
4445
def void checkNameConventionsPackage (Package rospackage) {
45-
for (char c : rospackage.name.toCharArray){
46-
if (Character.isUpperCase(c)){
47-
error("The name of a package has to follow the ROS naming conventions: Capital letters are not allowed", null, INVALID_NAME);
48-
}
49-
}
46+
for (char c : rospackage.name.toCharArray){
47+
if (Character.isUpperCase(c)){
48+
error("The name of a package has to follow the ROS naming conventions: Capital letters are not allowed", null, INVALID_NAME);
49+
}
50+
}
5051
}
5152
@Check
5253
def void checkNameConventionsParameters (Parameter parameter) {
53-
for (i : 0 ..< parameter.name.length) {
54-
val c = parameter.name.charAt(i)
55-
if (Character.isUpperCase(c)) {
56-
val remaining = parameter.name.substring(i)
57-
if (!remaining.contains(".")) {
58-
warning("The name of a parameter has to follow the ROS naming conventions: Capital letters are not recommended", null, INVALID_NAME);
59-
}
60-
}
61-
}
54+
for (i : 0 ..< parameter.name.length) {
55+
val c = parameter.name.charAt(i)
56+
if (Character.isUpperCase(c)) {
57+
val remaining = parameter.name.substring(i)
58+
if (!remaining.contains(".")) {
59+
warning("The name of a parameter has to follow the ROS naming conventions: Capital letters are not recommended", null, INVALID_NAME);
60+
}
61+
}
62+
}
6263
}
6364

6465
/* Customize Syntax Error Messages */
@@ -142,4 +143,24 @@ class RosValidator extends AbstractRosValidator {
142143
// // allow the use of numbers
143144
//
144145

146+
public static val INVALID_VALUE = 'invalidValue'
147+
@Check
148+
def void CheckQoS (QualityOfService qos){
149+
CheckDuration(qos.leaseDuration)
150+
CheckDuration(qos.lifespan)
151+
CheckDuration(qos.deadline)
152+
}
153+
154+
def void CheckDuration(String duration)
155+
{
156+
if(duration != 'infinite' && duration !== null){
157+
try{
158+
Integer.parseInt(duration)
159+
}
160+
catch (NumberFormatException e){
161+
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)
162+
}
163+
}
164+
}
165+
145166
}

plugins/de.fraunhofer.ipa.ros/model/ros.ecore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@
221221
defaultValueLiteral="reliable"/>
222222
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Durability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
223223
defaultValueLiteral="transient_local"/>
224+
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Liveliness" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
225+
<eStructuralFeatures xsi:type="ecore:EAttribute" name="LeaseDuration" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
226+
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Lifespan" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
227+
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Deadline" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
224228
</eClassifiers>
225229
<eClassifiers xsi:type="ecore:EClass" name="TopicSpecMsgRef" eSuperTypes="PrimitivesTypes.ecore#//AbstractType">
226230
<eStructuralFeatures xsi:type="ecore:EReference" name="Reference" lowerBound="1"

plugins/de.fraunhofer.ipa.ros/model/ros.genmodel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@
169169
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Depth"/>
170170
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Reliability"/>
171171
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Durability"/>
172+
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Liveliness"/>
173+
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/LeaseDuration"/>
174+
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Lifespan"/>
175+
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute ros.ecore#//QualityOfService/Deadline"/>
172176
</genClasses>
173177
<genClasses ecoreClass="ros.ecore#//TopicSpecMsgRef">
174178
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference ros.ecore#//TopicSpecMsgRef/Reference"/>

0 commit comments

Comments
 (0)