Skip to content

Commit 7787bd5

Browse files
committed
Merge branch 'humble-devel' into humble-devel-backup
2 parents e5ca0df + 8fa0070 commit 7787bd5

26 files changed

Lines changed: 326 additions & 157 deletions

.docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN mkdir -p /robocup/src/
2323
WORKDIR /robocup
2424

2525
ADD https://raw.githubusercontent.com/mgonzs13/llama_ros/refs/heads/main/requirements.txt /robocup/requirements1.txt
26-
ADD https://raw.githubusercontent.com/jmguerreroh/yolov8_ros/refs/heads/main/requirements.txt /robocup/requirements2.txt
26+
ADD https://raw.githubusercontent.com/jmguerreroh/yolo_ros/refs/heads/main/requirements.txt /robocup/requirements2.txt
2727
ADD https://raw.githubusercontent.com/mgonzs13/tts_ros/refs/heads/main/requirements.txt /robocup/requirements3.txt
2828

2929
# Install external dependencies.

bt_nodes/configuration/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ list(APPEND plugin_libs sleep_bt_node)
8888
add_library(set_blackboard_int_bt_node SHARED src/configuration/set_blackboard_int.cpp)
8989
list(APPEND plugin_libs set_blackboard_int_bt_node)
9090

91+
add_library(activation_control_bt_node SHARED src/configuration/ActivationControl.cpp)
92+
list(APPEND plugin_libs activation_control_bt_node)
93+
9194
foreach(bt_plugin ${plugin_libs})
9295
ament_target_dependencies(${bt_plugin} ${dependencies})
9396
target_compile_definitions(${bt_plugin} PRIVATE BT_PLUGIN_EXPORT)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2024 Intelligent Robotics Lab - Gentlebots
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef CONFIGURATION__ACTIVATION_CONTROL_HPP_
16+
#define CONFIGURATION__ACTIVATION_CONTROL_HPP_
17+
18+
#include <memory>
19+
#include <string>
20+
21+
#include "behaviortree_cpp_v3/behavior_tree.h"
22+
#include "behaviortree_cpp_v3/bt_factory.h"
23+
24+
#include "rclcpp/rclcpp.hpp"
25+
#include "rclcpp_cascade_lifecycle/rclcpp_cascade_lifecycle.hpp"
26+
27+
namespace configuration
28+
{
29+
30+
class ActivationControl : public BT::ActionNodeBase
31+
{
32+
public:
33+
explicit ActivationControl(const std::string & xml_tag_name, const BT::NodeConfiguration & conf);
34+
35+
void halt();
36+
BT::NodeStatus tick();
37+
38+
static BT::PortsList providedPorts()
39+
{
40+
return BT::PortsList({
41+
BT::InputPort<bool>("deactivate", "If true, remove activation, otherwise add"),
42+
BT::InputPort<std::string>("node_name", "Name of the node to (de)activate")
43+
});
44+
}
45+
46+
private:
47+
std::shared_ptr<rclcpp_cascade_lifecycle::CascadeLifecycleNode> node_;
48+
bool deactivate_ {false};
49+
std::string node_name_;
50+
};
51+
52+
} // namespace configuration
53+
54+
#endif // CONFIGURATION__ACTIVATION_CONTROL_HPP_
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2024 Intelligent Robotics Lab - Gentlebots
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "configuration/ActivationControl.hpp"
16+
17+
namespace configuration
18+
{
19+
20+
ActivationControl::ActivationControl(const std::string & xml_tag_name, const BT::NodeConfiguration & conf)
21+
: BT::ActionNodeBase(xml_tag_name, conf)
22+
{
23+
config().blackboard->get("node", node_);
24+
}
25+
26+
BT::NodeStatus ActivationControl::tick()
27+
{
28+
RCLCPP_DEBUG(node_->get_logger(), "ActivationControl ticked");
29+
30+
// Read inputs
31+
if (!getInput("deactivate", deactivate_)) {
32+
RCLCPP_WARN(node_->get_logger(), "ActivationControl: missing 'deactivate' input, defaulting to false");
33+
deactivate_ = false;
34+
}
35+
if (!getInput("node_name", node_name_)) {
36+
RCLCPP_ERROR(node_->get_logger(), "ActivationControl: missing 'node_name' input");
37+
return BT::NodeStatus::FAILURE;
38+
}
39+
40+
if (deactivate_) {
41+
RCLCPP_INFO(node_->get_logger(), "ActivationControl: removing activation for %s", node_name_.c_str());
42+
node_->remove_activation(node_name_);
43+
} else {
44+
RCLCPP_INFO(node_->get_logger(), "ActivationControl: adding activation for %s", node_name_.c_str());
45+
node_->add_activation(node_name_);
46+
}
47+
48+
return BT::NodeStatus::SUCCESS;
49+
}
50+
51+
void ActivationControl::halt()
52+
{
53+
RCLCPP_DEBUG(node_->get_logger(), "ActivationControl halted");
54+
}
55+
56+
} // namespace configuration
57+
58+
BT_REGISTER_NODES(factory) {
59+
factory.registerNodeType<configuration::ActivationControl>("ActivationControl");
60+
}

bt_nodes/configuration/src/configuration/Deferred.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ BT::NodeStatus Deferred::tick()
8282
// publisher_zmq_ = std::make_unique<BT::PublisherZMQ>(subtree_, 10, 2666, 2667);
8383
}
8484

85+
std::cerr << "[DeferredBT] Executing tick to the subtree!!" << std::endl;
8586
auto state = subtree_.rootNode()->executeTick();
87+
std::cerr << "[DeferredBT] Executed tick " << std::endl;
8688

8789
// if (state == BT::NodeStatus::FAILURE || state == BT::NodeStatus::SUCCESS) {
8890
// publisher_zmq_.reset();

bt_nodes/configuration/src/configuration/init_carry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ InitCarry::InitCarry(const std::string & xml_tag_name, const BT::NodeConfigurati
2121
: BT::ActionNodeBase(xml_tag_name, conf)
2222
{
2323
config().blackboard->get("node", node_);
24-
node_->declare_parameter("cam_frame", "head_front_camera_rgb_optical_frame");
24+
node_->declare_parameter("cam_frame", "camera_color_optical_frame");
2525
node_->declare_parameter("home_position", std::vector<double>{0.0, 0.0, 0.0});
2626
node_->declare_parameter("home_pose", "home");
2727
node_->declare_parameter("offer_pose", "offer");

bt_nodes/configuration/src/configuration/init_groceries.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ InitGroceries::InitGroceries(const std::string & xml_tag_name, const BT::NodeCon
2222
{
2323
config().blackboard->get("node", node_);
2424

25-
node_->declare_parameter("cam_frame", "head_front_camera_rgb_optical_frame");
25+
node_->declare_parameter("cam_frame", "camera_color_optical_frame");
2626
node_->declare_parameter("manipulation_frame", "base_link");
2727
// node_->declare_parameter("party_wp", std::vector<double>{0.0, 0.0, 0.0});
2828
// node_->declare_parameter("entrance_wp", std::vector<double>{0.0, 0.0, 0.0});

bt_nodes/configuration/src/configuration/init_restaurant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ InitRestaurant::InitRestaurant(
2323
{
2424
config().blackboard->get("node", node_);
2525

26-
node_->declare_parameter("cam_frame", "head_front_camera_rgb_optical_frame");
26+
node_->declare_parameter("cam_frame", "camera_color_optical_frame");
2727

2828
tf_buffer_ = std::make_shared<tf2_ros::Buffer>(node_->get_clock());
2929
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(*tf_buffer_);

bt_nodes/configuration/src/configuration/init_stickler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ InitStickler::InitStickler(
2323
{
2424
config().blackboard->get("node", node_);
2525

26-
node_->declare_parameter("cam_frame", "head_front_camera_rgb_optical_frame");
26+
node_->declare_parameter("cam_frame", "camera_color_optical_frame");
2727

2828
tf_buffer_ = std::make_shared<tf2_ros::Buffer>(node_->get_clock());
2929
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(*tf_buffer_);

bt_nodes/configuration/src/configuration/set_perception_model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ inline std::string joinPaths(const std::string & path1, const std::string & path
4848

4949
void SetPerceptionModel::on_tick()
5050
{
51-
RCLCPP_DEBUG(node_->get_logger(), "SetPerceptionModelNode ticked");
51+
RCLCPP_INFO(node_->get_logger(), "SetPerceptionModelNode ticked");
5252
getInput("model_name", model_name_);
5353
getInput("model_type", model_type_);
5454
getInput("model_path", model_path_);

0 commit comments

Comments
 (0)