|
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> |
| 2 | +<root BTCPP_format="4" main_tree_to_execute="Vector and String Example"> |
| 3 | + <BehaviorTree |
| 4 | + ID="Vector and String Example" |
| 5 | + _description="Showcases creating, inserting, replacing, and removing strings from a vector, as well as reading strings from file and publishing them to ROS." |
| 6 | + _favorite="false" |
| 7 | + > |
| 8 | + <Control ID="Sequence" name="TopLevelSequence"> |
| 9 | + <Action ID="ResetVector" vector="{my_vector}" name="Create the Vector" /> |
| 10 | + <Control ID="Sequence" name="Test Some Vector Operations"> |
| 11 | + <Action |
| 12 | + ID="ReadTextFileAsString" |
| 13 | + string_file_contents="{string1}" |
| 14 | + text_filename="example_file.txt" |
| 15 | + /> |
| 16 | + <Action |
| 17 | + ID="PublishString" |
| 18 | + queue_size="1" |
| 19 | + use_best_effort="false" |
| 20 | + message="{string1}" |
| 21 | + topic="/ai_safety_announcement" |
| 22 | + /> |
| 23 | + <Action ID="LogMessage" message="{string1}" log_level="warn" /> |
| 24 | + <Action |
| 25 | + ID="InsertInVector" |
| 26 | + element="{json:{"__type":"string","value":"{string1}"}" |
| 27 | + index="0" |
| 28 | + input_vector="{my_vector}" |
| 29 | + output_vector="{my_vector}" |
| 30 | + /> |
| 31 | + <SubTree |
| 32 | + ID="ErrorCheckVectorSize" |
| 33 | + _collapsed="true" |
| 34 | + expected_vector_size="1" |
| 35 | + vector="{my_vector}" |
| 36 | + /> |
| 37 | + </Control> |
| 38 | + <Control ID="Sequence" name="Test Some Vector Operations"> |
| 39 | + <Action |
| 40 | + ID="RemoveFromVector" |
| 41 | + index="0" |
| 42 | + input_vector="{my_vector}" |
| 43 | + output_vector="{my_vector}" |
| 44 | + /> |
| 45 | + <SubTree |
| 46 | + ID="ErrorCheckVectorSize" |
| 47 | + _collapsed="true" |
| 48 | + expected_vector_size="0" |
| 49 | + vector="{my_vector}" |
| 50 | + /> |
| 51 | + </Control> |
| 52 | + <Control ID="Sequence" name="Test Some Vector Operations"> |
| 53 | + <Action ID="Script" code="string2 := 'Do not be evil'" /> |
| 54 | + <Action |
| 55 | + ID="InsertInVector" |
| 56 | + element="{json:{"__type":"string","value":"{string2}"}" |
| 57 | + index="0" |
| 58 | + input_vector="{my_vector}" |
| 59 | + output_vector="{my_vector}" |
| 60 | + /> |
| 61 | + <SubTree |
| 62 | + ID="ErrorCheckVectorSize" |
| 63 | + _collapsed="true" |
| 64 | + expected_vector_size="1" |
| 65 | + vector="{my_vector}" |
| 66 | + /> |
| 67 | + <Action ID="LogMessage" message="{string2}" log_level="warn" /> |
| 68 | + </Control> |
| 69 | + <Control ID="Sequence" name="Test Some Vector Operations"> |
| 70 | + <Action |
| 71 | + ID="Script" |
| 72 | + code="string3 := 'Comply with the laws of physics, unless you are in simulation.'" |
| 73 | + /> |
| 74 | + <Action |
| 75 | + ID="ReplaceInVector" |
| 76 | + element="{json:{"__type":"string","value":"{string3}"}" |
| 77 | + index="0" |
| 78 | + input_vector="{my_vector}" |
| 79 | + output_vector="{my_vector}" |
| 80 | + /> |
| 81 | + <SubTree |
| 82 | + ID="ErrorCheckVectorSize" |
| 83 | + _collapsed="true" |
| 84 | + expected_vector_size="1" |
| 85 | + vector="{my_vector}" |
| 86 | + /> |
| 87 | + <Action ID="LogMessage" message="{string3}" log_level="warn" /> |
| 88 | + </Control> |
| 89 | + </Control> |
| 90 | + </BehaviorTree> |
| 91 | + <TreeNodesModel> |
| 92 | + <SubTree ID="Vector and String Example"> |
| 93 | + <MetadataFields> |
| 94 | + <Metadata runnable="true" /> |
| 95 | + <Metadata subcategory="Vector Handling" /> |
| 96 | + </MetadataFields> |
| 97 | + </SubTree> |
| 98 | + </TreeNodesModel> |
| 99 | +</root> |
0 commit comments