-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathembot_app_application_theIMU.cpp
729 lines (549 loc) · 23.4 KB
/
embot_app_application_theIMU.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
/*
* Copyright (C) 2017 iCub Facility - Istituto Italiano di Tecnologia
* Author: Marco Accame
* email: marco.accame@iit.it
* website: www.robotcub.org
* Permission is granted to copy, distribute, and/or modify this program
* under the terms of the GNU General Public License, version 2 or any
* later version published by the Free Software Foundation.
*
* A copy of the license can be found at
* http://www.robotcub.org/icub/license/gpl.txt
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details
*/
// --------------------------------------------------------------------------------------------------------------------
// - public interface
// --------------------------------------------------------------------------------------------------------------------
#include "embot_app_application_theIMU.h"
// --------------------------------------------------------------------------------------------------------------------
// - external dependencies
// --------------------------------------------------------------------------------------------------------------------
#include "embot_core.h"
#include "embot_core_binary.h"
#include <new>
#include "embot_os_Timer.h"
#include "embot_os_Action.h"
#include "embot_hw.h"
#include "embot_prot_can.h"
#include "embot_prot_can_inertial_periodic.h"
#include <cstdio>
#include "embot_app_theCANboardInfo.h"
#include "embot_app_application_theCANtracer.h"
#include "embot_core.h"
#include "embot_hw_bno055.h"
//#include "embot_hw_bsp_strain2.h"
// --------------------------------------------------------------------------------------------------------------------
// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++
// --------------------------------------------------------------------------------------------------------------------
struct embot::app::application::theIMU::Impl
{
struct canLegacyConfig
{
embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::Info accgyroinfo;
bool accelEnabled;
bool gyrosEnabled;
canLegacyConfig() { reset(); }
void reset()
{
accgyroinfo.maskoftypes = 0;
accgyroinfo.txperiod = 50*embot::core::time1millisec;
accelEnabled = false;
gyrosEnabled = false;
}
};
struct canRevisitedConfig
{
embot::prot::can::analog::polling::Message_IMU_CONFIG_SET::Info imuinfo;
embot::core::relTime txperiod;
canRevisitedConfig() { reset(); }
void reset()
{
counter = 0;
imuinfo.sensormask = 0;
txperiod = 50*embot::core::time1millisec;
}
std::uint8_t counter;
};
struct imuAcquisition
{
embot::core::relTime duration;
embot::core::Time timeofstart;
bool dataisready;
embot::hw::bno055::Data data;
imuAcquisition() { reset(); }
void reset()
{
duration = 0;
timeofstart = 0;
dataisready = false;
data.clear();
}
void onstart()
{
timeofstart = embot::core::now();
duration = 0;
dataisready = false;
data.clear();
}
void onstop()
{
dataisready = true;
duration = embot::core::now() - timeofstart;
}
};
Config config;
bool ticking;
embot::os::Timer *ticktimer;
embot::os::Action action;
imuAcquisition imuacquisition;
bool legacymode; // if true we work with the old protocol mode.
canLegacyConfig canlegacyconfig;
canRevisitedConfig canrevisitedconfig;
Impl()
{
ticking = false;
ticktimer = new embot::os::Timer;
legacymode = true;
canlegacyconfig.reset();
imuacquisition.reset();
}
bool start();
bool stop();
bool tick(std::vector<embot::prot::can::Frame> &replies);
bool processdata(std::vector<embot::prot::can::Frame> &replies);
bool fill(embot::prot::can::inertial::periodic::Message_DIGITAL_ACCELEROMETER::Info &info);
bool fill(embot::prot::can::inertial::periodic::Message_DIGITAL_GYROSCOPE::Info &info);
bool fill(embot::prot::can::inertial::periodic::Message_IMU_TRIPLE::Info &info);
// imu support
bool acquisition_start();
bool acquisition_retrieve();
bool acquisition_processing();
static void alertdataisready(void *p)
{
embot::app::application::theIMU::Impl *mypImpl = reinterpret_cast<embot::app::application::theIMU::Impl*>(p);
if(true == mypImpl->ticking)
{
mypImpl->config.totask->setEvent(mypImpl->config.datareadyevent);
}
mypImpl->imuacquisition.onstop();
}
};
bool embot::app::application::theIMU::Impl::start()
{
if(true == legacymode)
{
embot::os::Timer::Config cfg(canlegacyconfig.accgyroinfo.txperiod, action, embot::os::Timer::Mode::forever);
ticktimer->start(cfg);
ticking = true;
return true;
}
else
{
canrevisitedconfig.counter = 0;
embot::os::Timer::Config cfg(canrevisitedconfig.txperiod, action, embot::os::Timer::Mode::forever);
constexpr bool forcerestart {true};
ticktimer->start(cfg, forcerestart);
ticking = true;
return true;
}
}
bool embot::app::application::theIMU::Impl::stop()
{
ticktimer->stop();
ticking = false;
return true;
}
bool embot::app::application::theIMU::Impl::fill(embot::prot::can::inertial::periodic::Message_DIGITAL_ACCELEROMETER::Info &info)
{
bool ret = true;
info.canaddress = embot::app::theCANboardInfo::getInstance().cachedCANaddress();
info.x = imuacquisition.data.acc.x;
info.y = imuacquisition.data.acc.y;
info.z = imuacquisition.data.acc.z;
return ret;
}
bool embot::app::application::theIMU::Impl::fill(embot::prot::can::inertial::periodic::Message_DIGITAL_GYROSCOPE::Info &info)
{
bool ret = true;
info.canaddress = embot::app::theCANboardInfo::getInstance().cachedCANaddress();
info.x = imuacquisition.data.gyr.x;
info.y = imuacquisition.data.gyr.y;
info.z = imuacquisition.data.gyr.z;
return ret;
}
bool embot::app::application::theIMU::Impl::fill(embot::prot::can::inertial::periodic::Message_IMU_TRIPLE::Info &info)
{
bool ret = true;
info.canaddress = embot::app::theCANboardInfo::getInstance().cachedCANaddress();
switch(info.sensor)
{
case embot::prot::can::analog::imuSensor::acc:
{
info.value = imuacquisition.data.acc;
} break;
case embot::prot::can::analog::imuSensor::gyr:
{
info.value = imuacquisition.data.gyr;
} break;
default:
{
info.value.clear();
} break;
}
return ret;
}
bool embot::app::application::theIMU::Impl::tick(std::vector<embot::prot::can::Frame> &replies)
{
if(false == ticking)
{
return false;
}
if(true == legacymode)
{
if(0 == canlegacyconfig.accgyroinfo.maskoftypes)
{
return false;
}
}
else // new mode
{
if(0 == canrevisitedconfig.imuinfo.sensormask)
{
return false;
}
}
// start acquisition
acquisition_start();
return true;
}
bool embot::app::application::theIMU::Impl::processdata(std::vector<embot::prot::can::Frame> &replies)
{
if(false == ticking)
{
return false;
}
// retrieve acquired imu values
acquisition_retrieve();
// processing of acquired data
acquisition_processing();
// we are ready to transmit
embot::prot::can::Frame frame;
if(true == legacymode)
{
if(true == canlegacyconfig.accelEnabled)
{
embot::prot::can::inertial::periodic::Message_DIGITAL_ACCELEROMETER msg;
embot::prot::can::inertial::periodic::Message_DIGITAL_ACCELEROMETER::Info accelinfo;
if(true == fill(accelinfo))
{
msg.load(accelinfo);
msg.get(frame);
replies.push_back(frame);
}
}
if(true == canlegacyconfig.gyrosEnabled)
{
embot::prot::can::inertial::periodic::Message_DIGITAL_GYROSCOPE msg;
embot::prot::can::inertial::periodic::Message_DIGITAL_GYROSCOPE::Info gyrosinfo;
if(true == fill(gyrosinfo))
{
msg.load(gyrosinfo);
msg.get(frame);
replies.push_back(frame);
}
}
}
else
{
canrevisitedconfig.counter++;
embot::prot::can::inertial::periodic::Message_IMU_TRIPLE msg;
embot::prot::can::inertial::periodic::Message_IMU_TRIPLE::Info info;
info.canaddress = embot::app::theCANboardInfo::getInstance().cachedCANaddress();
info.seqnumber = canrevisitedconfig.counter;
// evaluate what to tx
if(true == canrevisitedconfig.imuinfo.enabled(embot::prot::can::analog::imuSensor::acc))
{
// generate a acc message with canrevisitedconfig.imuinfo.counter
info.sensor = embot::prot::can::analog::imuSensor::acc;
info.value = imuacquisition.data.acc;
msg.load(info);
msg.get(frame);
replies.push_back(frame);
}
if(true == canrevisitedconfig.imuinfo.enabled(embot::prot::can::analog::imuSensor::mag))
{
// generate a mag message with canrevisitedconfig.counter
info.sensor = embot::prot::can::analog::imuSensor::mag;
info.value = imuacquisition.data.mag;
msg.load(info);
msg.get(frame);
replies.push_back(frame);
}
if(true == canrevisitedconfig.imuinfo.enabled(embot::prot::can::analog::imuSensor::gyr))
{
// generate a gyr message with canrevisitedconfig.counter
info.sensor = embot::prot::can::analog::imuSensor::gyr;
info.value = imuacquisition.data.gyr;
msg.load(info);
msg.get(frame);
replies.push_back(frame);
}
if(true == canrevisitedconfig.imuinfo.enabled(embot::prot::can::analog::imuSensor::eul))
{
// generate a eul message with canrevisitedconfig.counter
info.sensor = embot::prot::can::analog::imuSensor::eul;
// remapping of the axis to have IMU and FT frames parallel, neglecting non-inertial corrections, see this github issue:
// https://github.com/icub-tech-iit/fix/issues/780 + https://github.com/icub-tech-iit/task-force-miscellanea/issues/126
// The Bosch euler representation can be either the windows(default) or android, but in YARP
// we have a different representation(see https://github.com/robotology/yarp/blob/0481f994c6e03897d038c5f1d1078145646a1772/src/libYARP_dev/src/yarp/dev/MultipleAnalogSensorsInterfaces.h#L302-L348)
info.value.x = imuacquisition.data.eul.z;
info.value.y = -imuacquisition.data.eul.y;
info.value.z = imuacquisition.data.eul.x;
msg.load(info);
msg.get(frame);
replies.push_back(frame);
}
if(true == canrevisitedconfig.imuinfo.enabled(embot::prot::can::analog::imuSensor::lia))
{
// generate a lia message with canrevisitedconfig.counter
info.sensor = embot::prot::can::analog::imuSensor::lia;
info.value = imuacquisition.data.lia;
msg.load(info);
msg.get(frame);
replies.push_back(frame);
}
if(true == canrevisitedconfig.imuinfo.enabled(embot::prot::can::analog::imuSensor::grv))
{
info.sensor = embot::prot::can::analog::imuSensor::grv;
info.value = imuacquisition.data.grv;
msg.load(info);
msg.get(frame);
replies.push_back(frame);
}
if(true == canrevisitedconfig.imuinfo.enabled(embot::prot::can::analog::imuSensor::qua))
{
embot::prot::can::inertial::periodic::Message_IMU_QUATERNION msg;
embot::prot::can::inertial::periodic::Message_IMU_QUATERNION::Info info;
info.canaddress = embot::app::theCANboardInfo::getInstance().cachedCANaddress();
info.value = imuacquisition.data.qua;
msg.load(info);
msg.get(frame);
replies.push_back(frame);
}
if(true == canrevisitedconfig.imuinfo.enabled(embot::prot::can::analog::imuSensor::status))
{
embot::prot::can::inertial::periodic::Message_IMU_STATUS msg;
embot::prot::can::inertial::periodic::Message_IMU_STATUS::Info info;
info.canaddress = embot::app::theCANboardInfo::getInstance().cachedCANaddress();
info.seqnumber = canrevisitedconfig.counter;
info.acquisitiontime = imuacquisition.duration;
info.acccalib = static_cast<embot::prot::can::inertial::periodic::Message_IMU_STATUS::Calibration>(imuacquisition.data.calibrationOfACC());
info.magcalib = static_cast<embot::prot::can::inertial::periodic::Message_IMU_STATUS::Calibration>(imuacquisition.data.calibrationOfMAG());
info.gyrcalib = static_cast<embot::prot::can::inertial::periodic::Message_IMU_STATUS::Calibration>(imuacquisition.data.calibrationOfGYR());
msg.load(info);
msg.get(frame);
replies.push_back(frame);
}
}
return true;
}
bool embot::app::application::theIMU::Impl::acquisition_start()
{
imuacquisition.onstart();
embot::core::Callback cbk(alertdataisready, this);
embot::hw::bno055::acquisition(config.sensor, embot::hw::bno055::Set::FULL, imuacquisition.data, cbk);
return true;
}
bool embot::app::application::theIMU::Impl::acquisition_retrieve()
{
// 1. in imuacquisition.data we have the values.
//std::memmove(runtimedata.data.adcvalue, runtimedata.data.dmabuffer, sizeof(runtimedata.data.adcvalue));
return true;
}
bool embot::app::application::theIMU::Impl::acquisition_processing()
{
// we dont process IMU data
return true;
}
// --------------------------------------------------------------------------------------------------------------------
// - the class
// --------------------------------------------------------------------------------------------------------------------
embot::app::application::theIMU& embot::app::application::theIMU::getInstance()
{
static theIMU* p = new theIMU();
return *p;
}
embot::app::application::theIMU::theIMU()
// : pImpl(new Impl)
{
pImpl = std::make_unique<Impl>();
}
embot::app::application::theIMU::~theIMU() { }
bool embot::app::application::theIMU::initialise(Config &config)
{
pImpl->config = config;
pImpl->action.load(embot::os::EventToThread(pImpl->config.tickevent, pImpl->config.totask));
embot::hw::bno055::init(pImpl->config.sensor, pImpl->config.sensorconfig);
// remapping of the axis to have IMU and FT frames parallel, neglecting non-inertial corrections, see this github issue:
// https://github.com/icub-tech-iit/fix/issues/780
//this macro defines different behaviour for the IMU placed in the STRAIN2 board, i.e. the accelerometer/gyroscope/magnetometer axes are remapped to match the FT frame
#if defined(STM32HAL_BOARD_STRAIN2)
// In strain2 we have the P6 configuration reported in bno055 datasheet
embot::hw::bno055::write(pImpl->config.sensor, embot::hw::bno055::Register::AXIS_MAP_CONFIG, 0x21, 5*embot::core::time1millisec);
embot::hw::bno055::write(pImpl->config.sensor, embot::hw::bno055::Register::AXIS_MAP_SIGN, 0x07, 5*embot::core::time1millisec);
#endif
embot::hw::bno055::set(pImpl->config.sensor, embot::hw::bno055::Mode::NDOF, 5*embot::core::time1millisec);
return true;
}
bool embot::app::application::theIMU::start()
{
return pImpl->start();
}
bool embot::app::application::theIMU::set(const embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::Info &info)
{
// if ticking: stop it
if(true == pImpl->ticking)
{
stop();
}
// we are in legacy mode:
pImpl->legacymode = true;
// copy new configuration
pImpl->canlegacyconfig.accgyroinfo = info;
// get some settings from it.
// static const std::uint8_t accelmask = static_cast<std::uint8_t>(embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::InertialType::analogaccelerometer) |
// static_cast<std::uint8_t>(embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::InertialType::internaldigitalaccelerometer) |
// static_cast<std::uint8_t>(embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::InertialType::externaldigitalaccelerometer) ;
// static const std::uint8_t gyrosmask = static_cast<std::uint8_t>(embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::InertialType::externaldigitalgyroscope);
pImpl->canlegacyconfig.accelEnabled =
embot::core::binary::bit::check(pImpl->canlegacyconfig.accgyroinfo.maskoftypes, static_cast<std::uint8_t>(embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::InertialTypeBit::analogaccelerometer)) ||
embot::core::binary::bit::check(pImpl->canlegacyconfig.accgyroinfo.maskoftypes, static_cast<std::uint8_t>(embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::InertialTypeBit::internaldigitalaccelerometer)) ||
embot::core::binary::bit::check(pImpl->canlegacyconfig.accgyroinfo.maskoftypes, static_cast<std::uint8_t>(embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::InertialTypeBit::externaldigitalaccelerometer));
pImpl->canlegacyconfig.gyrosEnabled =
embot::core::binary::bit::check(pImpl->canlegacyconfig.accgyroinfo.maskoftypes, static_cast<std::uint8_t>(embot::prot::can::analog::polling::Message_ACC_GYRO_SETUP::InertialTypeBit::externaldigitalgyroscope));
// if there is something to acquire and the rate is not zero: start acquisition
if((0 != pImpl->canlegacyconfig.accgyroinfo.maskoftypes) && (0 != pImpl->canlegacyconfig.accgyroinfo.txperiod))
{
start();
}
return true;
}
bool embot::app::application::theIMU::set(const embot::prot::can::analog::polling::Message_IMU_CONFIG_SET::Info &info)
{
// if ticking: stop it
bool wasticking { false };
if(true == pImpl->ticking)
{
wasticking = true;
stop();
}
// we are not in legacy mode:
pImpl->legacymode = false;
// copy new configuration
pImpl->canrevisitedconfig.imuinfo = info;
// now, if we need to do something on the bno055 we do it.
// so far only mode + axis remap
// i get the current mode
embot::hw::bno055::Mode mode { embot::hw::bno055::Mode::none };
embot::hw::bno055::get(pImpl->config.sensor, mode, 5*embot::core::time1millisec);
// now we transform info into a ... target mode for the bno055
embot::hw::bno055::Mode targetmode {embot::hw::bno055::Mode::NDOF};
if(embot::prot::can::analog::polling::IMUmode::TYPE::basic == info.mode.type)
{ // we use either fusion or non fusion
targetmode = (true == info.mode.param.basic.fusion) ? embot::hw::bno055::Mode::NDOF : embot::hw::bno055::Mode::IMU;
}
else if(true == embot::hw::bno055::isvalidmode(info.mode.param.advanced.chipmode))
{ // we have a mode which someone wants to impose. and it is valid, so we use it
targetmode = embot::hw::bno055::tomode(info.mode.param.advanced.chipmode);
}
else
{ // the mode someone wants to impose is not valid. i revert to basic fusion
targetmode = embot::hw::bno055::Mode::NDOF;
}
// i get the current placement
embot::hw::bno055::Placement placement {embot::hw::bno055::Placement::none};
embot::hw::bno055::get(pImpl->config.sensor, placement, 5*embot::core::time1millisec);
// now we transform info.orientation into a ... target placement for the bno055
embot::hw::bno055::Placement targetplacement {embot::hw::bno055::Placement::P1};
if(embot::prot::can::analog::polling::IMUorientation::TYPE::factorydefault == info.orientation.type)
{ // we use the placement used by the bno055 at boostrap
targetplacement = embot::hw::bno055::Placement::P1;
}
else if(true == embot::hw::bno055::isvalidplacement(info.orientation.param))
{ // we have a placement which someone wants to impose. and it is valid
targetplacement = embot::hw::bno055::toplacement(info.orientation.param);
}
else
{ // the placemnet someone wants to impose is not valid. i revert to default one
targetplacement = embot::hw::bno055::Placement::P1;
}
bool changebno055 = (placement != targetplacement) || (mode != targetmode);
if(changebno055)
{
// from Table 3-6: Operating mode swithcing time
constexpr embot::core::relTime waitANY2CONFIG {19 * embot::core::time1millisec};
constexpr embot::core::relTime waitCONFIG2ANY {7 * embot::core::time1millisec};
// at first we need to go in config mode
embot::hw::bno055::set(pImpl->config.sensor, embot::hw::bno055::Mode::CONFIG, 5*embot::core::time1millisec);
// and wait for some time
embot::core::wait(waitANY2CONFIG);
if((embot::hw::bno055::Placement::none != targetplacement) && (placement != targetplacement))
{
embot::hw::bno055::set(pImpl->config.sensor, targetplacement, 5*embot::core::time1millisec);
}
// now we can go back into the target mode
embot::hw::bno055::set(pImpl->config.sensor, targetmode, 5*embot::core::time1millisec);
// and wait for some time
embot::core::wait(waitCONFIG2ANY);
}
if(true == wasticking)
{
// restart it
start();
}
return true;
}
bool embot::app::application::theIMU::set(const embot::prot::can::analog::polling::Message_IMU_TRANSMIT::Info &info)
{
if((true == info.transmit) && (info.txperiod > 0))
{
start(info.txperiod);
}
else
{
stop();
}
return true;
}
bool embot::app::application::theIMU::get(const embot::prot::can::analog::polling::Message_IMU_CONFIG_GET::Info &info, embot::prot::can::analog::polling::Message_IMU_CONFIG_GET::ReplyInfo &replyinfo)
{
// copy configuration
replyinfo.sensormask = pImpl->canrevisitedconfig.imuinfo.sensormask;
replyinfo.mode = pImpl->canrevisitedconfig.imuinfo.mode;
replyinfo.orientation = pImpl->canrevisitedconfig.imuinfo.orientation;
replyinfo.ffu08 = pImpl->canrevisitedconfig.imuinfo.ffu08;
replyinfo.ffu16 = pImpl->canrevisitedconfig.imuinfo.ffu16;
return true;
}
bool embot::app::application::theIMU::start(embot::core::relTime period)
{
pImpl->canrevisitedconfig.txperiod = period;
return pImpl->start();
}
bool embot::app::application::theIMU::stop()
{
return pImpl->stop();
}
bool embot::app::application::theIMU::tick(std::vector<embot::prot::can::Frame> &replies)
{
return pImpl->tick(replies);
}
bool embot::app::application::theIMU::processdata(std::vector<embot::prot::can::Frame> &replies)
{
return pImpl->processdata(replies);
}
// - end-of-file (leave a blank line after)----------------------------------------------------------------------------