Description
I'm pretty sure there are some functionality errors in the code, particularly the sequence node. For example the tree example will never get past a starting action 1. The output from one run commented below explains what happens. Note the tree example runs as expected if you replace all sequence nodes with sequence with memory nodes.
// Start the example
rosrun behavior_tree_core tree
// Everything initializes
Action 1 WAIT FOR TICK
Action 2 WAIT FOR TICK
Action 3 WAIT FOR TICK
Start Drawing!
[ INFO] [1516430124.415782852]: Visualization: Start publishing the tree in topic: /bt_dotcode with rate: 50 Hz.
// Start ticking
Ticking the root node !
Action 2 is setting its status to 3
seq1NEEDS TO TICK Action 2
Action 2 is setting its status to 3
// Ticked action 2
Action 2 TICK RECEIVED
Action 2 is setting its status to 0
Action Action 2running! Thread id:139852564367104
Action 2 is setting its status to 0
// It is in state running so sequence nodes halts all nodes to the right
seq1 is HALTING children from 1
seq1 is HALTING children from 1
Action 1 is setting its status to 3
Action 1 is setting its status to 3
NO NEED TO HALT Action 1STATUS3
seq1 is setting its status to 3
seq1 is setting its status to 3
NO NEED TO HALT seq1STATUS3
seq1 is setting its status to 0
Action 2 is setting its status to 0
Action Action 2running! Thread id:139852564367104
// Second tick
Ticking the root node !
Action 2 is setting its status to 0
// Action 2 is still running so halt all future nodes
seq1 is HALTING children from 1
seq1 is HALTING children from 1
Action 1 is setting its status to 3
Action 1 is setting its status to 3
NO NEED TO HALT Action 1STATUS3
seq1 is setting its status to 3
seq1 is setting its status to 3
NO NEED TO HALT seq1STATUS3
seq1 is setting its status to 0
Action 2 is setting its status to 0
Action Action 2running! Thread id:139852564367104
// Tick 3
Ticking the root node !
Action 2 is setting its status to 0
// Still running halt others
seq1 is HALTING children from 1
seq1 is HALTING children from 1
Action 1 is setting its status to 3
Action 1 is setting its status to 3
NO NEED TO HALT Action 1STATUS3
seq1 is setting its status to 3
seq1 is setting its status to 3
NO NEED TO HALT seq1STATUS3
seq1 is setting its status to 0
Action 2 is setting its status to 0
Action 2 is setting its status to 0
// Action 2 returns success!
Action Action 2 Done!
// Action 2 is ready for more
Action 2 WAIT FOR TICK
// Tick 4
Ticking the root node !
// Action 2 is success set to idle and move on
Action 2 is setting its status to 1
// Tick condition 2 and wait
Condition 2 is setting its status to 3
Condition 2 returning Success1!
// Tick condition 1 and wait
Condition 1 is setting its status to 3
Condition 1 returning Success1!
// Tick Action 1
Action 1 is setting its status to 3
seq1NEEDS TO TICK Action 1
Action 1 is setting its status to 3
// Action 1 is now running
Action 1 TICK RECEIVED
Action 1 is setting its status to 0
Action Action 1running! Thread id:139852572759808
Action 1 is setting its status to 0
// Action 1 is running so halt future nodes
seq1 is HALTING children from 3
seq1 is setting its status to 3
seq1 is setting its status to 3
NO NEED TO HALT seq1STATUS3
seq1 is setting its status to 0
Action 1 is setting its status to 0
Action Action 1running! Thread id:139852572759808
// Tick 5 (This is where it breaks)
Ticking the root node !
// Action 2 is idle so we must tick it!!!!!
Action 2 is setting its status to 3
seq1NEEDS TO TICK Action 2
Action 2 is setting its status to 3
// Tick received by action 2
Action 2 TICK RECEIVED
Action 2 is setting its status to 0
Action Action 2running! Thread id:139852564367104
Action 2 is setting its status to 0
// Action 2 is running so halt all future nodes
seq1 is HALTING children from 1
seq1 is HALTING children from 1
Action 1 is setting its status to 0
// Action one is still running so we must halt it!!!!!!!!!!!!!!!!!!!!!!
// Action 1 will never complete it will always be halted
SENDING HALT TO CHILD Action 1
HALTED state set!
seq1 is setting its status to 3
seq1 is setting its status to 3
NO NEED TO HALT seq1STATUS3
seq1 is setting its status to 0
// Action one halted so it restarts
Action 1 is setting its status to 4
Action 1 is setting its status to 4
Action 1 WAIT FOR TICK
Action 2 is setting its status to 0
Action Action 2running! Thread id:139852564367104
// Tick 6 We now start the whole process over again
Ticking the root node !
Action 2 is setting its status to 0
seq1 is HALTING children from 1
seq1 is HALTING children from 1
Action 1 is setting its status to 4
Action 1 is setting its status to 4
NO NEED TO HALT Action 1STATUS4
seq1 is setting its status to 3
seq1 is setting its status to 3
NO NEED TO HALT seq1STATUS3
seq1 is setting its status to 0
Action 2 is setting its status to 0
Action Action 2running! Thread id:139852564367104
Ticking the root node !
Action 2 is setting its status to 0
seq1 is HALTING children from 1
seq1 is HALTING children from 1
Action 1 is setting its status to 4
Action 1 is setting its status to 4
NO NEED TO HALT Action 1STATUS4
seq1 is setting its status to 3
seq1 is setting its status to 3
NO NEED TO HALT seq1STATUS3
seq1 is setting its status to 0`