Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
root.jsontreemy_new_bt_project{
"name":"goal_pid",
"type":"Multitasker",
"children":[
{
"name":"Calculate angular velocity necessary to face towards the position",
"type":"PathCorrection",
"correction_var_name":"angular_goal_pid",
"goal_value_var_name":"goal_rotation",
"current_value_var_name":"rotation",
"max_vel":1.5
},
{
"name":"Calculate linear velocity to get to position",
"type":"PathCorrection",
"correction_var_name":"linear_goal_pid",
"goal_value_var_name":"dist",
"current_value_var_name":"dummy_current_value",
"max_vel":0.1,
"offset":0
}
],
"blackboard":{
"angular_goal_pid":null,
"linear_goal_pid":null,
"dummy_current_value":0,
"dist":null
},
"blackbox":true
}mr_bt/src/tree_jsons/
my_new_bt_project/
root.json
action1.json
action2.jsonmax_speedgoal_positionroot.json{
"name":"move_to_position",
"type":"Selector",
"children":[
...
],
"blackboard":{
"max_speed":0.5,
"goal_position":[1, 1]
}
}{
...
"blackboard":{
"current_position":null,
"reached_position":null
}
}{
"name":"Get my robot's position",
"type":"GetPosition",
"position_var_name":"current_position",
"blackboard":{
"current_position":null,
"/odom":"Odometry"
}
}{
...
"blackboard":{
"current_position":null,
"/odom":"Odometry"
}
}
{
...
"blackboard":{
"max_speed":0.5,
"goal_position":[1, 1]
}
}"blackboard":{
"current_position":null,
"/odom":"Odometry",
"max_speed":0.5,
"goal_position":[1, 1]
}from ...nodes.update import Update
class MyUpdateNode(Update):
def __init__(self):
super().__init__()
def update_blackboard(self, blackboard: dict) -> str:
...from ...nodes.action import Action
class MyActionNode(Action):
def __init__(self):
super().__init__()
def execute(self, blackboard: dict) -> str:
.../mr_bt/src/tree_jsons/my_new_tree/
root.json
move.json
calculate_dist.json{
"name":"my_node",
"type":"Stop"
}Returns "failure" if boolean variable in blackboard is true, otherwise returns "success".
Params:
var_name (string): name of boolean variable in blackboard{
"name":"my_new_tree_root",
"type":"Sequencer",
"children":[
{
"ref":"my_new_tree/calculate_dist.json"
},
{
"ref":"my_new_tree/move.json"
}
]
}{
"name":"my_node",
"type":"LinearAngularDynamic",
"linear_var_name":"my_linear_vel",
"angular_var_name":"my_angular_vel",
"blackboard":{
"my_angular_vel":null,
"my_linear_vel":null
}
}Returns "success" if the position of the robot given by the /odom topic is close within error to the provided goal position variable
Params:
goal_pos_var_name (string): Name of the blackboard variable holding an array of the x,y goal coordinates.
error (float): Tolerated error for reaching the goal position
Publishes a twist message on the topic /cmd_vel with a linear and angular velocity provided by variables in the blackboard
Params:
linear_var_name (string): Name of the blackboard variable holding the linear x velocity to add to Twist msg
angular_var_name (string): Name of the blackboard variable holding the angular z velocity to add to Twist msgPublishes a Twist msg on /cmd_vel with all velocity values set to 0from ...nodes.conditional import Conditional
class MyConditionalNode(Conditional):
def __init__(self):
super().__init__()
def condition(self, blackboard: dict) -> bool:
...{
"name":"node name",
"type": "MyBtNode",
...
}class MyBtNode:
def __init__(self, arg1: str, arg2: int, arg3: float):
...{
"name":"node name",
"type": "MyBtNode",
"arg1": "hello world",
"arg2": 4,
"arg3": 10.8
}{
"name":"reached_goal",
"type":"Sequencer",
"children":[
{
"name":"reached_position",
"type":"ReachedPosition",
"goal_pos_var_name":"goal_pos",
"error":0.05
},
{
"name":"stop",
"type":"Stop"
}
]
}