Skip to content

Commit 175c716

Browse files
committed
added new node to add string suffix
1 parent daf759c commit 175c716

8 files changed

Lines changed: 122 additions & 15 deletions

File tree

bt_nodes/configuration/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ list(APPEND plugin_libs init_restaurant_bt_node)
6161
add_library(remove_string_suffix_bt_node SHARED src/configuration/remove_string_suffix.cpp)
6262
list(APPEND plugin_libs remove_string_suffix_bt_node)
6363

64+
add_library(add_string_suffix_bt_node SHARED src/configuration/add_string_suffix.cpp)
65+
list(APPEND plugin_libs add_string_suffix_bt_node)
66+
6467
add_library(remove_string_prefix_bt_node SHARED src/configuration/remove_string_prefix.cpp)
6568
list(APPEND plugin_libs remove_string_prefix_bt_node)
6669

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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__ADD_STRING_SUFFIX_HPP_
16+
#define CONFIGURATION__ADD_STRING_SUFFIX_HPP_
17+
18+
#include "behaviortree_cpp_v3/behavior_tree.h"
19+
#include "behaviortree_cpp_v3/bt_factory.h"
20+
21+
namespace configuration
22+
{
23+
24+
class AddStringSuffix : public BT::ActionNodeBase
25+
{
26+
public:
27+
explicit AddStringSuffix(const std::string & xml_tag_name, const BT::NodeConfiguration & conf);
28+
29+
void halt();
30+
BT::NodeStatus tick();
31+
32+
static BT::PortsList providedPorts()
33+
{
34+
return BT::PortsList(
35+
{
36+
BT::InputPort<std::string>("string_to_modify"),
37+
BT::InputPort<std::string>("suffix"),
38+
BT::OutputPort<std::string>("result")
39+
});
40+
}
41+
42+
private:
43+
std::string string_to_modify_;
44+
std::string suffix_;
45+
std::string result_;
46+
};
47+
48+
} // namespace configuration
49+
50+
#endif // CONFIGURATION__ADD_STRING_SUFFIX_HPP_
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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/add_string_suffix.hpp"
16+
17+
namespace configuration
18+
{
19+
20+
AddStringSuffix::AddStringSuffix(
21+
const std::string & xml_tag_name, const BT::NodeConfiguration & conf)
22+
: BT::ActionNodeBase(xml_tag_name, conf)
23+
{
24+
}
25+
26+
BT::NodeStatus AddStringSuffix::tick()
27+
{
28+
getInput("string_to_modify", string_to_modify_);
29+
getInput("suffix", suffix_);
30+
if (string_to_modify_.empty()) {
31+
return BT::NodeStatus::FAILURE;
32+
}
33+
result_ = string_to_modify_ + suffix_;
34+
setOutput("result", result_);
35+
return BT::NodeStatus::SUCCESS;
36+
}
37+
38+
void AddStringSuffix::halt() {}
39+
40+
} // namespace configuration
41+
42+
BT_REGISTER_NODES(factory)
43+
{
44+
factory.registerNodeType<configuration::AddStringSuffix>("AddStringSuffix");
45+
}

bt_nodes/perception/src/perception/ExtractHandoverAlignment.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,14 @@ BT::NodeStatus ExtractHandoverAlignment::tick()
101101
detected_object.bbox3d.center.position.z));
102102
camera_2_object.setRotation(tf2::Quaternion(0.0, 0.0, 0.0, 1.0));
103103

104-
// Get transform from arm_4_link to camera
104+
// Get transform from arm_4_link to object frame
105105
geometry_msgs::msg::TransformStamped arm_2_camera_msg;
106106
try {
107107
arm_2_camera_msg = tf_buffer_->lookupTransform(
108-
"arm_4_link", "head_front_camera_rgb_optical_frame", tf2::TimePointZero);
108+
"arm_4_link", detected_object.bbox3d.frame_id, tf2::TimePointZero);
109109
} catch (const tf2::TransformException & ex) {
110-
// Try regular frame if optical fails
111-
try {
112-
arm_2_camera_msg = tf_buffer_->lookupTransform(
113-
"arm_4_link", "head_front_camera_rgb_frame", tf2::TimePointZero);
114-
} catch (const tf2::TransformException & ex2) {
115-
RCLCPP_ERROR(node_->get_logger(), "TF Error: %s", ex2.what());
116-
return BT::NodeStatus::FAILURE;
117-
}
110+
RCLCPP_ERROR(node_->get_logger(), "TF Error looking up %s: %s", detected_object.bbox3d.frame_id.c_str(), ex.what());
111+
return BT::NodeStatus::FAILURE;
118112
}
119113

120114
tf2::Transform arm_2_camera;
@@ -147,7 +141,7 @@ BT::NodeStatus ExtractHandoverAlignment::tick()
147141
double new_torso_height = current_torso_height_ + torso_z_error;
148142

149143
// Limits
150-
double min_height = 0.0;
144+
double min_height = 0.11;
151145
double max_height = 0.35;
152146
if (new_torso_height < min_height) {
153147
new_torso_height = min_height;

robocup_bringup/launch/receptionist_dependencies.launch.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def generate_launch_description():
8585
launch_arguments={
8686
'rviz': 'True',
8787
# 'map': package_dir + '/maps/robocup_arena_1.yaml', # ARENA C
88-
'map': package_dir + '/maps/ir_lab.yaml', # ARENA B
88+
'map': package_dir + '/maps/lab_marzo.yaml', # ARENA B
8989
'params_file': package_dir +
9090
'/config/receptionist/tiago_nav_params.yaml',
9191
'slam_params_file': package_dir +
@@ -114,7 +114,15 @@ def generate_launch_description():
114114
person_tracker = IncludeLaunchDescription(
115115
PythonLaunchDescriptionSource(
116116
os.path.join(person_tracker_dir, 'launch', 'person_tracker.launch.py')
117-
)
117+
),
118+
launch_arguments={
119+
'target_frame': 'map',
120+
'only_yolo': 'true',
121+
'ema_alpha': '0.1',
122+
'yolo_only_gate': '2.0',
123+
'yolo_only_delete_threshold': '1.5',
124+
'yolo_only_confirm_threshold': '2'
125+
}.items()
118126
)
119127

120128
ld = LaunchDescription()
@@ -123,7 +131,7 @@ def generate_launch_description():
123131
ld.add_action(yolo3d)
124132
ld.add_action(real_time)
125133
ld.add_action(knowledge_core)
126-
ld.add_action(laser_people_detector)
134+
# ld.add_action(laser_people_detector) Not working so far, only yolo for the moment
127135
ld.add_action(person_tracker)
128136
# ld.add_action(move_group)
129137
ld.add_action(manipulation_server)

robocup_bringup/maps/lab_marzo.pgm

43.3 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
image: lab_marzo.pgm
2+
mode: trinary
3+
resolution: 0.050
4+
origin: [-4.997, -5.181, 0]
5+
negate: 0
6+
occupied_thresh: 0.65
7+
free_thresh: 0.196

robocup_bringup/thirdparty.repos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ repositories:
7373
version: main
7474
ThirdParty/upo_laser_people_detector:
7575
type: git
76-
url: https://github.com/robotics-upo/upo_laser_people_detector.git
76+
url: https://github.com/juandpenan/upo_laser_people_detector.git
7777
version: ros2
7878
ThirdParty/cs4home_person_tracker:
7979
type: git

0 commit comments

Comments
 (0)