8 #include <dynamic-graph/all-commands.h>
9 #include <dynamic-graph/factory.h>
11 #include <sot/core/debug.hh>
12 #include <sot/core/stop-watch.hh>
21 namespace talos_balance {
24 using namespace dynamicgraph::command;
25 using namespace dg::sot::talos_balance;
27 #define INPUT_SIGNALS m_dummySIN
28 #define OUTPUT_SIGNALS
41 : Entity(
name), CONSTRUCT_SIGNAL_IN(dummy, double), m_initSucceeded(false) {
46 docCommandVoid0(
"Initialize the entity.")));
48 addCommand(
"registerRigidBody",
50 docCommandVoid1(
"Register a rigid body",
51 "Name of the rigid body")));
55 docCommandVoid1(
"Set IP adress of the Mocap server",
56 "IP adress string")));
61 docCommandVoid0(
"Displays the list of rigid bodies "
62 "streamed by the mocap server")));
89 Vector7d initRBposition;
90 initRBposition << RBidx, 0, 0, 0, 0, 0, 0;
92 dg::SignalTimeDependent<dg::Vector, int>* sig;
93 sig =
new dg::SignalTimeDependent<dg::Vector, int>(
96 getClassName() +
"(" + getName() +
97 ")::output(dynamicgraph::Vector)::xyzquat_" + RBname);
99 signalRegistration(*sig);
114 if (res.size() != 7) {
125 const unsigned short basePort = 22222;
126 const int majorVersion = 1;
127 const int minorVersion = 19;
128 const bool bigEndian =
false;
129 bool dataAvailable =
false;
130 bool streamFrames =
false;
131 unsigned short udpPort = 6734;
136 majorVersion, minorVersion, bigEndian)) {
137 printf(
"rtProtocol.Connect: %s\n\n", rtProtocol.
GetErrorString());
143 if (!dataAvailable) {
145 printf(
"rtProtocol.Read6DOFSettings: %s\n\n",
155 printf(
"rtProtocol.StreamFrames: %s\n\n", rtProtocol.
GetErrorString());
165 float rotationMatrix[9];
171 if (rtPacket->
Get6DOFBody(i, fX, fY, fZ, rotationMatrix)) {
172 Eigen::Matrix3f rotMat =
173 Eigen::Map<Eigen::Matrix3f>(rotationMatrix);
174 Eigen::Quaternionf quat(rotMat);
177 SEND_MSG(
" - " + toString(pTmpStr), MSG_TYPE_INFO);
178 std::cout << (
" - " + toString(pTmpStr) +
"\n");
183 std::vector<std::string>::iterator it =
187 m_RBpositions[idx] << fX, fY, fZ, quat.w(), quat.x(), quat.y(),
208 os <<
"QualisysClient " << getName();
210 getProfiler().report_all(3, os);
211 }
catch (ExceptionSignal e) {