|
|
@@ -23,6 +23,7 @@ class AppTest:
|
|
|
if len(resp) == 0:
|
|
|
print("No ECHO (0-size resp)")
|
|
|
return 0
|
|
|
+ print(resp)
|
|
|
for r in range(len(msg)):
|
|
|
echo = echo + chr(resp[3+r])
|
|
|
print("Echo:"+echo)
|
|
|
@@ -81,6 +82,11 @@ class AppTest:
|
|
|
return 0
|
|
|
|
|
|
def cmd_sensor_get_data_IMU(self, sensor_index):
|
|
|
+ '''
|
|
|
+ sensor_index:
|
|
|
+ 1 - ACC
|
|
|
+ 2 - GYRO
|
|
|
+ '''
|
|
|
resp = self.serial_port.request(self.module, sensor_index, CMD_DATA,[])
|
|
|
#print(resp)
|
|
|
x = 0
|
|
|
@@ -135,6 +141,10 @@ class AppTest:
|
|
|
print("MODULE STOP")
|
|
|
self.serial_port.requestBroadcast(CMD_STOP,[])
|
|
|
|
|
|
+ def cmd_reset(self):
|
|
|
+ print("MODULE RESET")
|
|
|
+ resp = self.serial_port.request(self.module, 0, (SET+CMD_RESET),[], long_answer=1)
|
|
|
+
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
app = AppTest(0x05, 0x0)
|
|
|
@@ -145,9 +155,10 @@ if __name__ == "__main__":
|
|
|
if app.cmd_echo([97,98,99,100]) == 0:
|
|
|
sys.exit()
|
|
|
|
|
|
- app.cmd_set_param(1, PARAM_SAMPLERATE, 10)
|
|
|
- app.cmd_set_param(1, PARAM_RANGE, 1)
|
|
|
- app.cmd_set_param(1, PARAM_FILTER, 2)
|
|
|
+ app.cmd_reset()
|
|
|
+ #app.cmd_set_param(1, PARAM_SAMPLERATE, 10)
|
|
|
+ #app.cmd_set_param(1, PARAM_RANGE, 1)
|
|
|
+ #app.cmd_set_param(1, PARAM_FILTER, 2)
|
|
|
|
|
|
for s in range(1):
|
|
|
sr=app.cmd_get_param(s+1,PARAM_SAMPLERATE)
|
|
|
@@ -159,8 +170,9 @@ if __name__ == "__main__":
|
|
|
sys.exit()
|
|
|
#time.sleep(0.5)
|
|
|
#app.cmd_module_stop()
|
|
|
- time.sleep(0.5)
|
|
|
+
|
|
|
app.cmd_module_start()
|
|
|
+ time.sleep(0.5)
|
|
|
|
|
|
#app.cmd_module_stop()
|
|
|
#sys.exit()
|
|
|
@@ -168,12 +180,12 @@ if __name__ == "__main__":
|
|
|
#sys.exit()
|
|
|
print("pocet senzorov=", pocet)
|
|
|
#app.cmd_sensor_get_data_FSR(pocet)
|
|
|
- for i in range(6):
|
|
|
+ for i in range(36):
|
|
|
acc = app.cmd_sensor_get_data_IMU(1)
|
|
|
gyr = app.cmd_sensor_get_data_IMU(2)
|
|
|
print(acc)
|
|
|
print(gyr)
|
|
|
-
|
|
|
+ app.cmd_module_stop()
|
|
|
sys.exit()
|
|
|
|
|
|
for i in range(pocet):
|