Check-in [e9e2cb5abf]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Starting a new branch that will introduce instabilities. Changes in this checkin intro place holders for the configuration of the accelerometer and magnetometer. The general configuration gui will likely change and even the low level bno055 may have some incompatible changes (the examples will be updated accordingly).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | development
Files: files | file ages | folders
SHA3-256:e9e2cb5abf3b516caf26fa6d7a7500666ab9aa22601c3be917a6747f7bffe153
User & Date: gwlester 2018-02-10 21:04:47
Context
2018-02-19
23:31
Added the rest of the configuration parameters to the class. More work done on the example GUI, Leaf check-in: 347c1be87b user: gwlester tags: development
2018-02-10
21:04
Starting a new branch that will introduce instabilities. Changes in this checkin intro place holders for the configuration of the accelerometer and magnetometer. The general configuration gui will likely change and even the low level bno055 may have some incompatible changes (the examples will be updated accordingly). check-in: e9e2cb5abf user: gwlester tags: development
2018-02-09
22:39
Correction of wide spread typo. check-in: cecb467b84 user: gwlester tags: trunk
Changes

Changes to src/dimu/dimu.tcl.

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
...
274
275
276
277
278
279
280








281
282
283
284
285
286
287
...
401
402
403
404
405
406
407













408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
...
442
443
444
445
446
447
448



449
450
451
452
453
454
455
...
459
460
461
462
463
464
465

















466
467
468
469
470
471
472
	self method init {} {
		variable HardwiredSettings
		variable ConfigurationRegisters
		variable OptionDef
		variable ReadOnly

		set OptionDef {












            -bus        	{-default 1}
			-power          {-register powerMode -allowed {normal low suspend} -type PWR_MODE}
			-operation		{-register operMode -immediate yes -allowed {configmode acconly magonly gyroonly accmag accgyro maggyro amg imu compass m4g ndof_fmc_off ndof} -type OPER_MODE}



            -gyrorange		{-register gyr,range -allowed {2000dps 1000dps 500dps 250dps 125dps} -type GYR_RANGE}
            -gyrobandwidth	{-register gyr,bandwidth -allowed {523hz 230hz 116hz 64hz 47hz 32hz 23hz 12hz} -type GYR_BANDWIDTH}
            -gyropowermode	{-register gyr,pwrMode -allowed {normal fast_up deep_suspend suspend advanced_powersave} -type GYR_POWER_MODE}
			-gyrounits		{-register gyr,units -allowed {dps rps} -type GYR_UNIT}
			-gyroautosleep	{-register gyr,autoSlpDur -allowed {4MS 5MS 8MS 10MS 15MS 20MS 40MS} -type GYR_AUTOSLP_DURR}
			-gyrosleep		{-register gyr,sleepDur -allowed {4MS 5MS 8MS 10MS 15MS 18MS 20MS} -type GYR_SLEEP_DURR}
			-gyroawake		{-register gyr,am,durr -allowed {8samples 16samples 32samples 64samples} -type GYR_AWAKE_DURR}
			-gyroslope		{-register gyr,am,slope}
			-gyroxoffset	{-register gyr,x,offset}
			-gyroyoffset	{-register gyr,y,offset}
			-gyrozoffset	{-register gyr,z,offset}
			-clocksource	{-register clockSource -type CLOCK_SOURCE}
			-temperaturesource	{-register tempSource -type TEMP_SRC}
			-temperatureunits	{-register temp,units -type TEMP_UNIT}
			-fusionunits	{-register format,opt -type ORI_MODE}
			-eulunits		{-register eul,units -type EUL_UNIT}
			-remap_x_sign	{-register remap,x,sign -type REMAP_SIGN}
			-remap_y_sign	{-register remap,y,sign -type REMAP_SIGN}
			-remap_z_sign	{-register remap,z,sign -type REMAP_SIGN}





			-remap_x_axis	{-register remap,x,value -type REMAP_TO}
			-remap_y_axis	{-register remap,y,value -type REMAP_TO}
			-remap_z_axis	{-register remap,z,value -type REMAP_TO}





		}
		
		set ReadOnly		{
			-uniqueID		{-register uniqueId}
			-softwareRev	{-register sw,rev -format "0x%1$x"}
			-bootloaderRev	{-register bl,rev -format "0x%1$x"}
			-mcuSelfTest	{-register mcu,selftest}
................................................................................
        close [dict get $instanceInfo handle]
    }


	##
	## Public Methods
	##








    method cget {option} {
        variable instanceInfo
		classvariable OptionDef
		classvariable ReadOnly
        variable currentConfiguration

        if {[dict exists $instanceInfo options $option]} {
................................................................................
				}
			}
        }
            
        return;

    }














	method readGyro {} {
        variable instanceInfo
        variable currentConfiguration
		
		set operMode [bno055 getShortSymbol OPER_MODE [dict get $currentConfiguration operMode]]
		if {$operMode in {CONFIGMODE ACCONLY MAGONLY COMPASS M4G}} {
			throw [list DIMU SENDIS $operMode] "Gyroscope reading are not availble when dIMU is in '$operMode' mode."
		}
		
		set results {}
		set readings [bno055 readMultipleRegisters [dict get $instanceInfo handle] {gyr,data,x gyr,data,y gyr,data,z}]
		set range [bno055 getSymbol GYR_RANGE [dict get $currentConfiguration gyr,range]]
		switch -exact -- $range {
			GYR_RANGE_125DPS {
				set divisor 256.0
			}
................................................................................
			dict set results units rps
			set divisor [expr {$divsor * 900 / 16}]
		}
		dict set results x [expr {[dict get $readings gyr,data,x] / $divisor}]
		dict set results y [expr {[dict get $readings gyr,data,y] / $divisor}]
		dict set results z [expr {[dict get $readings gyr,data,z] / $divisor}]
	}




	method readTemperature {} {
        variable instanceInfo
        variable currentConfiguration

		set results {}
		set readings [bno055 readRegister [dict get $instanceInfo handle] temp,data]
................................................................................
			set divisor 1.0
		} else {
			dict set results units V
			set divisor 2.0
		}
		dict set results temperature [expr {$readings / $divisor}]
	}

















	
	method reset {what} {
        variable instanceInfo

		set handle [dict get $instanceInfo handle]

		switch -exact $what {







>
>
>
>
>
>
>
>
>
>
>
>

<
<
>
>
>











|
|
|
|
|
|
|
|
>
>
>
>
>



>
>
>
>
>







 







>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>






|


|







 







>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
...
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
...
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
...
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
...
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
	self method init {} {
		variable HardwiredSettings
		variable ConfigurationRegisters
		variable OptionDef
		variable ReadOnly

		set OptionDef {
			-accelunits		{-register acc,units -allowed {mps2 mg} -type ACC_UNIT}
            -accelrange		{-register acc,range -allowed {2000dps 1000dps 500dps 250dps 125dps} -type ACC_RANGE}
            -accelbandwidth	{-register acc,bandwidth -allowed {523hz 230hz 116hz 64hz 47hz 32hz 23hz 12hz} -type ACC_BANDWIDTH}
            -accelpowermode	{-register acc,pwrMode -allowed {normal fast_up deep_suspend suspend advanced_powersave} -type ACC_POWER_MODE}
			-accelautosleep	{-register acc,autoSlpDur -allowed {4MS 5MS 8MS 10MS 15MS 20MS 40MS} -type ACC_AUTOSLP_DURR}
			-accelsleep		{-register acc,sleepDur -allowed {4MS 5MS 8MS 10MS 15MS 18MS 20MS} -type ACC_SLEEP_DURR}
			-accelawake		{-register acc,am,durr -allowed {8samples 16samples 32samples 64samples} -type ACC_AWAKE_DURR}
			-accelslope		{-register acc,am,slope}
			-accelxoffset	{-register acc,x,offset}
			-accelyoffset	{-register acc,y,offset}
			-accelzoffset	{-register acc,z,offset}
			-accelradius	{-register acc,radius}
            -bus        	{-default 1}


			-clocksource	{-register clockSource -type CLOCK_SOURCE}
			-eulunits		{-register eul,units -allowed {deg rad} -type EUL_UNIT}
			-fusionunits	{-register format,opt -allowed {windows android} -type ORI_MODE}
            -gyrorange		{-register gyr,range -allowed {2000dps 1000dps 500dps 250dps 125dps} -type GYR_RANGE}
            -gyrobandwidth	{-register gyr,bandwidth -allowed {523hz 230hz 116hz 64hz 47hz 32hz 23hz 12hz} -type GYR_BANDWIDTH}
            -gyropowermode	{-register gyr,pwrMode -allowed {normal fast_up deep_suspend suspend advanced_powersave} -type GYR_POWER_MODE}
			-gyrounits		{-register gyr,units -allowed {dps rps} -type GYR_UNIT}
			-gyroautosleep	{-register gyr,autoSlpDur -allowed {4MS 5MS 8MS 10MS 15MS 20MS 40MS} -type GYR_AUTOSLP_DURR}
			-gyrosleep		{-register gyr,sleepDur -allowed {4MS 5MS 8MS 10MS 15MS 18MS 20MS} -type GYR_SLEEP_DURR}
			-gyroawake		{-register gyr,am,durr -allowed {8samples 16samples 32samples 64samples} -type GYR_AWAKE_DURR}
			-gyroslope		{-register gyr,am,slope}
			-gyroxoffset	{-register gyr,x,offset}
			-gyroyoffset	{-register gyr,y,offset}
			-gyrozoffset	{-register gyr,z,offset}
            -magrange		{-register mag,range -allowed {2000dps 1000dps 500dps 250dps 125dps} -type MAG_RANGE}
            -magbandwidth	{-register mag,bandwidth -allowed {523hz 230hz 116hz 64hz 47hz 32hz 23hz 12hz} -type MAG_BANDWIDTH}
            -magpowermode	{-register mag,pwrMode -allowed {normal fast_up deep_suspend suspend advanced_powersave} -type MAG_POWER_MODE}
			-magautosleep	{-register mag,autoSlpDur -allowed {4MS 5MS 8MS 10MS 15MS 20MS 40MS} -type MAG_AUTOSLP_DURR}
			-magsleep		{-register mag,sleepDur -allowed {4MS 5MS 8MS 10MS 15MS 18MS 20MS} -type MAG_SLEEP_DURR}
			-magawake		{-register mag,am,durr -allowed {8samples 16samples 32samples 64samples} -type MAG_AWAKE_DURR}
			-magslope		{-register mag,am,slope}
			-magxoffset		{-register mag,x,offset}
			-magyoffset		{-register mag,y,offset}
			-magzoffset		{-register mag,z,offset}
			-magradius		{-register mag,radius}
			-operation		{-register operMode -immediate yes -allowed {configmode acconly magonly gyroonly accmag accgyro maggyro amg imu compass m4g ndof_fmc_off ndof} -type OPER_MODE}
			-power          {-register powerMode -allowed {normal low suspend} -type PWR_MODE}
			-remap_x_axis	{-register remap,x,value -type REMAP_TO}
			-remap_y_axis	{-register remap,y,value -type REMAP_TO}
			-remap_z_axis	{-register remap,z,value -type REMAP_TO}
			-remap_x_sign	{-register remap,x,sign -type REMAP_SIGN}
			-remap_y_sign	{-register remap,y,sign -type REMAP_SIGN}
			-remap_z_sign	{-register remap,z,sign -type REMAP_SIGN}
			-temperaturesource	{-register tempSource -type TEMP_SRC}
			-temperatureunits	{-register temp,units -allowed {f c} -type TEMP_UNIT}
		}
		
		set ReadOnly		{
			-uniqueID		{-register uniqueId}
			-softwareRev	{-register sw,rev -format "0x%1$x"}
			-bootloaderRev	{-register bl,rev -format "0x%1$x"}
			-mcuSelfTest	{-register mcu,selftest}
................................................................................
        close [dict get $instanceInfo handle]
    }


	##
	## Public Methods
	##
	method mget {args} {
		set results {}
		foreach option $args {
			lappend results $option [my cget $option]
		}
		return results
	}

    method cget {option} {
        variable instanceInfo
		classvariable OptionDef
		classvariable ReadOnly
        variable currentConfiguration

        if {[dict exists $instanceInfo options $option]} {
................................................................................
				}
			}
        }
            
        return;

    }

	method readAccelerometer {} {

	}

	method readMagnetometer {} {
	}

	method readEulerAngles {} {
	}

	method readGravity{} {
	}

	method readGyro {} {
        variable instanceInfo
        variable currentConfiguration
		
		set operMode [bno055 getShortSymbol OPER_MODE [dict get $currentConfiguration operMode]]
		if {$operMode in {CONFIGMODE ACCONLY MAGONLY ACCMAG}} {
			throw [list DIMU SENDIS $operMode] "Gyroscope reading are not availble when dIMU is in '$operMode' mode."
		}

		set results {}
		set readings [bno055 readMultipleRegisters [dict get $instanceInfo handle] {gyr,data,x gyr,data,y gyr,data,z}]
		set range [bno055 getSymbol GYR_RANGE [dict get $currentConfiguration gyr,range]]
		switch -exact -- $range {
			GYR_RANGE_125DPS {
				set divisor 256.0
			}
................................................................................
			dict set results units rps
			set divisor [expr {$divsor * 900 / 16}]
		}
		dict set results x [expr {[dict get $readings gyr,data,x] / $divisor}]
		dict set results y [expr {[dict get $readings gyr,data,y] / $divisor}]
		dict set results z [expr {[dict get $readings gyr,data,z] / $divisor}]
	}
	
	method read LinearAccelration{} {
	}

	method readTemperature {} {
        variable instanceInfo
        variable currentConfiguration

		set results {}
		set readings [bno055 readRegister [dict get $instanceInfo handle] temp,data]
................................................................................
			set divisor 1.0
		} else {
			dict set results units V
			set divisor 2.0
		}
		dict set results temperature [expr {$readings / $divisor}]
	}
	
	method readQuaternion {} {
        variable instanceInfo
        variable currentConfiguration

		set operMode [bno055 getShortSymbol OPER_MODE [dict get $currentConfiguration operMode]]
		if {$operMode ni {IMU COMPASS M4G NDOF_FMC_OFF NDOF}} {
			throw [list DIMU SENDIS $operMode] "Quaternion reading are not availble when dIMU is in '$operMode' mode."
		}

		set results {}
		set readings [bno055 readMultipleRegisters [dict get $instanceInfo handle] {qua,data,w qua,data,x qua,data,y qua,data,z}]
		dict set results w [expr {[dict get $readings qua,data,w] / (2.0 ** 14)}]
		dict set results x [expr {[dict get $readings qua,data,x] / (2.0 ** 14)}]
		dict set results y [expr {[dict get $readings qua,data,y] / (2.0 ** 14)}]
		dict set results z [expr {[dict get $readings qua,data,z] / (2.0 ** 14)}]
	}
	
	method reset {what} {
        variable instanceInfo

		set handle [dict get $instanceInfo handle]

		switch -exact $what {