3 #include <gtest/gtest.h> 8 #include "hebiros/AddModelFromURDFSrv.h" 9 #include "hebiros/ModelFkSrv.h" 21 "/hebiros/add_model_from_urdf");
23 hebiros::AddModelFromURDFSrv add_model_srv;
26 add_model_srv.request.description_param =
"6_dof_robot_description";
28 add_model_client.
call(add_model_srv);
41 std::vector<size_t> ignored_frames = { 0, 1, 4, 7, 10, 13, 16 };
42 auto search_start = ignored_frames.begin();
43 size_t matlab_frame = 0;
46 while (matlab_frame < 11 && ros_frame < 17) {
47 auto found = std::find(search_start, ignored_frames.end(), ros_frame);
48 if (found != ignored_frames.end()) {
55 for (
size_t i = 0; i < 3; ++i)
56 for (
size_t j = 0; j < 3; ++j)
57 ASSERT_NEAR(matlab[matlab_frame*16 + i*4 + j], ros[ros_frame*16 + j*4 + i], 0.001);
84 std::string(
"/hebiros/") +
model_name + std::string(
"/fk"));
86 hebiros::ModelFkSrv model_fk_srv;
92 model_fk_srv.request.positions[i] = 0;
93 model_fk_srv.request.frame_type = hebiros::ModelFkSrv::Request::FrameTypeOutput;
94 ASSERT_TRUE(model_fk_client.
call(model_fk_srv));
96 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0.0451, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0,-1, 0, 0, 0,-0.0375, 0.11, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0,-1, 0, 0, 0,-0.0826, 0.11, 1, 1, 0, 0, 0, 0, 0,-1, 0, 0, 1, 0, 0, 0.3250,-0.0826, 0.11, 1, 1, 0, 0, 0, 0, 0,-1, 0, 0, 1, 0, 0, 0.3250,-0.0375, 0.11, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0,-1, 0, 0, 0.6500,-0.0375, 0.11, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0,-1, 0, 0, 0.6500,-0.0685, 0.11, 1, 1, 0, 0, 0, 0,-1, 0, 0, 0, 0,-1, 0, 0.6500,-0.1086, 0.0571, 1, 1, 0, 0, 0, 0,-1, 0, 0, 0, 0,-1, 0, 0.6500,-0.1086, 0.0261, 1, 1, 0, 0, 0, 0, 0,-1, 0, 0, 1, 0, 0, 0.6500,-0.0656,-0.01, 1, 1, 0, 0, 0, 0, 0,-1, 0, 0, 1, 0, 0, 0.6500,-0.0345,-0.01, 1 };
100 model_fk_srv.request.positions = {.325, 12.22, 42.4, .033, .2352, 31.34};
101 ASSERT_TRUE(model_fk_client.
call(model_fk_srv));
103 0.9477, 0.3193, 0, 0,-0.3193, 0.9477, 0, 0, 0, 0, 1, 0, 0, 0, 0.0451, 1, 0.9477, 0.3193, 0, 0,-0, 0, 1, 0, 0.3193,-0.9477, 0, 0, 0.0120,-0.0355, 0.1001, 1, 0.8914, 0.3003,-0.3395, 0, 0.3217, 0.1084, 0.9406, 0, 0.3193,-0.9477, 0, 0, 0.0264,-0.0783, 0.1001, 1, 0.8914, 0.3003,-0.3395, 0,-0.3217,-0.1084,-0.9406, 0,-0.3193, 0.9477,-0, 0, 0.3161, 0.0193,-0.0102, 1, 0.3114, 0.1049, 0.9445, 0, 0.8950, 0.3016,-0.3286, 0,-0.3193, 0.9477,-0, 0, 0.3017, 0.0621,-0.0102, 1, 0.3114, 0.1049, 0.9445, 0,-0.8950,-0.3016, 0.3286, 0, 0.3193,-0.9477, 0, 0, 0.4029, 0.0962, 0.2967, 1, 0.2817, 0.0949, 0.9548, 0,-0.9048,-0.3049, 0.2973, 0, 0.3193,-0.9477, 0, 0, 0.4128, 0.0668, 0.2967, 1, 0.2817, 0.0949, 0.9548, 0, 0.3193,-0.9477, 0, 0, 0.9048, 0.3049,-0.2973, 0, 0.4645, 0.0420, 0.2839, 1, 0.3484,-0.1285, 0.9285, 0, 0.2449,-0.9437,-0.2225, 0, 0.9048, 0.3049,-0.2973, 0, 0.4926, 0.0514, 0.2747, 1, 0.3484,-0.1285, 0.9285, 0, 0.9048, 0.3049,-0.2973, 0,-0.2449, 0.9437, 0.2225, 0, 0.5182, 0.1042, 0.2724, 1, 0.2788,-0.1513, 0.9484, 0, 0.9286, 0.2942,-0.2260, 0,-0.2449, 0.9437, 0.2225, 0, 0.5106, 0.1335, 0.2793, 1 };
107 int main(
int argc,
char** argv) {
108 ros::init(argc, argv,
"FKTests6DOFNode");
110 testing::InitGoogleTest(&argc, argv);
118 auto res = RUN_ALL_TESTS();
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
void CompareResults(double *matlab, double *ros)
TEST_F(FKTests6DOF, GetOutputFrames)
ROSCPP_DECL void spin(Spinner &spinner)
static const std::string model_name
ROSCPP_DECL void shutdown()