gobot.io/x/gobot/v2@v2.1.0/platforms/sphero/ollie/ollie_packets.go (about)

     1  package ollie
     2  
     3  import "gobot.io/x/gobot/v2/platforms/sphero"
     4  
     5  // DefaultCollisionConfig returns a CollisionConfig with sensible collision defaults
     6  func DefaultCollisionConfig() sphero.CollisionConfig {
     7  	return sphero.CollisionConfig{
     8  		Method: 0x01,
     9  		Xt:     0x20,
    10  		Yt:     0x20,
    11  		Xs:     0x20,
    12  		Ys:     0x20,
    13  		Dead:   0x60,
    14  	}
    15  }
    16  
    17  // PowerStatePacket contains all data relevant to the power state of the sphero
    18  type PowerStatePacket struct {
    19  	// record Version Code
    20  	RecVer uint8
    21  	// High-Level State of the Battery; 1=charging, 2=battery ok, 3=battery low, 4=battery critical
    22  	PowerState uint8
    23  	// Battery Voltage, scaled in 100th of a Volt, 0x02EF would be 7.51 volts
    24  	BattVoltage uint16
    25  	// Number of charges in the total lifetime of the sphero
    26  	NumCharges uint16
    27  	//Seconds awake since last charge
    28  	TimeSinceChg uint16
    29  }
    30  
    31  // DataStreamingPacket represents the response from a Data Streaming event
    32  type DataStreamingPacket struct {
    33  	// 8000 0000h	accelerometer axis X, raw	-2048 to 2047	4mG
    34  	RawAccX int16
    35  	// 4000 0000h	accelerometer axis Y, raw	-2048 to 2047	4mG
    36  	RawAccY int16
    37  	// 2000 0000h	accelerometer axis Z, raw	-2048 to 2047	4mG
    38  	RawAccZ int16
    39  	// 1000 0000h	gyro axis X, raw	-32768 to 32767	0.068 degrees
    40  	RawGyroX int16
    41  	// 0800 0000h	gyro axis Y, raw	-32768 to 32767	0.068 degrees
    42  	RawGyroY int16
    43  	// 0400 0000h	gyro axis Z, raw	-32768 to 32767	0.068 degrees
    44  	RawGyroZ int16
    45  	// 0200 0000h	Reserved
    46  	Rsrv1 int16
    47  	// 0100 0000h	Reserved
    48  	Rsrv2 int16
    49  	// 0080 0000h	Reserved
    50  	Rsrv3 int16
    51  	// 0040 0000h	right motor back EMF, raw	-32768 to 32767	22.5 cm
    52  	RawRMotorBack int16
    53  	// 0020 0000h	left motor back EMF, raw	-32768 to 32767	22.5 cm
    54  	RawLMotorBack int16
    55  	// 0010 0000h	left motor, PWM, raw	-2048 to 2047	duty cycle
    56  	RawLMotor int16
    57  	// 0008 0000h	right motor, PWM raw	-2048 to 2047	duty cycle
    58  	RawRMotor int16
    59  	// 0004 0000h	IMU pitch angle, filtered	-179 to 180	degrees
    60  	FiltPitch int16
    61  	// 0002 0000h	IMU roll angle, filtered	-179 to 180	degrees
    62  	FiltRoll int16
    63  	// 0001 0000h	IMU yaw angle, filtered	-179 to 180	degrees
    64  	FiltYaw int16
    65  	// 0000 8000h	accelerometer axis X, filtered	-32768 to 32767	1/4096 G
    66  	FiltAccX int16
    67  	// 0000 4000h	accelerometer axis Y, filtered	-32768 to 32767	1/4096 G
    68  	FiltAccY int16
    69  	// 0000 2000h	accelerometer axis Z, filtered	-32768 to 32767	1/4096 G
    70  	FiltAccZ int16
    71  	// 0000 1000h	gyro axis X, filtered	-20000 to 20000	0.1 dps
    72  	FiltGyroX int16
    73  	// 0000 0800h	gyro axis Y, filtered	-20000 to 20000	0.1 dps
    74  	FiltGyroY int16
    75  	// 0000 0400h	gyro axis Z, filtered	-20000 to 20000	0.1 dps
    76  	FiltGyroZ int16
    77  	// 0000 0200h	Reserved
    78  	Rsrv4 int16
    79  	// 0000 0100h	Reserved
    80  	Rsrv5 int16
    81  	// 0000 0080h	Reserved
    82  	Rsrv6 int16
    83  	// 0000 0040h	right motor back EMF, filtered	-32768 to 32767	22.5 cm
    84  	FiltRMotorBack int16
    85  	// 0000 0020h	left motor back EMF, filtered	-32768 to 32767	22.5 cm
    86  	FiltLMotorBack int16
    87  	// 0000 0010h	Reserved 1
    88  	Rsrv7 int16
    89  	// 0000 0008h	Reserved 2
    90  	Rsrv8 int16
    91  	// // 0000 0004h	Reserved 3
    92  	// Rsrv9 int16
    93  	// // 0000 0002h	Reserved 4
    94  	// Rsrv10 int16
    95  	// // 0000 0001h	Reserved 5
    96  	// Rsrv11 int16
    97  	// 8000 0000h	Quaternion Q0	-10000 to 10000	1/10000 Q
    98  	Quat0 int16
    99  	// 4000 0000h	Quaternion Q1	-10000 to 10000	1/10000 Q
   100  	Quat1 int16
   101  	// 2000 0000h	Quaternion Q2	-10000 to 10000	1/10000 Q
   102  	Quat2 int16
   103  	// 1000 0000h	Quaternion Q3	-10000 to 10000	1/10000 Q
   104  	Quat3 int16
   105  	// 0800 0000h	Odometer X	-32768 to 32767	cm
   106  	OdomX int16
   107  	// 0400 0000h	Odometer Y	-32768 to 32767	cm
   108  	OdomY int16
   109  	// 0200 0000h	AccelOne	0 to 8000	1 mG
   110  	AccelOne int16
   111  	// 0100 0000h	Velocity X	-32768 to 32767	mm/s
   112  	VeloX int16
   113  	// 0080 0000h	Velocity Y	-32768 to 32767	mm/s
   114  	VeloY int16
   115  }