moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
servo_cpp_fixture.hpp
Go to the documentation of this file.
1/*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2023, PickNik Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of PickNik Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34
35/* Title : servo_cpp_fixture.hpp
36 * Project : moveit_servo
37 * Created : 07/13/2020
38 * Author : Adam Pettinger, V Mohammed Ibrahim
39 *
40 * Description : Resources used by servo c++ integration tests
41 */
42
43#include <gtest/gtest.h>
48#include <tf2_eigen/tf2_eigen.hpp>
49
50class ServoCppFixture : public testing::Test
51{
52protected:
53 void SetUp() override
54 {
55 // Create a node to be given to Servo.
56 servo_test_node_ = std::make_shared<rclcpp::Node>("moveit_servo_test");
57
58 // Create a Servo object for testing.
59 const std::string servo_param_namespace = "moveit_servo_test";
60 servo_param_listener_ = std::make_shared<servo::ParamListener>(servo_test_node_, servo_param_namespace);
62
64
66 std::make_shared<moveit_servo::Servo>(servo_test_node_, servo_param_listener_, planning_scene_monitor_);
67 }
68
70 Eigen::Isometry3d getCurrentPose(const std::string& target_frame) const
71 {
72 return planning_scene_monitor_->getStateMonitor()->getCurrentState()->getGlobalLinkTransform(target_frame);
73 }
74
75 std::shared_ptr<rclcpp::Node> servo_test_node_;
76 std::shared_ptr<const servo::ParamListener> servo_param_listener_;
77 servo::Params servo_params_;
78 std::shared_ptr<moveit_servo::Servo> servo_test_instance_;
79 planning_scene_monitor::PlanningSceneMonitorPtr planning_scene_monitor_;
80};
Eigen::Isometry3d getCurrentPose(const std::string &target_frame) const
Helper function to get the current pose of a specified frame.
std::shared_ptr< rclcpp::Node > servo_test_node_
std::shared_ptr< const servo::ParamListener > servo_param_listener_
servo::Params servo_params_
void SetUp() override
std::shared_ptr< moveit_servo::Servo > servo_test_instance_
planning_scene_monitor::PlanningSceneMonitorPtr planning_scene_monitor_
planning_scene_monitor::PlanningSceneMonitorPtr createPlanningSceneMonitor(const rclcpp::Node::SharedPtr &node, const servo::Params &servo_params)
Creates the planning scene monitor used by servo.
Definition common.cpp:480