b3bb8808e53474b380ced88bd71071a03cc312b1
[ros_wild_thumper.git] / scripts / engine_man_test.py
1 #!/usr/bin/env python
2 # -*- coding: iso-8859-15 -*-
3
4 import sys
5 import struct
6 from time import sleep
7 from i2c import i2c_write_reg, i2c_read_reg
8
9
10 def set(trans, rot):
11         i2c_write_reg(0x50, 0x50, struct.pack(">ff", trans, rot))
12
13 if __name__ == "__main__":
14         set(float(sys.argv[1]), float(sys.argv[2]))
15         while True:
16                 speed1, speed2, speed3, speed4 = struct.unpack(">hhhh", i2c_read_reg(0x50, 0x30, 8))
17                 print speed1, speed2, speed3, speed4
18                 sleep(0.1)