closeDiffPublishResponse.py
Go to the documentation of this file.
00001 __author__ = 'tom1231'
00002 import struct
00003 from BAL.Header.RiCHeader import RiCHeader
00004 
00005 ODOM_X = 10
00006 ODOM_Y = 14
00007 ODOM_THATE = 18
00008 # TRAN_X = 24
00009 # TRAN_Y = 28
00010 # TRAN_Z = 32
00011 TRAN_ROT_Z = 22
00012 TRAN_ROT_W = 26
00013 LINEAR_VEL = 30
00014 
00015 class CloseDiffPublishRepose(RiCHeader):
00016 
00017     def __init__(self):
00018         RiCHeader.__init__(self)
00019         self._odomX = 0.0
00020         self._odomY = 0.0
00021         self._odomTheta = 0.0
00022         self._translationX = 0.0
00023         self._translationY = 0.0
00024         self._translationZ = 0.0
00025         self._translationRotationZ = 0.0
00026         self._translationRotationW = 0.0
00027         self._linearVelocity = 0.0
00028 
00029     def buildRequest(self, data):
00030         RiCHeader.buildRequest(self, data)
00031         bytes = bytearray()
00032         while self.index < ODOM_X:
00033             bytes.append(data[self.index])
00034             self.index += 1
00035         self._odomX = struct.unpack('<f', bytes)[0]
00036         bytes = bytearray()
00037         while self.index < ODOM_Y:
00038             bytes.append(data[self.index])
00039             self.index += 1
00040         self._odomY = struct.unpack('<f', bytes)[0]
00041         bytes = bytearray()
00042         while self.index < ODOM_THATE:
00043             bytes.append(data[self.index])
00044             self.index += 1
00045         self._odomTheta = struct.unpack('<f', bytes)[0]
00046         # bytes = bytearray()
00047         # while self.index < TRAN_X:
00048         #     bytes.append(data[self.index])
00049         #     self.index += 1
00050         # self._translationX = struct.unpack('<f', bytes)[0]
00051         # bytes = bytearray()
00052         # while self.index < TRAN_Y:
00053         #     bytes.append(data[self.index])
00054         #     self.index += 1
00055         # self._translationY = struct.unpack('<f', bytes)[0]
00056         # bytes = bytearray()
00057         # while self.index < TRAN_Z:
00058         #     bytes.append(data[self.index])
00059         #     self.index += 1
00060         # self._translationZ = struct.unpack('<f', bytes)[0]
00061         bytes = bytearray()
00062         while self.index < TRAN_ROT_Z:
00063             bytes.append(data[self.index])
00064             self.index += 1
00065         self._translationRotationZ = struct.unpack('<f', bytes)[0]
00066         bytes = bytearray()
00067         while self.index < TRAN_ROT_W:
00068             bytes.append(data[self.index])
00069             self.index += 1
00070         self._translationRotationW = struct.unpack('<f', bytes)[0]
00071         bytes = bytearray()
00072         while self.index < LINEAR_VEL:
00073             bytes.append(data[self.index])
00074             self.index += 1
00075         self._linearVelocity = struct.unpack('<f', bytes)[0]
00076 
00077     def getPublishData(self):
00078         return self._odomX,\
00079                self._odomY,\
00080                self._odomTheta,\
00081                self._translationX,\
00082                self._translationY,\
00083                self._translationZ,\
00084                self._translationRotationZ,\
00085                self._translationRotationW,\
00086                self._linearVelocity


ric_board
Author(s): RoboTiCan
autogenerated on Fri Oct 27 2017 03:02:30