-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement generator templates (Xtend) for RosSystem models to support
the new attribute ComponentStacks; the generation pipeline is consequently adapted
- Loading branch information
Showing
7 changed files
with
117 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/DockerComposeCompiler.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package de.fraunhofer.ipa.rossystem.generator | ||
|
||
import com.google.inject.Inject | ||
import rossystem.RosSystem | ||
import rossystem.ComponentStack | ||
|
||
class DockerComposeCompiler { | ||
|
||
@Inject extension GeneratorHelpers | ||
|
||
def compile_toDockerCompose(RosSystem system) '''«init_pkg()» | ||
version: "3.3" | ||
networks: | ||
ros: | ||
driver: bridge | ||
|
||
services: | ||
ros-master: | ||
image: ros:melodic-ros-core | ||
command: stdbuf -o L roscore | ||
networks: | ||
- ros | ||
|
||
«FOR stack:system.componentStack» | ||
«" "»«system.name.toLowerCase»_«stack.name.toLowerCase»: | ||
image: "«system.name.toLowerCase»_«stack.name.toLowerCase»:latest" | ||
depends_on: | ||
- ros-master | ||
environment: | ||
- "ROS_MASTER_URI=http://ros-master:11311" | ||
- "ROS_HOSTNAME=«stack.name.toLowerCase»" | ||
networks: | ||
- ros | ||
command: stdbuf -o L roslaunch «system.name.toLowerCase»_«stack.name.toLowerCase» «stack.name.toLowerCase».launch --wait | ||
|
||
«ENDFOR» | ||
|
||
''' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,21 @@ package de.fraunhofer.ipa.rossystem.generator | |
|
||
import rossystem.RosSystem | ||
import com.google.inject.Inject | ||
import rossystem.ComponentStack | ||
import java.util.List | ||
import java.util.ArrayList | ||
|
||
class PackageXmlCompiler{ | ||
|
||
@Inject extension GeneratorHelpers | ||
List<CharSequence> depends_list | ||
|
||
|
||
def compile_package_xml_format2(RosSystem system) '''«init_pkg()» | ||
def compile_package_xml_format2(RosSystem system,ComponentStack stack) '''«init_pkg()» | ||
<package format="2"> | ||
<name>«system.name.toLowerCase»</name> | ||
<name>«IF stack===null»«system.name.toLowerCase»«ELSE»«system.name.toLowerCase»_«stack.name.toLowerCase»«ENDIF»</name> | ||
<version>0.0.1</version> | ||
<description>This package provides launch file for operating «system.name»</description> | ||
<description>This package provides launch file for operating «IF stack===null»«system.name»«ELSE»«system.name.toLowerCase»_«stack.name»«ENDIF»</description> | ||
|
||
<license>Apache 2.0</license> | ||
|
||
|
@@ -22,15 +26,15 @@ class PackageXmlCompiler{ | |
<maintainer email="[email protected]">Jane Doe</maintainer> | ||
<author email="[email protected]">Jane Doe</author> | ||
|
||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
«FOR pkg:system.getPkgsDependencies» | ||
«FOR pkg:getPkgsDependencies(system, stack)» | ||
<exec_depend>«pkg»</exec_depend> | ||
«ENDFOR» | ||
<!--test_depend>roslaunch</test_depend--> | ||
|
||
</package>''' | ||
|
||
|
||
def compile_package_xml_format3(RosSystem system) '''«init_pkg()» | ||
<?xml version="1.0"?> | ||
<?xml-model | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters