Skip to content

Commit 0cc0469

Browse files
committed
Merge branch 'main' into coresense_main
2 parents f9de8f5 + 594f075 commit 0cc0469

File tree

144 files changed

+7233
-1320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+7233
-1320
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ See [Software setup](https://github.com/CoreSenseEU/CoreSense4Home/wiki/C-Softwa
1010
```bash
1111
ros2 launch robocup_bringup navigation.launch.py
1212
```
13+
### Launch current carry my luggage implementation
14+
15+
First kill move_group node inside tiago robot. Then in separate terminals launch:
16+
17+
```bash
18+
ros2 launch robocup_bringup navigation_follow.launch.py rviz:=True
19+
```
20+
```bash
21+
ros2 launch attention_system attention.launch.py
22+
```
23+
```bash
24+
ros2 launch robocup_bringup carry_my_luggage_dependencies.launch.py
25+
```
26+
```bash
27+
ros2 launch whisper_bringup whisper.launch.py
28+
```
29+
Finally:
30+
31+
```bash
32+
ros2 run bt_test carry_my_luggage_test
33+
```
1334

1435
### Follow navigation with small objects
1536
```bash

bt_nodes/arm/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ find_package(rclcpp REQUIRED)
1212
find_package(rclcpp_cascade_lifecycle REQUIRED)
1313
find_package(rclcpp_action REQUIRED)
1414
find_package(manipulation_interfaces REQUIRED)
15+
find_package(tf2_ros REQUIRED)
16+
find_package(geometry_msgs REQUIRED)
1517
# uncomment the following section in order to fill in
1618
# further dependencies manually.
1719
# find_package(<dependency> REQUIRED)
@@ -24,6 +26,8 @@ set(dependencies
2426
rclcpp_cascade_lifecycle
2527
rclcpp_action
2628
manipulation_interfaces
29+
tf2_ros
30+
geometry_msgs
2731
)
2832

2933
include_directories(include)
@@ -34,6 +38,12 @@ list(APPEND plugin_libs pick_bt_node)
3438
add_library(move_to_predefined_bt_node SHARED src/manipulation/move_to_predefined.cpp)
3539
list(APPEND plugin_libs move_to_predefined_bt_node)
3640

41+
add_library(point_at_bt_node SHARED src/manipulation/point_at.cpp)
42+
list(APPEND plugin_libs point_at_bt_node)
43+
44+
add_library(place_bt_node SHARED src/manipulation/place_object.cpp)
45+
list(APPEND plugin_libs place_bt_node)
46+
3747
foreach(bt_plugin ${plugin_libs})
3848
ament_target_dependencies(${bt_plugin} ${dependencies})
3949
target_compile_definitions(${bt_plugin} PRIVATE BT_PLUGIN_EXPORT)

bt_nodes/arm/include/arm/manipulation/BTActionNode.hpp

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
namespace manipulation
2626
{
2727

28-
using namespace std::chrono_literals; // NOLINT
28+
using namespace std::chrono_literals; // NOLINT
2929

3030
template<class ActionT, class NodeT = rclcpp::Node>
3131
class BtActionNode : public BT::ActionNodeBase
@@ -42,8 +42,7 @@ class BtActionNode : public BT::ActionNodeBase
4242

4343
// Initialize the input and output messages
4444
goal_ = typename ActionT::Goal();
45-
result_ =
46-
typename rclcpp_action::ClientGoalHandle<ActionT>::WrappedResult();
45+
result_ = typename rclcpp_action::ClientGoalHandle<ActionT>::WrappedResult();
4746

4847
std::string remapped_action_name;
4948
if (getInput("server_name", remapped_action_name)) {
@@ -52,9 +51,7 @@ class BtActionNode : public BT::ActionNodeBase
5251
createActionClient(action_name_);
5352

5453
// Give the derive class a chance to do any initialization
55-
RCLCPP_INFO(
56-
node_->get_logger(), "\"%s\" BtActionNode initialized",
57-
xml_tag_name.c_str());
54+
RCLCPP_INFO(node_->get_logger(), "\"%s\" BtActionNode initialized", xml_tag_name.c_str());
5855
}
5956

6057
BtActionNode() = delete;
@@ -69,9 +66,7 @@ class BtActionNode : public BT::ActionNodeBase
6966
action_client_ = rclcpp_action::create_client<ActionT>(node_, action_name);
7067

7168
// Make sure the server is actually there before continuing
72-
RCLCPP_INFO(
73-
node_->get_logger(), "Waiting for \"%s\" action server",
74-
action_name.c_str());
69+
RCLCPP_INFO(node_->get_logger(), "Waiting for \"%s\" action server", action_name.c_str());
7570
action_client_->wait_for_action_server();
7671
}
7772

@@ -134,8 +129,8 @@ class BtActionNode : public BT::ActionNodeBase
134129
on_wait_for_result();
135130

136131
auto goal_status = goal_handle_->get_status();
137-
if (goal_updated_ &&
138-
(goal_status == action_msgs::msg::GoalStatus::STATUS_EXECUTING ||
132+
if (
133+
goal_updated_ && (goal_status == action_msgs::msg::GoalStatus::STATUS_EXECUTING ||
139134
goal_status == action_msgs::msg::GoalStatus::STATUS_ACCEPTED))
140135
{
141136
goal_updated_ = false;
@@ -172,15 +167,13 @@ class BtActionNode : public BT::ActionNodeBase
172167
{
173168
if (should_cancel_goal()) {
174169
auto future_cancel = action_client_->async_cancel_goal(goal_handle_);
175-
if (rclcpp::spin_until_future_complete(
176-
node_->get_node_base_interface(),
177-
future_cancel, server_timeout_) !=
170+
if (
171+
rclcpp::spin_until_future_complete(
172+
node_->get_node_base_interface(), future_cancel, server_timeout_) !=
178173
rclcpp::FutureReturnCode::SUCCESS)
179174
{
180175
RCLCPP_ERROR(
181-
node_->get_logger(),
182-
"Failed to cancel action server for %s",
183-
action_name_.c_str());
176+
node_->get_logger(), "Failed to cancel action server for %s", action_name_.c_str());
184177
}
185178
}
186179

@@ -206,11 +199,9 @@ class BtActionNode : public BT::ActionNodeBase
206199
void on_new_goal_received()
207200
{
208201
goal_result_available_ = false;
209-
auto send_goal_options =
210-
typename rclcpp_action::Client<ActionT>::SendGoalOptions();
202+
auto send_goal_options = typename rclcpp_action::Client<ActionT>::SendGoalOptions();
211203
send_goal_options.result_callback =
212-
[this](const typename rclcpp_action::ClientGoalHandle<
213-
ActionT>::WrappedResult & result) {
204+
[this](const typename rclcpp_action::ClientGoalHandle<ActionT>::WrappedResult & result) {
214205
// TODO(#1652): a work around until rcl_action interface is updated
215206
// if goal ids are not matched, the older goal call this callback so
216207
// ignore the result if matched, it must be processed (including
@@ -221,12 +212,12 @@ class BtActionNode : public BT::ActionNodeBase
221212
}
222213
};
223214

224-
auto future_goal_handle =
225-
action_client_->async_send_goal(goal_, send_goal_options);
215+
auto future_goal_handle = action_client_->async_send_goal(goal_, send_goal_options);
226216

227-
if (rclcpp::spin_until_future_complete(
228-
node_->get_node_base_interface(), future_goal_handle,
229-
server_timeout_) != rclcpp::FutureReturnCode::SUCCESS)
217+
if (
218+
rclcpp::spin_until_future_complete(
219+
node_->get_node_base_interface(), future_goal_handle, server_timeout_) !=
220+
rclcpp::FutureReturnCode::SUCCESS)
230221
{
231222
throw std::runtime_error("send_goal failed");
232223
}
@@ -242,11 +233,11 @@ class BtActionNode : public BT::ActionNodeBase
242233
int recovery_count = 0;
243234
config().blackboard->get<int>(
244235
"number_recoveries",
245-
recovery_count); // NOLINT
236+
recovery_count); // NOLINT
246237
recovery_count += 1;
247238
config().blackboard->set<int>(
248239
"number_recoveries",
249-
recovery_count); // NOLINT
240+
recovery_count); // NOLINT
250241
}
251242

252243
std::string action_name_;
@@ -267,6 +258,6 @@ class BtActionNode : public BT::ActionNodeBase
267258
std::chrono::milliseconds server_timeout_;
268259
};
269260

270-
} // namespace manipulation
261+
} // namespace manipulation
271262

272-
#endif // ARM__MANIPULATION__BTACTIONNODE_HPP_
263+
#endif // ARM__MANIPULATION__BTACTIONNODE_HPP_

bt_nodes/arm/include/arm/manipulation/move_to_predefined.hpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,43 @@
1818
#include <algorithm>
1919
#include <string>
2020

21-
#include "manipulation_interfaces/action/move_to_predefined.hpp"
22-
#include "moveit_msgs/msg/collision_object.hpp"
21+
#include "arm/manipulation/BTActionNode.hpp"
2322
#include "behaviortree_cpp_v3/behavior_tree.h"
2423
#include "behaviortree_cpp_v3/bt_factory.h"
25-
#include "arm/manipulation/BTActionNode.hpp"
26-
24+
#include "manipulation_interfaces/action/move_to_predefined.hpp"
25+
#include "moveit_msgs/msg/collision_object.hpp"
2726
#include "rclcpp/rclcpp.hpp"
2827
#include "rclcpp_cascade_lifecycle/rclcpp_cascade_lifecycle.hpp"
2928

3029
namespace manipulation
3130
{
3231

33-
class MoveToPredefined : public manipulation::BtActionNode<
34-
manipulation_interfaces::action::MoveToPredefined,
35-
rclcpp_cascade_lifecycle::CascadeLifecycleNode>
32+
class MoveToPredefined
33+
: public manipulation::BtActionNode<manipulation_interfaces::action::MoveToPredefined>
3634
{
3735
public:
3836
explicit MoveToPredefined(
39-
const std::string & xml_tag_name,
40-
const std::string & action_name,
37+
const std::string & xml_tag_name, const std::string & action_name,
4138
const BT::NodeConfiguration & conf);
4239

4340
void on_tick() override;
4441
BT::NodeStatus on_success() override;
4542

4643
static BT::PortsList providedPorts()
4744
{
48-
return BT::PortsList(
49-
{BT::InputPort<std::string>(
50-
"pose")});
45+
return BT::PortsList({BT::InputPort<std::string>("pose"),
46+
BT::InputPort<std::string>("group_name")});
5147
}
5248

5349
private:
50+
// rclcpp::Node::SharedPtr node_;
51+
// rclcpp::ActionClient<audio_common_msgs::action::TTS>::SharedPtr
52+
// tts_action_;
53+
std::string group_name_{"arm_torso"};
54+
5455
std::string pose_;
5556
};
5657

57-
} // namespace manipulation
58+
} // namespace manipulation
5859

59-
#endif // ARM_MANIPULATION__MOVE_TO_PREDEFINED_HPP_
60+
#endif // ARM_MANIPULATION__MOVE_TO_PREDEFINED_HPP_

bt_nodes/arm/include/arm/manipulation/pick_object.hpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818
#include <algorithm>
1919
#include <string>
2020

21-
#include "manipulation_interfaces/action/pick.hpp"
22-
#include "moveit_msgs/msg/collision_object.hpp"
21+
#include "arm/manipulation/BTActionNode.hpp"
2322
#include "behaviortree_cpp_v3/behavior_tree.h"
2423
#include "behaviortree_cpp_v3/bt_factory.h"
25-
#include "arm/manipulation/BTActionNode.hpp"
26-
24+
#include "manipulation_interfaces/action/pick.hpp"
25+
#include "moveit_msgs/msg/collision_object.hpp"
2726
#include "rclcpp/rclcpp.hpp"
2827
#include "rclcpp_cascade_lifecycle/rclcpp_cascade_lifecycle.hpp"
2928

@@ -35,8 +34,7 @@ class PickObject : public manipulation::BtActionNode<
3534
{
3635
public:
3736
explicit PickObject(
38-
const std::string & xml_tag_name,
39-
const std::string & action_name,
37+
const std::string & xml_tag_name, const std::string & action_name,
4038
const BT::NodeConfiguration & conf);
4139

4240
void on_tick() override;
@@ -45,11 +43,10 @@ class PickObject : public manipulation::BtActionNode<
4543
static BT::PortsList providedPorts()
4644
{
4745
return BT::PortsList(
48-
{BT::InputPort<moveit_msgs::msg::CollisionObject::SharedPtr>(
49-
"object_to_pick")});
46+
{BT::InputPort<moveit_msgs::msg::CollisionObject::SharedPtr>("object_to_pick")});
5047
}
5148
};
5249

53-
} // namespace manipulation
50+
} // namespace manipulation
5451

55-
#endif // arm_MANIPULATION__PICK_OBJECT_HPP_
52+
#endif // arm_MANIPULATION__PICK_OBJECT_HPP_
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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 andGO2OBJECT
13+
// limitations under the License.
14+
15+
#ifndef ARM_MANIPULATION__PLACE_OBJECT_HPP_
16+
#define ARM_MANIPULATION__PLACE_OBJECT_HPP_
17+
18+
#include <algorithm>
19+
#include <string>
20+
21+
#include "arm/manipulation/BTActionNode.hpp"
22+
#include "behaviortree_cpp_v3/behavior_tree.h"
23+
#include "behaviortree_cpp_v3/bt_factory.h"
24+
#include "manipulation_interfaces/action/place.hpp"
25+
#include "geometry_msgs/msg/pose_stamped.hpp"
26+
#include "geometry_msgs/msg/transform_stamped.hpp"
27+
#include <tf2_ros/buffer.h>
28+
#include "moveit_msgs/msg/collision_object.hpp"
29+
#include "rclcpp/rclcpp.hpp"
30+
31+
namespace manipulation
32+
{
33+
34+
class PlaceObject : public manipulation::BtActionNode<manipulation_interfaces::action::Place>
35+
{
36+
public:
37+
explicit PlaceObject(
38+
const std::string & xml_tag_name, const std::string & action_name,
39+
const BT::NodeConfiguration & conf);
40+
41+
void on_tick() override;
42+
BT::NodeStatus on_success() override;
43+
44+
static BT::PortsList providedPorts()
45+
{
46+
return BT::PortsList(
47+
{BT::InputPort<moveit_msgs::msg::CollisionObject::SharedPtr>("object_to_place"),
48+
BT::InputPort<geometry_msgs::msg::PoseStamped>("place_pose"),
49+
BT::InputPort<std::string>("base_frame")});
50+
}
51+
52+
private:
53+
54+
55+
std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
56+
std::string tf_to_place_, base_frame_;
57+
moveit_msgs::msg::CollisionObject::SharedPtr object_;
58+
geometry_msgs::msg::PoseStamped place_pose_;
59+
geometry_msgs::msg::TransformStamped transform_to_place_;
60+
// rclcpp::Node::SharedPtr node_;
61+
// rclcpp::ActionClient<audio_common_msgs::action::TTS>::SharedPtr
62+
// tts_action_;
63+
64+
// std::string text_;
65+
};
66+
67+
} // namespace manipulation
68+
69+
#endif // arm_MANIPULATION__PLACE_OBJECT_HPP_

0 commit comments

Comments
 (0)