|
9 | 9 | <Action ID="ResetVector" vector="{my_vector}" name="Create the Vector" /> |
10 | 10 | <Control ID="Sequence" name="Test Some Vector Operations"> |
11 | 11 | <Action |
12 | | - ID="ReadTextFileAsString" |
13 | | - string_file_contents="{string1}" |
14 | | - text_filename="example_file.txt" |
| 12 | + ID="Script" |
| 13 | + code="string1 := 'Run: "ros2 topic echo /secret_msg std_msgs/msg/String --qos-profile system_default" in the terminal, then press Resume.'" |
15 | 14 | /> |
16 | 15 | <Action |
17 | | - ID="PublishString" |
18 | | - queue_size="1" |
19 | | - use_best_effort="false" |
20 | | - message="{string1}" |
21 | | - topic="/ai_safety_announcement" |
| 16 | + ID="CreateStringMessage" |
| 17 | + data="{string1}" |
| 18 | + string="{string_msg_in}" |
22 | 19 | /> |
23 | | - <Action ID="LogMessage" message="{string1}" log_level="warn" /> |
24 | 20 | <Action |
25 | 21 | ID="InsertInVector" |
26 | | - element="{json:{"__type":"string","value":"{string1}"}" |
| 22 | + element="{string_msg_in}" |
27 | 23 | index="0" |
28 | 24 | input_vector="{my_vector}" |
29 | 25 | output_vector="{my_vector}" |
|
34 | 30 | expected_vector_size="1" |
35 | 31 | vector="{my_vector}" |
36 | 32 | /> |
| 33 | + <Action |
| 34 | + ID="GetElementOfVector" |
| 35 | + element="{string_msg_out}" |
| 36 | + index="0" |
| 37 | + vector_in="{my_vector}" |
| 38 | + /> |
| 39 | + <Action |
| 40 | + ID="UnpackStringMessage" |
| 41 | + data="{string}" |
| 42 | + string="{string_msg_out}" |
| 43 | + /> |
| 44 | + <Action ID="LogMessage" message="{string}" log_level="warn" /> |
37 | 45 | </Control> |
38 | 46 | <Control ID="Sequence" name="Test Some Vector Operations"> |
39 | 47 | <Action |
|
49 | 57 | vector="{my_vector}" |
50 | 58 | /> |
51 | 59 | </Control> |
| 60 | + <Control ID="IfThenElse"> |
| 61 | + <Action ID="IsUserAvailable" /> |
| 62 | + <Action |
| 63 | + ID="BreakpointSubscriber" |
| 64 | + breakpoint_topic="/moveit_pro_breakpoint" |
| 65 | + /> |
| 66 | + <Action ID="AlwaysSuccess" /> |
| 67 | + </Control> |
52 | 68 | <Control ID="Sequence" name="Test Some Vector Operations"> |
53 | | - <Action ID="Script" code="string2 := 'Do not be evil'" /> |
| 69 | + <Action |
| 70 | + ID="ReadTextFileAsString" |
| 71 | + string_file_contents="{string2}" |
| 72 | + text_filename="example_file.txt" |
| 73 | + /> |
| 74 | + <Action |
| 75 | + ID="CreateStringMessage" |
| 76 | + data="{string2}" |
| 77 | + string="{string_msg_in}" |
| 78 | + /> |
54 | 79 | <Action |
55 | 80 | ID="InsertInVector" |
56 | | - element="{json:{"__type":"string","value":"{string2}"}" |
| 81 | + element="{string_msg_in}" |
57 | 82 | index="0" |
58 | 83 | input_vector="{my_vector}" |
59 | 84 | output_vector="{my_vector}" |
60 | 85 | /> |
| 86 | + <Action |
| 87 | + ID="GetElementOfVector" |
| 88 | + element="{string_msg_out}" |
| 89 | + index="0" |
| 90 | + vector_in="{my_vector}" |
| 91 | + /> |
| 92 | + <Action ID="WaitForDuration" delay_duration="1.0" /> |
| 93 | + <Action |
| 94 | + ID="PublishString" |
| 95 | + queue_size="10" |
| 96 | + use_best_effort="false" |
| 97 | + message="{string_msg_out}" |
| 98 | + topic="/secret_msg" |
| 99 | + /> |
| 100 | + <Action ID="WaitForDuration" delay_duration="1.0" /> |
61 | 101 | <SubTree |
62 | 102 | ID="ErrorCheckVectorSize" |
63 | 103 | _collapsed="true" |
64 | 104 | expected_vector_size="1" |
65 | 105 | vector="{my_vector}" |
66 | 106 | /> |
67 | | - <Action ID="LogMessage" message="{string2}" log_level="warn" /> |
68 | 107 | </Control> |
69 | 108 | <Control ID="Sequence" name="Test Some Vector Operations"> |
70 | 109 | <Action |
71 | 110 | ID="Script" |
72 | | - code="string3 := 'Comply with the laws of physics, unless you are in simulation.'" |
| 111 | + code="string3 := 'Did you get the secret message?'" |
| 112 | + /> |
| 113 | + <Action |
| 114 | + ID="CreateStringMessage" |
| 115 | + data="{string3}" |
| 116 | + string="{string_msg_in}" |
73 | 117 | /> |
74 | 118 | <Action |
75 | 119 | ID="ReplaceInVector" |
76 | | - element="{json:{"__type":"string","value":"{string3}"}" |
| 120 | + element="{string_msg_in}" |
77 | 121 | index="0" |
78 | 122 | input_vector="{my_vector}" |
79 | 123 | output_vector="{my_vector}" |
80 | 124 | /> |
| 125 | + <Action |
| 126 | + ID="GetElementOfVector" |
| 127 | + element="{string_msg_out}" |
| 128 | + index="0" |
| 129 | + vector_in="{my_vector}" |
| 130 | + /> |
| 131 | + <Action |
| 132 | + ID="UnpackStringMessage" |
| 133 | + data="{string}" |
| 134 | + string="{string_msg_out}" |
| 135 | + /> |
81 | 136 | <SubTree |
82 | 137 | ID="ErrorCheckVectorSize" |
83 | 138 | _collapsed="true" |
84 | 139 | expected_vector_size="1" |
85 | 140 | vector="{my_vector}" |
86 | 141 | /> |
87 | | - <Action ID="LogMessage" message="{string3}" log_level="warn" /> |
| 142 | + <Action ID="LogMessage" message="{string}" log_level="warn" /> |
88 | 143 | </Control> |
89 | 144 | </Control> |
90 | 145 | </BehaviorTree> |
91 | 146 | <TreeNodesModel> |
92 | | - <SubTree ID="Vector and String Example"> |
93 | | - <MetadataFields> |
94 | | - <Metadata runnable="true" /> |
95 | | - <Metadata subcategory="Vector Handling" /> |
96 | | - </MetadataFields> |
97 | | - </SubTree> |
| 147 | + <SubTree ID="Vector and String Example" /> |
98 | 148 | </TreeNodesModel> |
99 | 149 | </root> |
0 commit comments