grasp_generator.cpp
Go to the documentation of this file.
00001 #include <gtest/gtest.h>
00002 #include <iri_wam_common_msgs/SimpleBhandPickUpAction.h>
00003 #include "../../include/grasp_generator.h"
00004 #include "geometry_test_helpers.h"
00005 
00006 using namespace geometry_test_helpers;
00007 
00008 class GraspGeneratorEnvTest : public ::testing::Test
00009 {
00010     protected:
00011         iri_wam_common_msgs::SimpleBhandPickUpGoal empty_goal_;
00012         iri_wam_common_msgs::SimpleBhandPickUpGoal unitary_goal_;
00013         GraspGenerator generator_;
00014 
00015 
00016         virtual void SetUp()
00017         {
00018             unitary_goal_.grasp_pose.pose    = generator::generate_fixed_pose(1);
00019             unitary_goal_.pre_grasp_modifier = generator::generate_fixed_pose(1);
00020         }
00021 };
00022 
00023 TEST_F(GraspGeneratorEnvTest, number_of_phases)
00024 {
00025     ASSERT_EQ(5, generator_.generate(empty_goal_).size());
00026 }
00027 
00028 TEST_F(GraspGeneratorEnvTest, pre_grasp_check)
00029 {
00030     geometry_msgs::PoseStamped pose_generated;
00031     geometry_msgs::PoseStamped pre_grasp_expected;
00032 
00033     pre_grasp_expected.pose.position.x = 0;
00034     pre_grasp_expected.pose.position.y = 2;
00035     pre_grasp_expected.pose.position.z = 0;
00036     pre_grasp_expected.pose.orientation.x = 0;
00037     pre_grasp_expected.pose.orientation.y = 0;
00038     pre_grasp_expected.pose.orientation.z = 0;
00039     pre_grasp_expected.pose.orientation.w = 1;
00040 
00041     GraspPhaseSequence sequence = generator_.generate(unitary_goal_);
00042     pose_generated = static_cast<GraspPhaseMoveArm *>(sequence[0].get())->pose_;
00043 
00044     ASSERT_TRUE(comparison::poses_stamped_are_equal(pre_grasp_expected, pose_generated));
00045 }
00046 
00047 // Run all the tests that were declared with TEST()
00048 int main(int argc, char **argv)
00049 {
00050     testing::InitGoogleTest(&argc, argv);
00051     return RUN_ALL_TESTS();
00052 }


iri_grasp_actions
Author(s): pmonso
autogenerated on Fri Dec 6 2013 20:14:56