23 #include <linux/videodev2.h>
117 { itsIMU = addSubComponent<jevois::ICM20948>(
"imu"); }
136 memcpy(outimg.
pixelsw<
void>(), inimg.
pixels<
void>(), std::min(inimg.
buf->length(), outimg.
buf->length()));
145 jevois::sformat(
"Accel: x=%+06.2fg y=%+06.2fg z=%+06.2fg Magn: %+09.2fuT %+09.2fuT %+09.2fuT",
147 3,
h + 3, jevois::yuyv::White);
150 jevois::sformat(
"Gyro: x=%+07.1fdps y=%+07.1fdps z=%+07.1fdps Temp: %05.1fC %s",
152 3,
h + 15, jevois::yuyv::White);
154 itsIMUdata.push_front(d);
157 while (itsIMU->dataReady() > 32) itsIMUdata.push_front(itsIMU->get());
160 while (itsIMUdata.size() >
w/2) itsIMUdata.pop_back();
163 float const hh =
h * 0.5F;
int x =
w - 1;
165 float const a = -afac::get();
float const g = -gfac::get();
float const m = -mfac::get();
209 unsigned short winw, winh;
213 int x = 0, y = 0;
unsigned short iw = 0, ih = 0;
215 helper.
itext(
"JeVois-Pro Inertial Measurement Unit (IMU)");
225 "Magn: %+09.2fuT %+09.2fuT %+09.2fuT",
231 itsIMUdata.push_front(d);
234 while (itsIMU->dataReady() > 32) itsIMUdata.push_front(itsIMU->get());
237 int const count = 300;
238 while (itsIMUdata.size() > count) itsIMUdata.pop_back();
240 float ax[count] = {}, ay[count] = {}, az[count] = {};
241 float gx[count] = {}, gy[count] = {}, gz[count] = {};
242 float mx[count] = {}, my[count] = {}, mz[count] = {};
245 float const a = -afac::get();
float const g = -gfac::get();
float const m = -mfac::get();
249 if (a) { ax[i] = dd.ax() * a; ay[i] = dd.ay() * a; az[i] = dd.az() * a; }
250 if (g) { gx[i] = dd.gx() * g; gy[i] = dd.gy() * g; gz[i] = dd.gz() * g; }
251 if (m) { mx[i] = dd.mx() * m; my[i] = dd.my() * m; mz[i] = dd.mz() * m; }
256 if (ImGui::Begin(
"IMU data"))
258 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 10.0
F);
259 ImGui::Text(
"Acceleration X, Y, Z:");
260 ImGui::PlotLines(
"##AccelX", ax, count, 0,
"Accel X", -100, 100);
261 ImGui::PlotLines(
"##AccelY", ay, count, 0,
"Accel Y", -100, 100);
262 ImGui::PlotLines(
"##AccelZ", az, count, 0,
"Accel Z", -100, 100);
264 ImGui::Text(
"Gyroscope X, Y, Z:");
265 ImGui::PlotLines(
"##GyroX", gx, count, 0,
"Gyro X", -100, 100);
266 ImGui::PlotLines(
"##GyroY", gy, count, 0,
"Gyro Y", -100, 100);
267 ImGui::PlotLines(
"##GyroZ", gz, count, 0,
"Gyro Z", -100, 100);
269 ImGui::Text(
"Magnetometer X, Y, Z:");
270 ImGui::PlotLines(
"##MagnX", mx, count, 0,
"Magn X", -100, 100);
271 ImGui::PlotLines(
"##MagnY", my, count, 0,
"Magn Y", -100, 100);
272 ImGui::PlotLines(
"##MagnZ", mz, count, 0,
"Magn Z", -100, 100);
273 ImGui::PopItemWidth();
278 std::string
const & fpscpu = timer.stop();
279 helper.
iinfo(inframe, fpscpu, winw, winh);
287 std::shared_ptr<jevois::ICM20948> itsIMU;
288 std::list<jevois::IMUdata> itsIMUdata;