11 .. module:: visibility 13 :synopsis: Converting back and forth the visibility level formats. 15 We have a python variable, a ros msg variable, and also the combobox variable! 24 import py_trees_msgs.msg
as py_trees_msgs
25 import uuid_msgs.msg
as uuid_msgs
32 combo_to_py_trees = collections.OrderedDict([
33 (
"All", py_trees.common.VisibilityLevel.ALL),
34 (
"Detail", py_trees.common.VisibilityLevel.DETAIL),
35 (
"Component", py_trees.common.VisibilityLevel.COMPONENT),
36 (
"Big Picture", py_trees.common.VisibilityLevel.BIG_PICTURE)]
39 saved_setting_to_combo_index = {
47 py_trees_msgs.Behaviour.BLACKBOX_LEVEL_DETAIL: py_trees.common.BlackBoxLevel.DETAIL,
48 py_trees_msgs.Behaviour.BLACKBOX_LEVEL_COMPONENT: py_trees.common.BlackBoxLevel.COMPONENT,
49 py_trees_msgs.Behaviour.BLACKBOX_LEVEL_BIG_PICTURE: py_trees.common.BlackBoxLevel.BIG_PICTURE,
50 py_trees_msgs.Behaviour.BLACKBOX_LEVEL_NOT_A_BLACKBOX: py_trees.common.BlackBoxLevel.NOT_A_BLACKBOX
56 Check the unique id to determine if it is the root (all zeros). 58 :param uuid.UUID behaviour_id: 65 Computes the critial (minimum) blackbox level present in the branch above 68 :param {id: py_trees_msgs.Behaviour} behaviours: (sub)tree of all behaviours, including this one 69 :param uuid.UUID behaviour_id: id of this behavour 70 :param py_trees.common.BlackBoxLevel current_level 75 new_level = min(behaviours[behaviour_id].blackbox_level, current_level)
79 def is_visible(behaviours, behaviour_id, visibility_level):
81 :param {id: py_trees_msgs.Behaviour} behaviours: 82 :param uuid.UUID behaviour_id: 83 :param py_trees.common.VisibilityLevel visibility_level 88 py_trees.common.BlackBoxLevel.NOT_A_BLACKBOX
91 return visibility_level < branch_blackbox_level
96 Drops any behaviours whose blackbox level does not match the required visibility 97 level. See the py_trees.common module for more information. 99 :param py_trees_msgs.msg.Behaviour[] behaviours 100 :returns: py_trees_msgs.msg.Behaviour[] 103 visible_behaviours = [b
for b
in behaviours
if is_visible(behaviours_by_id,
107 return visible_behaviours
static boost::uuids::uuid fromMsg(uuid_msgs::UniqueID const &msg)
def get_branch_blackbox_level(behaviours, behaviour_id, current_level)
def is_root(behaviour_id)
def filter_behaviours_by_visibility_level(behaviours, visibility_level)
def is_visible(behaviours, behaviour_id, visibility_level)