Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Semesterprojekt Modulbasiertes Testen
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Trappe
Semesterprojekt Modulbasiertes Testen
Commits
38b3bea2
Commit
38b3bea2
authored
5 years ago
by
marvin
Browse files
Options
Downloads
Patches
Plain Diff
Case-based input selection
parent
2105943c
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Varianten/AdapterFIDEROS/src/Adapter.java
+41
-11
41 additions, 11 deletions
Varianten/AdapterFIDEROS/src/Adapter.java
with
41 additions
and
11 deletions
Varianten/AdapterFIDEROS/src/Adapter.java
+
41
−
11
View file @
38b3bea2
...
...
@@ -94,20 +94,50 @@ public class Adapter {
*/
public
static
void
main
(
String
[]
args
)
{
try
{
Document
FeatureModel
=
readXml
(
"resources/input/featuremodel.xml"
);
Document
GazeboModel
=
readXml
(
"resources/input/turtlebot3-master/turtlebot3_description/urdf/turtlebot3_burger.gazebo.xacro"
);
Document
featureModel
=
readXml
(
"resources/input/featuremodel.xml"
);
Document
sensorConfig
=
readXml
(
"resources/input/sensorconfig.xml"
);
Document
gazeboModel
=
null
;
//TODO
//######### Operate on featuremodel.xml #########
Element
fmRoot
=
FeatureModel
.
getRootElement
();
List
<
Element
>
modules
=
fmRoot
.
getChildren
(
"module"
);
//CustomBot not supported for now
List
<
Attribute
>
botList
=
xQueryAttributes
(
featureModel
,
"//module[@types='TurtleBot']/@name"
);
String
botName
=
""
;
switch
(
botList
.
size
())
{
case
0
:
System
.
out
.
println
(
"Invalid input: No bot selected\n"
);
System
.
exit
(-
1
);
break
;
case
1
:
botName
=
botList
.
get
(
0
).
getValue
();
break
;
default
:
System
.
out
.
println
(
"Invalid input: multiple bots selected\n"
);
System
.
exit
(-
1
);
}
switch
(
botName
)
{
case
"Burger"
:
gazeboModel
=
readXml
(
"resources/input/turtlebot3-master/turtlebot3_description/urdf/turtlebot3_burger.gazebo.xacro"
);
break
;
case
"Waffle"
:
gazeboModel
=
readXml
(
"resources/input/turtlebot3-master/turtlebot3_description/urdf/turtlebot3_waffle.gazebo.xacro"
);
break
;
case
"WafflePi"
:
gazeboModel
=
readXml
(
"resources/input/turtlebot3-master/turtlebot3_description/urdf/turtlebot3_waffle_pi.gazebo.xacro"
);
break
;
default
:
System
.
out
.
println
(
"Cannot handle \'"
+
botName
+
"\': No input file known.\n"
);
System
.
exit
(-
1
);
}
//###############################################
//TODO
//######### Operate on .gazebo.xacro ############
Element
gmRoot
=
G
azeboModel
.
getRootElement
();
Element
gmRoot
=
g
azeboModel
.
getRootElement
();
//###############################################
...
...
@@ -117,7 +147,7 @@ public class Adapter {
//TODO
//######### Output result #######################
xmlOutput
.
output
(
G
azeboModel
,
dest
);
xmlOutput
.
output
(
g
azeboModel
,
dest
);
//###############################################
...
...
@@ -125,11 +155,11 @@ public class Adapter {
//XPathExamples
XPathFactory
xFactory
=
XPathFactory
.
instance
();
XPathExpression
<
Element
>
xExpr
=
xFactory
.
compile
(
"robot/gazebo/sensor/ray/range/min"
,
Filters
.
element
());
Element
test
=
xExpr
.
evaluateFirst
(
G
azeboModel
);
List
<
Element
>
test2
=
searchAllElements
(
G
azeboModel
,
"min"
);
List
<
Element
>
test3
=
searchAllElements
(
G
azeboModel
,
"max"
);
Element
test4
=
searchFirstElement
(
G
azeboModel
,
"plugin"
);
List
<
Attribute
>
test5
=
xQueryAttributes
(
G
azeboModel
,
"(//plugin)[1]/@*"
);
Element
test
=
xExpr
.
evaluateFirst
(
g
azeboModel
);
List
<
Element
>
test2
=
searchAllElements
(
g
azeboModel
,
"min"
);
List
<
Element
>
test3
=
searchAllElements
(
g
azeboModel
,
"max"
);
Element
test4
=
searchFirstElement
(
g
azeboModel
,
"plugin"
);
List
<
Attribute
>
test5
=
xQueryAttributes
(
g
azeboModel
,
"(//plugin)[1]/@*"
);
if
(
test
!=
null
)
xmlOutput
.
output
(
test
,
System
.
out
);
System
.
out
.
println
(
"\n"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment