moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
chomp_moveit_test_panda.cpp
Go to the documentation of this file.
1/*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2024, Sherbrooke University
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 Willow Garage 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
36
37#include <ros/ros.h>
38#include <gtest/gtest.h>
39
42
54
55// TEST CASES
56
57// https://github.com/moveit/moveit/issues/2542
58TEST_F(CHOMPMoveitTest, jointSpaceGoodGoal)
59{
60 move_group_.setStartState(*(move_group_.getCurrentState()));
61 move_group_.setJointValueTarget(std::vector<double>({ 0.0, 0.0 }));
62 move_group_.setPlanningTime(5.0);
63
64 moveit::core::MoveItErrorCode error_code = move_group_.plan(my_plan_);
65 EXPECT_GT(my_plan_.trajectory_.joint_trajectory.points.size(), 0u);
66 EXPECT_EQ(error_code.val, moveit::core::MoveItErrorCode::SUCCESS);
67}
68
69int main(int argc, char** argv)
70{
71 testing::InitGoogleTest(&argc, argv);
72 ros::init(argc, argv, "chomp_moveit_test_panda");
73
74 ros::AsyncSpinner spinner(1);
75 spinner.start();
76 int ret = RUN_ALL_TESTS();
77 spinner.stop();
78 ros::shutdown();
79 return ret;
80}
int main(int argc, char **argv)
TEST_F(CHOMPMoveitTest, jointSpaceGoodGoal)
moveit::planning_interface::MoveGroupInterface::Plan my_plan_
moveit::planning_interface::MoveGroupInterface move_group_
a wrapper around moveit_msgs::MoveItErrorCodes to make it easier to return an error code message from...
Client class to conveniently use the ROS interfaces provided by the move_group node.
void setStartState(const moveit_msgs::msg::RobotState &start_state)
If a different start state should be considered instead of the current state of the robot,...
The representation of a motion plan (as ROS messages)