Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustment before robocup #38

Merged
merged 45 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3807fcb
first approach to restaurant BT
rodperex May 16, 2024
cb2c5be
is_pointing changed to be compatible with restaurant
juandpenan May 28, 2024
73fef8d
lambda adjusted after real time changes
juandpenan May 28, 2024
a62537e
is pointig updated in carry
juandpenan May 28, 2024
44b2e6c
subtree fixed to share blackboard
juandpenan Jun 3, 2024
6cc3067
added increment_variables set_start_position init_restaurant remove_s…
juandpenan Jun 4, 2024
c842215
color added to is detected
juandpenan Jun 4, 2024
a995e72
is pointing changed to work also as is waving
juandpenan Jun 4, 2024
2c6686b
filter entity changed to avoid duplicated tf listener and broadcasters
juandpenan Jun 4, 2024
c5b2e7d
pan changed to get ports in tick
juandpenan Jun 4, 2024
c27dd26
changes madeto complie with bt node changes and restaurant draft added
juandpenan Jun 4, 2024
915cfff
fixed bug with initialization to 0
juandpenan Jun 5, 2024
fc976b5
orders now are initialized to 0
juandpenan Jun 5, 2024
3b26c40
draft restaurant
juandpenan Jun 5, 2024
4b39301
lintered
juandpenan Jun 5, 2024
b35cbc2
stickler draft added
juandpenan Jun 14, 2024
e8d486f
offset added to the start positon node
juandpenan Jun 20, 2024
21103bf
added the color person id for the store detection
juandpenan Jun 20, 2024
dee8bf0
spin bt added
juandpenan Jun 20, 2024
8ad69fe
follow behavior improved, recovery from nav2 goal fails and entity m…
juandpenan Jun 20, 2024
145435a
sortering is performed AFTER filtering now
juandpenan Jun 20, 2024
8169f38
improvements on carry navigation
juandpenan Jun 20, 2024
8d5de81
adjustments on carry my luggage test
juandpenan Jun 20, 2024
7e521d4
adjustments on receptionist test
juandpenan Jun 20, 2024
f3dc477
fixed bug on llama launch
juandpenan Jun 20, 2024
8a4389b
rate changed from 10 to 30 hz
juandpenan Jun 20, 2024
53ddc05
navigation mode changed
juandpenan Jun 20, 2024
f24b30c
maps for tests added and portugal maps deleted
juandpenan Jun 20, 2024
4f58594
gpsr merged
juandpenan Jun 20, 2024
c1932d7
updated xmls for all tasks
juandpenan Jul 4, 2024
efa3f84
added pick from pc move end effector and generate grasp poses
juandpenan Jul 4, 2024
1b194b4
xml changed for tests
juandpenan Jul 4, 2024
43aac45
modified param for URJC tiago camera
juandpenan Jul 4, 2024
561db08
going back to btnodeaction
juandpenan Jul 4, 2024
e51c20e
added move along axis /rotate or spin
juandpenan Jul 4, 2024
e552b03
modified utils
juandpenan Jul 4, 2024
358b399
remove deactivation
juandpenan Jul 4, 2024
bca2202
fixed navigation for carry
juandpenan Jul 4, 2024
b037d46
added extract pc from class
juandpenan Jul 4, 2024
e739bd3
modified cabinet pose calculation to use pointcloud
juandpenan Jul 4, 2024
7ac871a
modified collision scene
juandpenan Jul 4, 2024
461790d
is detected modified
juandpenan Jul 4, 2024
57a70f7
added the camera frame to is pointing
juandpenan Jul 4, 2024
ae63069
configuration changed, before robocup
juandpenan Jul 4, 2024
64ad552
lintered
juandpenan Jul 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bt_nodes/arm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ find_package(rclcpp_action REQUIRED)
find_package(manipulation_interfaces REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
Expand All @@ -28,6 +29,7 @@ set(dependencies
manipulation_interfaces
tf2_ros
geometry_msgs
sensor_msgs
)

include_directories(include)
Expand All @@ -47,6 +49,16 @@ list(APPEND plugin_libs place_bt_node)
add_library(move_joint_bt_node SHARED src/manipulation/move_joint.cpp)
list(APPEND plugin_libs move_joint_bt_node)

add_library(pick_object_from_pc_bt_node SHARED src/manipulation/pick_object_from_pc.cpp)
list(APPEND plugin_libs pick_object_from_pc_bt_node)

add_library(move_end_effector_bt_node SHARED src/manipulation/move_end_effector.cpp)
list(APPEND plugin_libs move_end_effector_bt_node)

add_library(generate_grasp_poses_bt_node SHARED src/manipulation/generate_grasp_poses.cpp)
list(APPEND plugin_libs generate_grasp_poses_bt_node)


foreach(bt_plugin ${plugin_libs})
ament_target_dependencies(${bt_plugin} ${dependencies})
target_compile_definitions(${bt_plugin} PRIVATE BT_PLUGIN_EXPORT)
Expand Down
56 changes: 56 additions & 0 deletions bt_nodes/arm/include/arm/manipulation/generate_grasp_poses.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2024 Intelligent Robotics Lab - Gentlebots
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions andGO2OBJECT
// limitations under the License.

#ifndef ARM_MANIPULATION__GENERATE_GRASP_POSES_HPP_
#define ARM_MANIPULATION__GENERATE_GRASP_POSES_HPP_

#include <algorithm>
#include <string>

#include "arm/manipulation/BTActionNode.hpp"
#include "behaviortree_cpp_v3/behavior_tree.h"
#include "behaviortree_cpp_v3/bt_factory.h"
#include "manipulation_interfaces/action/generate_grasp_poses.hpp"
#include "sensor_msgs/msg/point_cloud2.hpp"
#include "rclcpp/rclcpp.hpp"
#include "rclcpp_cascade_lifecycle/rclcpp_cascade_lifecycle.hpp"

namespace manipulation
{

class GenerateGraspPoses
: public manipulation::BtActionNode<
manipulation_interfaces::action::GenerateGraspPoses,
rclcpp_cascade_lifecycle::CascadeLifecycleNode>
{
public:
explicit GenerateGraspPoses(
const std::string & xml_tag_name, const std::string & action_name,
const BT::NodeConfiguration & conf);

void on_tick() override;
BT::NodeStatus on_success() override;

static BT::PortsList providedPorts()
{
return BT::PortsList(
{BT::InputPort<sensor_msgs::msg::PointCloud2>("object_to_pick"),
BT::OutputPort<std::vector<geometry_msgs::msg::PoseStamped>>("grasp_poses"),
BT::OutputPort<geometry_msgs::msg::PoseStamped>("best_pose")});
}
};

} // namespace manipulation

#endif // arm_MANIPULATION__GENERATE_GRASP_POSES_HPP_
60 changes: 60 additions & 0 deletions bt_nodes/arm/include/arm/manipulation/move_end_effector.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2024 Intelligent Robotics Lab - Gentlebots
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions andGO2OBJECT
// limitations under the License.

#ifndef ARM_MANIPULATION__MOVE_END_EFFECTOR_HPP_
#define ARM_MANIPULATION__MOVE_END_EFFECTOR_HPP_

#include <tf2_ros/buffer.h>

#include <algorithm>
#include <string>

#include "arm/manipulation/BTActionNode.hpp"
#include "behaviortree_cpp_v3/behavior_tree.h"
#include "behaviortree_cpp_v3/bt_factory.h"
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "geometry_msgs/msg/transform_stamped.hpp"
#include "manipulation_interfaces/action/move_end_effector.hpp"
#include "rclcpp/rclcpp.hpp"
#include "rclcpp_cascade_lifecycle/rclcpp_cascade_lifecycle.hpp"

namespace manipulation
{

class MoveEndEffector : public manipulation::BtActionNode<
manipulation_interfaces::action::MoveEndEffector,
rclcpp_cascade_lifecycle::CascadeLifecycleNode>
{
public:
explicit MoveEndEffector(
const std::string & xml_tag_name, const std::string & action_name,
const BT::NodeConfiguration & conf);

void on_tick() override;
BT::NodeStatus on_success() override;

static BT::PortsList providedPorts()
{
return BT::PortsList(
{BT::InputPort<geometry_msgs::msg::PoseStamped>("pose")});
}

private:
geometry_msgs::msg::PoseStamped pose_to_move_;
std::string tf_frame_, base_frame_;
};

} // namespace manipulation

#endif // ARM_MANIPULATION__MOVE_END_EFFECTOR_HPP_
53 changes: 53 additions & 0 deletions bt_nodes/arm/include/arm/manipulation/pick_object_from_pc.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2024 Intelligent Robotics Lab - Gentlebots
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions andGO2OBJECT
// limitations under the License.

#ifndef ARM_MANIPULATION__PICK_OBJECT_FROM_PC_HPP_
#define ARM_MANIPULATION__PICK_OBJECT_FROM_PC_HPP_

#include <algorithm>
#include <string>

#include "arm/manipulation/BTActionNode.hpp"
#include "behaviortree_cpp_v3/behavior_tree.h"
#include "behaviortree_cpp_v3/bt_factory.h"
#include "manipulation_interfaces/action/pick_from_pc.hpp"
#include "sensor_msgs/msg/point_cloud2.hpp"
#include "rclcpp/rclcpp.hpp"
#include "rclcpp_cascade_lifecycle/rclcpp_cascade_lifecycle.hpp"

namespace manipulation
{

class PickObjectFromPC
: public manipulation::BtActionNode<
manipulation_interfaces::action::PickFromPc, rclcpp_cascade_lifecycle::CascadeLifecycleNode>
{
public:
explicit PickObjectFromPC(
const std::string & xml_tag_name, const std::string & action_name,
const BT::NodeConfiguration & conf);

void on_tick() override;
BT::NodeStatus on_success() override;

static BT::PortsList providedPorts()
{
return BT::PortsList(
{BT::InputPort<sensor_msgs::msg::PointCloud2>("object_to_pick")});
}
};

} // namespace manipulation

#endif // arm_MANIPULATION__PICK_OBJECT_FROM_PC_HPP_
78 changes: 78 additions & 0 deletions bt_nodes/arm/src/manipulation/generate_grasp_poses.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Copyright 2024 Intelligent Robotics Lab - Gentlebots
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "arm/manipulation/generate_grasp_poses.hpp"

#include <string>
#include <utility>

#include "behaviortree_cpp_v3/behavior_tree.h"
#include "manipulation_interfaces/action/pick.hpp"

namespace manipulation
{

using namespace std::chrono_literals;
using namespace std::placeholders;

GenerateGraspPoses::GenerateGraspPoses(
const std::string & xml_tag_name, const std::string & action_name,
const BT::NodeConfiguration & conf)
: manipulation::BtActionNode<
manipulation_interfaces::action::GenerateGraspPoses,
rclcpp_cascade_lifecycle::CascadeLifecycleNode>(
xml_tag_name, action_name, conf)
{
}

void GenerateGraspPoses::on_tick()
{
RCLCPP_DEBUG(node_->get_logger(), "GenerateGraspPoses ticked");
sensor_msgs::msg::PointCloud2 pc;
getInput("object_to_pick", pc);
goal_.object_goal = pc;
}

BT::NodeStatus GenerateGraspPoses::on_success()
{
if (result_.result->success) {
setOutput("grasp_poses", result_.result->poses);
RCLCPP_INFO(node_->get_logger(), "GenerateGraspPoses succeeded");
// print the best pose header and position
RCLCPP_INFO(
node_->get_logger(), "Best pose header: %s",
result_.result->poses[0].header.frame_id.c_str());
RCLCPP_INFO(
node_->get_logger(), "Best pose position: %f %f %f", result_.result->poses[0].pose.position.x,
result_.result->poses[0].pose.position.y, result_.result->poses[0].pose.position.z);
setOutput("best_pose", result_.result->poses[0]);
return BT::NodeStatus::SUCCESS;
} else {
RCLCPP_ERROR(node_->get_logger(), "GenerateGraspPoses failed");
return BT::NodeStatus::FAILURE;
}
}

} // namespace manipulation
#include "behaviortree_cpp_v3/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder = [](const std::string & name, const BT::NodeConfiguration & config) {
return std::make_unique<manipulation::GenerateGraspPoses>(
name, "/generate_grasp_poses",
config);
};

factory.registerBuilder<manipulation::GenerateGraspPoses>("GenerateGraspPoses", builder);
}
68 changes: 68 additions & 0 deletions bt_nodes/arm/src/manipulation/move_end_effector.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2024 Intelligent Robotics Lab - Gentlebots
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "arm/manipulation/move_end_effector.hpp"

#include <math.h>

namespace manipulation
{

using namespace std::chrono_literals;
using namespace std::placeholders;

MoveEndEffector::MoveEndEffector(
const std::string & xml_tag_name, const std::string & action_name,
const BT::NodeConfiguration & conf)
: manipulation::BtActionNode<
manipulation_interfaces::action::MoveEndEffector,
rclcpp_cascade_lifecycle::CascadeLifecycleNode>(xml_tag_name, action_name, conf)
{
}

void MoveEndEffector::on_tick()
{
RCLCPP_DEBUG(node_->get_logger(), "MoveEndEffector ticked");
getInput("pose", pose_to_move_);

goal_.pose = pose_to_move_;

RCLCPP_INFO(
node_->get_logger(), "Moving to %f %f %f", goal_.pose.pose.position.x,
goal_.pose.pose.position.y, goal_.pose.pose.position.z);

return;

}

BT::NodeStatus MoveEndEffector::on_success()
{
if (result_.result->success) {
return BT::NodeStatus::SUCCESS;
} else {
RCLCPP_ERROR(node_->get_logger(), "MoveEndEffector failed");
return BT::NodeStatus::FAILURE;
}
}

} // namespace manipulation
#include "behaviortree_cpp_v3/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder = [](const std::string & name, const BT::NodeConfiguration & config) {
return std::make_unique<manipulation::MoveEndEffector>(name, "move_end_effector", config);
};

factory.registerBuilder<manipulation::MoveEndEffector>("MoveEndEffector", builder);
}
Loading
Loading