6 #include <ram_msgs/AdditiveManufacturingTrajectory.h> 8 #include <ram_modify_trajectory/GetPosesFromTrajectory.h> 9 #include <ram_modify_trajectory/GetPosesFromLayersList.h> 10 #include <ram_modify_trajectory/GetPosesFromLayer.h> 12 #include <gtest/gtest.h> 14 std::unique_ptr<ros::NodeHandle>
nh;
23 TEST(TestSuite, testSrvsExistence)
25 get_poses_from_trajectory_client =
nh->serviceClient<ram_modify_trajectory::GetPosesFromTrajectory>(
26 "ram/pose_selector/get_poses_from_trajectory");
28 EXPECT_TRUE(exists_4);
30 get_poses_from_layers_list_client =
nh->serviceClient<ram_modify_trajectory::GetPosesFromLayersList>(
31 "ram/pose_selector/get_poses_from_layers_list");
33 EXPECT_TRUE(exists_5);
35 get_poses_from_layer_client =
nh->serviceClient<ram_modify_trajectory::GetPosesFromLayer>(
36 "ram/pose_selector/get_poses_from_layer");
38 EXPECT_TRUE(exists_6);
41 TEST(TestSuite, selectPosesInEmptyTrajectory)
50 ram_modify_trajectory::GetPosesFromTrajectory get_poses_from_trajectory_srv;
51 bool success_4(get_poses_from_trajectory_client.
call(get_poses_from_trajectory_srv));
52 EXPECT_FALSE(success_4);
54 ram_modify_trajectory::GetPosesFromLayersList get_poses_from_layers_list_srv;
55 bool success_5(get_poses_from_layers_list_client.
call(get_poses_from_layers_list_srv));
56 EXPECT_FALSE(success_5);
58 ram_modify_trajectory::GetPosesFromLayer get_poses_from_layer_srv;
59 bool success_6(get_poses_from_layer_client.
call(get_poses_from_layer_srv));
60 EXPECT_FALSE(success_6);
63 TEST(TestSuite, getPosesFromTrajectory)
67 for (
int i(0); i < 3; ++i)
69 for (
int j(0); j <= i; ++j)
71 ram_msgs::AdditiveManufacturingPose pose;
82 ram_modify_trajectory::GetPosesFromTrajectory srv;
83 srv.request.pose_index_list =
85 bool success(get_poses_from_trajectory_client.
call(srv));
88 for (
unsigned i(0); i < srv.request.pose_index_list.size(); ++i)
93 if (trajectory_id.compare(response_id) != 0)
99 EXPECT_TRUE(success && response);
102 TEST(TestSuite, getPosesFromLayersList)
106 for (
int i(0); i < 3; ++i)
108 for (
int j(0); j <= i; ++j)
110 ram_msgs::AdditiveManufacturingPose pose;
111 pose.layer_level = i;
121 ram_modify_trajectory::GetPosesFromLayersList srv;
122 srv.request.layer_level_list =
124 bool success(get_poses_from_layers_list_client.
call(srv));
126 bool response =
true;
127 for (
unsigned i(0); i < 3; ++i)
132 if (trajectory_id.compare(response_id) != 0)
138 EXPECT_TRUE(success && response);
141 TEST(TestSuite, getPosesFromLayer)
143 ram_modify_trajectory::GetPosesFromLayer srv;
144 srv.request.layer_level = 2;
145 srv.request.index_list_relative =
147 bool success(get_poses_from_layer_client.
call(srv));
152 bool response = (trajectory_id.compare(response_id) == 0) ?
true :
false;
153 EXPECT_TRUE(success && response);
156 TEST(TestSuite, trajectoryWithEmptyLayer)
161 for (
int i(0); i < 4; ++i)
165 for (
int j(0); j < 4; ++j)
167 ram_msgs::AdditiveManufacturingPose pose;
168 pose.layer_level = i;
179 ram_modify_trajectory::GetPosesFromLayersList srv;
180 srv.request.layer_level_list =
182 bool success(get_poses_from_layers_list_client.
call(srv));
183 bool response = (srv.response.poses.size() == 0) ?
true :
false;
184 EXPECT_TRUE(success && response);
190 ros::init(argc, argv,
"modify_trajectory_test");
193 test_trajectory_pub =
nh->advertise<ram_msgs::AdditiveManufacturingTrajectory>(
"ram/trajectory", 5,
true);
202 testing::InitGoogleTest(&argc, argv);
203 return RUN_ALL_TESTS();
static boost::uuids::uuid fromRandom(void)
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
ros::ServiceClient get_poses_from_layers_list_client
std::unique_ptr< ros::NodeHandle > nh
int main(int argc, char **argv)
bool waitForExistence(ros::Duration timeout=ros::Duration(-1))
ros::Publisher test_trajectory_pub
static std::string toHexString(boost::uuids::uuid const &uu)
#define ROS_WARN_STREAM_THROTTLE(rate, args)
uint32_t getNumSubscribers() const
ros::ServiceClient get_poses_from_layer_client
TEST(TestSuite, testSrvsExistence)
static uuid_msgs::UniqueID toMsg(boost::uuids::uuid const &uu)
std::string getTopic() const
ram_msgs::AdditiveManufacturingTrajectory trajectory
ros::ServiceClient get_poses_from_trajectory_client