18 #ifndef _JOINT_TEST_HH_
19 #define _JOINT_TEST_HH_
24 #include "test/ServerFixture.hh"
27 #include "gazebo/physics/physics.hh"
29 using namespace gazebo;
31 typedef std::tr1::tuple<const char *, const char *>
std_string2;
34 public ::testing::WithParamInterface<std_string2>
43 public:
void ForceTorque1(
const std::string &_physicsEngine);
51 public:
void ForceTorque2(
const std::string &_physicsEngine);
57 public:
void GetForceTorqueWithAppliedForce(
58 const std::string &_physicsEngine);
63 public:
void JointTorqueTest(
const std::string &_physicsEngine);
67 public:
void JointCreationDestructionTest(
const std::string &_physicsEngine);
69 public:
virtual void SetUp()
71 const ::testing::TestInfo *
const test_info =
72 ::testing::UnitTest::GetInstance()->current_test_info();
73 if (test_info->value_param())
75 gzdbg <<
"Params: " << test_info->value_param() << std::endl;
76 this->physicsEngine = std::tr1::get<0>(GetParam());
77 this->jointType = std::tr1::get<1>(GetParam());
84 public:
void SpawnJointTypes(
const std::string &_physicsEngine,
85 const std::string &_jointType);
91 public:
void SpawnJointRotational(
const std::string &_physicsEngine,
92 const std::string &_jointType);
98 public:
void SpawnJointRotationalWorld(
const std::string &_physicsEngine,
99 const std::string &_jointType);
106 wait(common::Time(99, 0)),
107 noLinkPose(false), axis(math::Vector3(1, 0, 0))
159 bool _worldChild =
false,
160 bool _worldParent =
false,
168 return SpawnJoint(opt);
180 std::ostringstream modelStr;
181 std::ostringstream modelName;
182 modelName <<
"joint_model" << this->spawnCount++;
185 <<
"<sdf version='" << SDF_VERSION <<
"'>"
186 <<
"<model name ='" << modelName.str() <<
"'>"
187 <<
" <pose>" << _opt.
modelPose <<
"</pose>";
190 modelStr <<
" <link name='parent'>";
195 modelStr <<
" </link>";
199 modelStr <<
" <link name='child'>";
204 modelStr <<
" </link>";
207 <<
" <joint name='joint' type='" << _opt.
type <<
"'>"
208 <<
" <pose>" << _opt.
jointPose <<
"</pose>";
210 modelStr <<
" <parent>world</parent>";
212 modelStr <<
" <parent>parent</parent>";
214 modelStr <<
" <child>world</child>";
216 modelStr <<
" <child>child</child>";
219 <<
" <xyz>" << _opt.
axis <<
"</xyz>"
225 msg.set_sdf(modelStr.str());
226 this->factoryPub->Publish(msg);
232 unsigned int waitCount = 0;
234 !this->HasEntity(modelName.str()))
237 if (++waitCount % 10 == 0)
239 gzwarn <<
"Waiting " << waitCount / 10 <<
" seconds for "
240 << _opt.
type <<
" joint to spawn." << std::endl;
243 if (this->HasEntity(modelName.str()) && waitCount >= 10)
244 gzwarn << _opt.
type <<
" joint has spawned." << std::endl;
251 joint = model->GetJoint(
"joint");
264 private:
unsigned int spawnCount;