Skip to content

Commit 8023df2

Browse files
authored
Merge pull request #3 from PickNikRobotics/registration
Moving registration behaviors
2 parents 7669d52 + 05e796e commit 8023df2

File tree

18 files changed

+43
-200
lines changed

18 files changed

+43
-200
lines changed

src/example_behaviors/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ find_package(moveit_studio_common REQUIRED)
55
find_package(example_interfaces REQUIRED)
66
moveit_studio_package()
77

8-
set(THIS_PACKAGE_INCLUDE_DEPENDS moveit_studio_behavior moveit_studio_behavior_interface pluginlib example_interfaces)
8+
set(THIS_PACKAGE_INCLUDE_DEPENDS moveit_studio_behavior moveit_studio_behavior_interface pluginlib
9+
moveit_studio_vision
10+
moveit_studio_vision_msgs
11+
PCL
12+
pcl_conversions
13+
pcl_ros
14+
example_interfaces)
915
foreach(package IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
1016
find_package(${package} REQUIRED)
1117
endforeach()
@@ -23,11 +29,14 @@ add_library(
2329
src/setup_mtc_pick_from_pose.cpp
2430
src/setup_mtc_place_from_pose.cpp
2531
src/setup_mtc_wave_hand.cpp
32+
src/ndt_registration.cpp
33+
src/ransac_registration.cpp
2634
src/register_behaviors.cpp)
2735
target_include_directories(
2836
example_behaviors
2937
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
30-
$<INSTALL_INTERFACE:include>)
38+
$<INSTALL_INTERFACE:include>
39+
PRIVATE ${PCL_INCLUDE_DIRS})
3140
ament_target_dependencies(example_behaviors
3241
${THIS_PACKAGE_INCLUDE_DEPENDS})
3342

src/picknik_registration/include/picknik_registration/ndt_registration.hpp renamed to src/example_behaviors/include/example_behaviors/ndt_registration.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <moveit_studio_behavior_interface/async_behavior_base.hpp>
88

99

10-
namespace picknik_registration
10+
namespace example_behaviors
1111
{
1212
/**
1313
* @brief TODO(...)
@@ -16,7 +16,7 @@ class NDTRegistration : public moveit_studio::behaviors::AsyncBehaviorBase
1616
{
1717
public:
1818
/**
19-
* @brief Constructor for the picknik_registration behavior.
19+
* @brief Constructor for the behavior.
2020
* @param name The name of a particular instance of this Behavior. This will be set by the behavior tree factory when this Behavior is created within a new behavior tree.
2121
* @param shared_resources A shared_ptr to a BehaviorContext that is shared among all SharedResourcesNode Behaviors in the behavior tree. This BehaviorContext is owned by the Studio Agent's ObjectiveServerNode.
2222
* @param config This contains runtime configuration info for this Behavior, such as the mapping between the Behavior's data ports on the behavior tree's blackboard. This will be set by the behavior tree factory when this Behavior is created within a new behavior tree.
@@ -25,10 +25,10 @@ class NDTRegistration : public moveit_studio::behaviors::AsyncBehaviorBase
2525
NDTRegistration(const std::string& name, const BT::NodeConfiguration& config, const std::shared_ptr<moveit_studio::behaviors::BehaviorContext>& shared_resources);
2626

2727
/**
28-
* @brief Implementation of the required providedPorts() function for the picknik_registration Behavior.
28+
* @brief Implementation of the required providedPorts() function for the Behavior.
2929
* @details The BehaviorTree.CPP library requires that Behaviors must implement a static function named providedPorts() which defines their input and output ports. If the Behavior does not use any ports, this function must return an empty BT::PortsList.
3030
* This function returns a list of ports with their names and port info, which is used internally by the behavior tree.
31-
* @return picknik_registration does not use expose any ports, so this function returns an empty list.
31+
* @return See ndt_registration.cpp for port list and description.
3232
*/
3333
static BT::PortsList providedPorts();
3434

@@ -52,4 +52,4 @@ class NDTRegistration : public moveit_studio::behaviors::AsyncBehaviorBase
5252
/** @brief Classes derived from AsyncBehaviorBase must have this shared_future as a class member */
5353
std::shared_future<tl::expected<bool, std::string>> future_;
5454
};
55-
} // namespace picknik_registration
55+
} // namespace example_behaviors

src/picknik_registration/include/picknik_registration/ransac_registration.hpp renamed to src/example_behaviors/include/example_behaviors/ransac_registration.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <moveit_studio_behavior_interface/async_behavior_base.hpp>
88

99

10-
namespace picknik_registration
10+
namespace example_behaviors
1111
{
1212
/**
1313
* @brief TODO(...)
@@ -16,7 +16,7 @@ class RANSACRegistration : public moveit_studio::behaviors::AsyncBehaviorBase
1616
{
1717
public:
1818
/**
19-
* @brief Constructor for the picknik_registration behavior.
19+
* @brief Constructor for the behavior.
2020
* @param name The name of a particular instance of this Behavior. This will be set by the behavior tree factory when this Behavior is created within a new behavior tree.
2121
* @param shared_resources A shared_ptr to a BehaviorContext that is shared among all SharedResourcesNode Behaviors in the behavior tree. This BehaviorContext is owned by the Studio Agent's ObjectiveServerNode.
2222
* @param config This contains runtime configuration info for this Behavior, such as the mapping between the Behavior's data ports on the behavior tree's blackboard. This will be set by the behavior tree factory when this Behavior is created within a new behavior tree.
@@ -25,10 +25,10 @@ class RANSACRegistration : public moveit_studio::behaviors::AsyncBehaviorBase
2525
RANSACRegistration(const std::string& name, const BT::NodeConfiguration& config, const std::shared_ptr<moveit_studio::behaviors::BehaviorContext>& shared_resources);
2626

2727
/**
28-
* @brief Implementation of the required providedPorts() function for the picknik_registration Behavior.
28+
* @brief Implementation of the required providedPorts() function for the Behavior.
2929
* @details The BehaviorTree.CPP library requires that Behaviors must implement a static function named providedPorts() which defines their input and output ports. If the Behavior does not use any ports, this function must return an empty BT::PortsList.
3030
* This function returns a list of ports with their names and port info, which is used internally by the behavior tree.
31-
* @return picknik_registration does not use expose any ports, so this function returns an empty list.
31+
* @return See ransac_registration.cpp for port list and description.
3232
*/
3333
static BT::PortsList providedPorts();
3434

@@ -52,4 +52,4 @@ class RANSACRegistration : public moveit_studio::behaviors::AsyncBehaviorBase
5252
/** @brief Classes derived from AsyncBehaviorBase must have this shared_future as a class member */
5353
std::shared_future<tl::expected<bool, std::string>> future_;
5454
};
55-
} // namespace picknik_registration
55+
} // namespace example_behaviors

src/example_behaviors/package.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
<version>0.0.0</version>
55
<description>Example behaviors for MoveIt Pro</description>
66

7-
<maintainer email="john@doe.com">John Doe</maintainer>
8-
<author email="john@doe.com">John Doe</author>
7+
<maintainer email="support@picknik.ai">MoveIt Pro Maintainer</maintainer>
8+
<author email="support@picknik.ai">MoveIt Pro Maintainer</author>
99

10-
<license>TODO</license>
10+
<license>BSD-3-Clause</license>
1111

1212
<buildtool_depend>ament_cmake</buildtool_depend>
1313

1414
<build_depend>moveit_studio_common</build_depend>
1515

1616
<depend>moveit_studio_behavior_interface</depend>
1717
<depend>example_interfaces</depend>
18+
<depend>perception_pcl</depend>
19+
<depend>moveit_ros_planning_interface</depend>
20+
<depend>moveit_studio_vision_msgs</depend>
21+
<depend>moveit_studio_vision</depend>
1822

1923
<test_depend>ament_lint_auto</test_depend>
2024
<test_depend>ament_cmake_gtest</test_depend>

src/picknik_registration/src/ndt_registration.cpp renamed to src/example_behaviors/src/ndt_registration.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#include <picknik_registration/ndt_registration.hpp>
1+
#include <example_behaviors/ndt_registration.hpp>
22
#include <pcl/registration/ndt.h>
33
#include <tl_expected/expected.hpp>
44
#include <moveit_studio_behavior_interface/async_behavior_base.hpp>
55
#include <moveit_studio_behavior_interface/check_for_error.hpp>
6-
// #include <moveit_studio_vision/geometry_types.hpp>
76
#include <geometry_msgs/msg/pose_stamped.hpp>
87
#include <sensor_msgs/msg/point_cloud2.hpp>
98
#include <std_msgs/msg/header.hpp>
@@ -23,7 +22,7 @@
2322
#include <pcl/registration/sample_consensus_prerejective.h>
2423
#include <pcl/search/kdtree.h>
2524

26-
namespace picknik_registration
25+
namespace example_behaviors
2726
{
2827
namespace
2928
{
@@ -145,4 +144,4 @@ tl::expected<bool, std::string> NDTRegistration::doWork()
145144
}
146145

147146

148-
} // namespace picknik_registration
147+
} // namespace example_behaviors

src/picknik_registration/src/ransac_registration.cpp renamed to src/example_behaviors/src/ransac_registration.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <picknik_registration/ransac_registration.hpp>
1+
#include <example_behaviors/ransac_registration.hpp>
22
#include <pcl/registration/ndt.h>
33
#include <tl_expected/expected.hpp>
44
#include <moveit_studio_behavior_interface/async_behavior_base.hpp>
@@ -22,7 +22,7 @@
2222
#include <pcl/registration/sample_consensus_prerejective.h>
2323
#include <pcl/search/kdtree.h>
2424

25-
namespace picknik_registration
25+
namespace example_behaviors
2626
{
2727
namespace
2828
{
@@ -232,4 +232,4 @@ tl::expected<bool, std::string> RANSACRegistration::doWork()
232232
}
233233

234234

235-
} // namespace picknik_registration
235+
} // namespace example_behaviors

src/example_behaviors/src/register_behaviors.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <example_behaviors/publish_color_rgba.hpp>
1313
#include <example_behaviors/setup_mtc_pick_from_pose.hpp>
1414
#include <example_behaviors/setup_mtc_place_from_pose.hpp>
15+
#include <example_behaviors/ndt_registration.hpp>
16+
#include <example_behaviors/ransac_registration.hpp>
1517

1618
#include <pluginlib/class_list_macros.hpp>
1719

@@ -36,6 +38,8 @@ class ExampleBehaviorsLoader : public moveit_studio::behaviors::SharedResourcesN
3638
moveit_studio::behaviors::registerBehavior<SetupMtcPickFromPose>(factory, "SetupMtcPickFromPose", shared_resources);
3739
moveit_studio::behaviors::registerBehavior<SetupMtcPlaceFromPose>(factory, "SetupMtcPlaceFromPose",
3840
shared_resources);
41+
moveit_studio::behaviors::registerBehavior<NDTRegistration>(factory, "NDTRegistration", shared_resources);
42+
moveit_studio::behaviors::registerBehavior<RANSACRegistration>(factory, "RANSACRegistration", shared_resources);
3943
}
4044
};
4145
} // namespace example_behaviors

src/example_behaviors/test/test_behavior_plugins.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ TEST(BehaviorTests, test_load_behavior_plugins)
3636
(void)factory.instantiateTreeNode("test_behavior_name", "SetupMtcPickFromPose", BT::NodeConfiguration()));
3737
EXPECT_NO_THROW(
3838
(void)factory.instantiateTreeNode("test_behavior_name", "SetupMtcPlaceFromPose", BT::NodeConfiguration()));
39-
EXPECT_NO_THROW((void)factory.instantiateTreeNode("test_behavior_name", "SetupMTCWaveHand", BT::NodeConfiguration()));
39+
EXPECT_NO_THROW((void)factory.instantiateTreeNode("test_behavior_name", "SetupMTCWaveHand", BT::NodeConfiguration()));
40+
EXPECT_NO_THROW(
41+
(void)factory.instantiateTreeNode("test_behavior_name", "NDTRegistration", BT::NodeConfiguration()));
42+
EXPECT_NO_THROW(
43+
(void)factory.instantiateTreeNode("test_behavior_name", "RANSACRegistration", BT::NodeConfiguration()));
4044
}
4145

4246
int main(int argc, char** argv)

src/lab_sim/config/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ objectives:
4242
- "moveit_studio::behaviors::MTCCoreBehaviorsLoader"
4343
- "moveit_studio::behaviors::ServoBehaviorsLoader"
4444
- "moveit_studio::behaviors::VisionBehaviorsLoader"
45-
- "picknik_registration::PicknikRegistrationBehaviorsLoader"
4645
- "example_behaviors::ExampleBehaviorsLoader"
4746
# Specify source folder for objectives
4847
# [Required]

src/moveit_pro_ur_configs/picknik_ur_sim_config/config/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ objectives:
4242
- "moveit_studio::behaviors::MTCCoreBehaviorsLoader"
4343
- "moveit_studio::behaviors::ServoBehaviorsLoader"
4444
- "moveit_studio::behaviors::VisionBehaviorsLoader"
45-
- "picknik_registration::PicknikRegistrationBehaviorsLoader"
4645
# Specify source folder for objectives
4746
# [Required]
4847
objective_library_paths:

0 commit comments

Comments
 (0)