Skip to content

Commit 8e317ae

Browse files
committed
add ros2 invert topic binding option
1 parent d3ae23a commit 8e317ae

4 files changed

Lines changed: 57 additions & 28 deletions

File tree

app/jvm/src/main/scala/org/sireum/forms/HAMRUtil.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.sireum.Cli
44
import org.sireum._
55

66
object HAMRUtil {
7-
7+
88

99
// BEGIN build option store
1010
def decasePlatform(e: Cli.SireumHamrSysmlCodegenHamrPlatform.Type): Predef.String = {
@@ -52,6 +52,7 @@ object HAMRUtil {
5252
store.ros2Dir = if (o.ros2Dir.nonEmpty) o.ros2Dir.get.native else ""
5353
store.ros2NodesLanguage = decaseRos2NodesLanguage(o.ros2NodesLanguage)
5454
store.ros2LaunchLanguage = decaseRos2LaunchLanguage(o.ros2LaunchLanguage)
55+
store.invertTopicBinding = o.invertTopicBinding
5556
return store
5657
}
5758
// END build option store

jvm/src/main/java/org/sireum/forms/HAMRCodeGenForm.form

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<grid id="27dc6" binding="codegenPanel" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
6-
<xy x="20" y="20" width="500" height="881"/>
6+
<xy x="20" y="20" width="500" height="911"/>
77
</constraints>
88
<properties/>
99
<border type="none"/>
@@ -319,7 +319,7 @@
319319
</component>
320320
</children>
321321
</grid>
322-
<grid id="ae144" binding="ros2OptionsPanel" layout-manager="GridLayoutManager" row-count="5" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
322+
<grid id="ae144" binding="ros2OptionsPanel" layout-manager="GridLayoutManager" row-count="6" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
323323
<margin top="0" left="0" bottom="0" right="0"/>
324324
<constraints>
325325
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -329,47 +329,47 @@
329329
<children>
330330
<component id="3892f" class="javax.swing.JLabel" binding="ros2WorkspaceDirectoryLabel">
331331
<constraints>
332-
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
332+
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
333333
</constraints>
334334
<properties>
335335
<text value="Workspace Directory"/>
336336
</properties>
337337
</component>
338338
<component id="c658e" class="javax.swing.JTextField" binding="ros2OutputWorkspaceDir">
339339
<constraints>
340-
<grid row="3" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
340+
<grid row="4" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
341341
<preferred-size width="150" height="-1"/>
342342
</grid>
343343
</constraints>
344344
<properties/>
345345
</component>
346346
<component id="6582c" class="javax.swing.JButton" binding="ros2WorkspaceDirectoryButton">
347347
<constraints>
348-
<grid row="3" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
348+
<grid row="4" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
349349
</constraints>
350350
<properties>
351351
<text value="..."/>
352352
</properties>
353353
</component>
354354
<component id="c8961" class="javax.swing.JLabel" binding="ros2Ros2DirectoryLabel">
355355
<constraints>
356-
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
356+
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
357357
</constraints>
358358
<properties>
359359
<text value="ROS2 Directory"/>
360360
</properties>
361361
</component>
362362
<component id="1bb68" class="javax.swing.JTextField" binding="ros2Dir">
363363
<constraints>
364-
<grid row="4" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
364+
<grid row="5" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
365365
<preferred-size width="150" height="-1"/>
366366
</grid>
367367
</constraints>
368368
<properties/>
369369
</component>
370370
<component id="98e87" class="javax.swing.JButton" binding="ros2Ros2DirectoryButton">
371371
<constraints>
372-
<grid row="4" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
372+
<grid row="5" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
373373
</constraints>
374374
<properties>
375375
<text value="..."/>
@@ -385,23 +385,23 @@
385385
</component>
386386
<component id="e75ee" class="javax.swing.JLabel" binding="ros2NodesLanguageLabel">
387387
<constraints>
388-
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
388+
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
389389
</constraints>
390390
<properties>
391391
<text value="Nodes Language"/>
392392
</properties>
393393
</component>
394394
<component id="f5c9" class="javax.swing.JLabel" binding="ros2LaunchLanguageLabel">
395395
<constraints>
396-
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
396+
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
397397
</constraints>
398398
<properties>
399399
<text value="Launch Language"/>
400400
</properties>
401401
</component>
402402
<component id="f3417" class="javax.swing.JComboBox" binding="ros2LaunchLanguage">
403403
<constraints>
404-
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
404+
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
405405
</constraints>
406406
<properties>
407407
<model>
@@ -412,12 +412,12 @@
412412
</component>
413413
<hspacer id="cfc14">
414414
<constraints>
415-
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
415+
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
416416
</constraints>
417417
</hspacer>
418418
<component id="6bdaa" class="javax.swing.JComboBox" binding="ros2NodesLanguage">
419419
<constraints>
420-
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
420+
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
421421
</constraints>
422422
<properties>
423423
<model>
@@ -426,6 +426,14 @@
426426
</model>
427427
</properties>
428428
</component>
429+
<component id="ca93f" class="javax.swing.JCheckBox" binding="invertTopicBinding">
430+
<constraints>
431+
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
432+
</constraints>
433+
<properties>
434+
<text value="Invert Topic Binding"/>
435+
</properties>
436+
</component>
429437
</children>
430438
</grid>
431439
<grid id="c82bc" binding="slangOptionsPanel" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">

jvm/src/main/java/org/sireum/forms/HAMRCodeGenForm.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class HAMRCodeGenForm {
6262
public JPanel ros2OptionsPanel;
6363
public JPanel slangOptionsPanel;
6464
public JButton themeButton;
65+
public JCheckBox invertTopicBinding;
6566

6667
{
6768
// GUI initializer generated by IntelliJ IDEA GUI Designer
@@ -200,48 +201,51 @@ public class HAMRCodeGenForm {
200201
themeButton.setText("");
201202
bottomPanel.add(themeButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
202203
ros2OptionsPanel = new JPanel();
203-
ros2OptionsPanel.setLayout(new GridLayoutManager(5, 4, new Insets(0, 0, 0, 0), -1, -1));
204+
ros2OptionsPanel.setLayout(new GridLayoutManager(6, 4, new Insets(0, 0, 0, 0), -1, -1));
204205
codegenPanel.add(ros2OptionsPanel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
205206
ros2OptionsPanel.setBorder(BorderFactory.createTitledBorder(null, "ROS2 Options", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
206207
ros2WorkspaceDirectoryLabel = new JLabel();
207208
ros2WorkspaceDirectoryLabel.setText("Workspace Directory");
208-
ros2OptionsPanel.add(ros2WorkspaceDirectoryLabel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
209+
ros2OptionsPanel.add(ros2WorkspaceDirectoryLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
209210
ros2OutputWorkspaceDir = new JTextField();
210-
ros2OptionsPanel.add(ros2OutputWorkspaceDir, new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
211+
ros2OptionsPanel.add(ros2OutputWorkspaceDir, new GridConstraints(4, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
211212
ros2WorkspaceDirectoryButton = new JButton();
212213
ros2WorkspaceDirectoryButton.setText("...");
213-
ros2OptionsPanel.add(ros2WorkspaceDirectoryButton, new GridConstraints(3, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
214+
ros2OptionsPanel.add(ros2WorkspaceDirectoryButton, new GridConstraints(4, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
214215
ros2Ros2DirectoryLabel = new JLabel();
215216
ros2Ros2DirectoryLabel.setText("ROS2 Directory");
216-
ros2OptionsPanel.add(ros2Ros2DirectoryLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
217+
ros2OptionsPanel.add(ros2Ros2DirectoryLabel, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
217218
ros2Dir = new JTextField();
218-
ros2OptionsPanel.add(ros2Dir, new GridConstraints(4, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
219+
ros2OptionsPanel.add(ros2Dir, new GridConstraints(5, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
219220
ros2Ros2DirectoryButton = new JButton();
220221
ros2Ros2DirectoryButton.setText("...");
221-
ros2OptionsPanel.add(ros2Ros2DirectoryButton, new GridConstraints(4, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
222+
ros2OptionsPanel.add(ros2Ros2DirectoryButton, new GridConstraints(5, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
222223
strictAadlMode = new JCheckBox();
223224
strictAadlMode.setText("Strict AADL Mode");
224225
ros2OptionsPanel.add(strictAadlMode, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
225226
ros2NodesLanguageLabel = new JLabel();
226227
ros2NodesLanguageLabel.setText("Nodes Language");
227-
ros2OptionsPanel.add(ros2NodesLanguageLabel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
228+
ros2OptionsPanel.add(ros2NodesLanguageLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
228229
ros2LaunchLanguageLabel = new JLabel();
229230
ros2LaunchLanguageLabel.setText("Launch Language");
230-
ros2OptionsPanel.add(ros2LaunchLanguageLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
231+
ros2OptionsPanel.add(ros2LaunchLanguageLabel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
231232
ros2LaunchLanguage = new JComboBox();
232233
final DefaultComboBoxModel defaultComboBoxModel3 = new DefaultComboBoxModel();
233234
defaultComboBoxModel3.addElement("Python");
234235
defaultComboBoxModel3.addElement("Xml");
235236
ros2LaunchLanguage.setModel(defaultComboBoxModel3);
236-
ros2OptionsPanel.add(ros2LaunchLanguage, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
237+
ros2OptionsPanel.add(ros2LaunchLanguage, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
237238
final Spacer spacer6 = new Spacer();
238-
ros2OptionsPanel.add(spacer6, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
239+
ros2OptionsPanel.add(spacer6, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
239240
ros2NodesLanguage = new JComboBox();
240241
final DefaultComboBoxModel defaultComboBoxModel4 = new DefaultComboBoxModel();
241242
defaultComboBoxModel4.addElement("Cpp");
242243
defaultComboBoxModel4.addElement("Python");
243244
ros2NodesLanguage.setModel(defaultComboBoxModel4);
244-
ros2OptionsPanel.add(ros2NodesLanguage, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
245+
ros2OptionsPanel.add(ros2NodesLanguage, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
246+
invertTopicBinding = new JCheckBox();
247+
invertTopicBinding.setText("Invert Topic Binding");
248+
ros2OptionsPanel.add(invertTopicBinding, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
245249
slangOptionsPanel = new JPanel();
246250
slangOptionsPanel.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), -1, -1));
247251
codegenPanel.add(slangOptionsPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));

0 commit comments

Comments
 (0)