<ActionID="ClearCostmapExceptRegion"> <input_portname="service_name">Service name</input_port> <input_portname="server_timeout">Server timeout</input_port> <input_portname="reset_distance">Distance from the robot above which obstacles are cleared</input_port> </Action>
<ActionID="ClearCostmapAroundRobot"> <input_portname="service_name">Service name</input_port> <input_portname="server_timeout">Server timeout</input_port> <input_portname="reset_distance">Distance from the robot under which obstacles are cleared</input_port> </Action>
编译nav2_costmap_2d后,直接运行ros2 run nav2_costmap_2d nav2_costmap,结果报错
1
[pluginlib.ClassLoader]: Skipped loading plugin with error: XML Document '/home/user/project/install/nav2_costmap_2d/share/nav2_costmap_2d/costmap_plugins.xml' has no Root Element. This likely means the XML is malformed or missing..
[ERROR] [1754535646.216247848] [nav2_node]: "global_costmap/clear_entirely_global_costmap" service server not available after waiting for1.00s [nav2_node-1] terminate called after throwing an instance of 'std::length_error' [nav2_node-1] what(): basic_string::_M_create
可以把 BtServiceNode构造函数的throw一行删掉,这样即使没有服务端,也不会报错
Action和service_name不符合,加载行为树会报错
1
what(): could not create client: create_client() called for existing request topic name rq/global_costmap/clear_entirely_global_costmapRequest with incompatible type navit_msgs::srv::dds_::ClearEntireCostmap_Request_, at ./src/rmw_client.cpp:165, at ./src/rcl/client.c:146
ros2 param describe /turtlesim background_r Parameter name: background_r Type: integer Description: Red channel of the background color Constraints: Min value: 0 Max value: 255 Step: 1
ros2 param get node_name parameter_name
1 2
ros2 param get /turtlesim background_r Integer value is: 69
nvidia@ubuntu:~$ ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: 1.57}" Waiting for an action server to become available... Sending goal: theta: 1.57 Goal accepted with ID: 5cd8eb561348477abbb532fc816ce792
ControlNodes and Decorators 必须支持新的节点状态 NodeStatus:SKIPPED
The purpose of this new status is to be returned when a PreCondition is not met. When a Node returns SKIPPED, it is notifying to its parent (ControlNode or Decorator) that it hasn’t been executed.
This particular implementation of sleepcan be interrupted if any node in the tree invokes the method TreeNode::emitWakeUpSignal. This allows the loop to re-tick the tree immediately.
Tree::tickRoot() 已经消失了
1 2 3 4 5 6 7 8
// status = tree.tickOnce(); while(!BT::isStatusCompleted(status) ) { //---- or, even better ------ // tree.tickWhileRunning(sleep_ms); tree.tickOnce(); tree.sleep(sleep_ms); }
Tree::tickWhileRunning is the new default and it has its own internal loop; the first argument is a timeout of the sleep inside the loop.
或者这两个:
Tree::tickExactlyOnce(): equivalent to the old behavior in 3.8+
Tree::tickOnce() is roughly equivalent to tickWhileRunning(0ms). It may potentially tick more than once.
原型: Result BT::TreeNode::getInput(const std::string& key, T& destination ) const [inline]
Read an input port, which, in practice, is an entry in the blackboard. If the blackboard contains a std::string and T is not a string, convertFromString<T>() is used automatically to parse the text.
Load the definition of an entire behavior tree, but don’t instantiate it. You can instantiate it later with BehaviorTreeFactory::createTree(tree_id), where “tree_id” come from the XML attribute <BehaviorTree id="tree_id">
Call tickOnce until the status is different from RUNNING. Note that between one tick and the following one, a Tree::sleep() is used
BT::NodeStatus BT::Tree::tickExactlyOnce()
Tick the root of the tree once, even if a node invoked emitWakeUpSignal()
BT::NodeStatus BT::Tree::tickOnce()
by default, tickOnce() sends a single tick, But as long as there is at least one node of the tree invoking TreeNode::emitWakeUpSignal(), it will be ticked again.