Data Sheet
// header.fromId tells us from which TransducerM the data comes.
switch (header.cmd) { // Step 3.2: header.cmd tells what kind of data is inside the payload.
case EP_CMD_ACK_:{ // We can use a switch() as demonstrated here to do different
Ep_Ack ep_Ack; // tasks for different types of data.
if(EP_SUCC_ == eOD.Read_Ep_Ack(&ep_Ack)){
}
}break;
case EP_CMD_Q_S1_E_:{
Ep_Q_s1_e ep_Q_s1_e;
if(EP_SUCC_ == eOD.Read_Ep_Q_s1_e(&ep_Q_s1_e)){ // Step 3.3: If we decided that the received Quaternion should be used,
// Here is an example of how to access the Quaternion data.
float q1 = ep_Q_s1_e.q[0];
float q2 = ep_Q_s1_e.q[1];
float q3 = ep_Q_s1_e.q[2];
float q4 = ep_Q_s1_e.q[3];
uint32 timeStamp = ep_Q_s1_e.timeStamp; // TimeStamp indicates the time point (since the TransducerM powers on),
// when this particular set of Quaternion was calculated. (Unit: uS)
// Note that overflow will occur when the uint32 type reaches its maximum value.
uint32 deviceId = ep_Q_s1_e.header.fromId; // The ID indicates the device Short ID telling which TransducerM the data comes from.
/// @todo Use data here:
/// ...
}
}break;
case EP_CMD_RPY_:{
Ep_RPY ep_RPY;
if(EP_SUCC_ == eOD.Read_Ep_RPY(&ep_RPY)){ // Another Example reading of the received Roll Pitch and Yaw
float roll = ep_RPY.roll;
float pitch = ep_RPY.pitch;
float yaw = ep_RPY.yaw;
/// @todo Use data here:
/// ...
}break;
}
}
}
It is worth to mention that the communication library automatically assembles the income data into complete data
packages and verifies them; only valid reading from the TransducerM is exposed to the user application.
C Library (Basic API)
SYD Dynamics also provides simplified C language version communication library in source code, which should come along
in zip format file together with the C++ library or can be exported from the ImuAssistant GUI (refer to section ‘Export
Communication Library’ on page 19).
The C library is useful when the target system only supports C language compiler or is extremely sensitive to processing speed
and memory resource. An example is, if your target system is an 8-bit C51 microprocessor with only hundreds of RAM bytes,
the C library would likely to fit. For all the other mainstream microprocessors, embedded Linux systems and so on, the C++
library fits and performs efficiently.
IMPORTANT: If your system supports C++ compiler, we strongly recommend the C++ library mentioned in the
previous section. The C library, while having all the basic functionalists communicating with TransducerM, it
does not support Mutex protection and thus is overall less reliable. It also adds difficulties for communication
library upgradation whenever new APIs are released since the code is not Object Oriented.
Copyright © 2015-2019 SYD Dynamics ApS | www.syd-dynamics.com Page 23 / 33