BT interface node works with web-service
This commit is contained in:
parent
47c5e89913
commit
49e036af5e
15 changed files with 536 additions and 124 deletions
59
rbs_bt_executor/launch/rbs_bt_web.launch.py
Normal file
59
rbs_bt_executor/launch/rbs_bt_web.launch.py
Normal file
|
@ -0,0 +1,59 @@
|
|||
"""
|
||||
rbs_bt_web
|
||||
ROS 2 launch program for Robossembler
|
||||
|
||||
@shalenikol release 0.1
|
||||
"""
|
||||
import os
|
||||
# import json
|
||||
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from launch.actions import DeclareLaunchArgument, OpaqueFunction, RegisterEventHandler
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch.event_handlers import OnExecutionComplete
|
||||
|
||||
FILE_BT = "bt.xml"
|
||||
|
||||
def launch_setup(context, *args, **kwargs):
|
||||
# Initialize Arguments
|
||||
bt_path = LaunchConfiguration("bt_path")
|
||||
bt_path = bt_path.perform(context)
|
||||
|
||||
rbs_bt = Node(
|
||||
package = "behavior_tree",
|
||||
executable = "bt_engine",
|
||||
parameters = [
|
||||
{"bt_file_path": os.path.join(bt_path, FILE_BT)},
|
||||
{"plugins": ["rbs_interface"]}
|
||||
]
|
||||
)
|
||||
|
||||
bt_param = Node(
|
||||
package="rbs_interface",
|
||||
executable="bt_param.py",
|
||||
parameters = [{"bt_path": bt_path}]
|
||||
)
|
||||
# nodes_to_start = [rbs_bt]
|
||||
# return nodes_to_start
|
||||
# return [bt_param]
|
||||
return [
|
||||
RegisterEventHandler(
|
||||
event_handler=OnExecutionComplete(
|
||||
target_action=bt_param,
|
||||
on_completion=[rbs_bt],
|
||||
)
|
||||
),
|
||||
bt_param
|
||||
] # the order of elements is strictly required
|
||||
|
||||
def generate_launch_description():
|
||||
declared_arguments = []
|
||||
declared_arguments.append(
|
||||
DeclareLaunchArgument(
|
||||
"bt_path",
|
||||
default_value="''",
|
||||
description="path to Behavior tree instance"
|
||||
)
|
||||
)
|
||||
return LaunchDescription(declared_arguments + [OpaqueFunction(function=launch_setup)])
|
Loading…
Add table
Add a link
Reference in a new issue