update interface node: to start BT with rbss-nodes

This commit is contained in:
shalenikol 2025-04-11 19:41:08 +03:00
parent 698f8734ac
commit 9d0098a115
2 changed files with 5 additions and 2 deletions

View file

@ -4,6 +4,7 @@
@shalenikol release 0.1
@shalenikol release 0.2 mode
@shalenikol release 0.3 {"bt_path": bt_path} # included as default path
"""
import os
import json
@ -56,7 +57,7 @@ def launch_setup(context, *args, **kwargs):
rbs_interface = Node(
package="rbs_bt_executor",
executable="rbs_interface.py",
parameters = [{"mode": mode},{"use_sim_time": True}]
parameters = [{"bt_path": bt_path},{"mode": mode},{"use_sim_time": True}]
# parameters = [{"bt_path": bt_path}] # can be included as default path
)
nodes_to_start = [rbs_interface]

View file

@ -7,6 +7,7 @@
@shalenikol release 0.2 BT v.4
@shalenikol release 0.3 synchronize
@shalenikol release 0.4 mode:="benchmark"
@shalenikol release 0.5 bt_path # included as default path (in __init__)
"""
import os
import json
@ -43,13 +44,14 @@ KEY_BTPARAM = "BTAction"
class rbsInterface(Node):
def __init__(self, node_name):
"""Construct the node."""
self.bt_path = "" # path to the current BehaviorTree
# self.bt_path = "" # path to the current BehaviorTree
# self._mode = "" # run mode of the interface node
self.cfg_data = None # config for current action
super().__init__(node_name)
self.declare_parameter(BT_PARAM, rclpy.Parameter.Type.STRING)
self.declare_parameter(MODE_PARAM, rclpy.Parameter.Type.STRING)
self._mode = self.get_parameter(MODE_PARAM).get_parameter_value().string_value
self.bt_path = self.get_parameter(BT_PARAM).get_parameter_value().string_value
self.cb_group = ReentrantCallbackGroup()
# for Condition