Changeset 117:af3d52b9adc4 for src/mlx/fsuipc.py
- Timestamp:
- 04/28/12 12:25:48 (12 years ago)
- Branch:
- default
- hg-Phase:
- (<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/fsuipc.py
r97 r117 531 531 self._handler.requestRead([(0x3bfc, "d")], self._handleZFW, extra = callback) 532 532 533 def requestWeights(self, callback): 534 """Request the following weights: DOW, ZFW, payload. 535 536 These values will be passed to the callback function in this order, as 537 separate arguments.""" 538 self._handler.requestRead([(0x13fc, "d")], self._handlePayloadCount, 539 extra = callback) 540 533 541 def requestTime(self, callback): 534 542 """Request the time from the simulator.""" … … 737 745 """Callback for a time retrieval request.""" 738 746 callback(Simulator._getTimestamp(data)) 747 748 def _handlePayloadCount(self, data, callback): 749 """Callback for the payload count retrieval request.""" 750 payloadCount = data[0] 751 data = [(0x3bfc, "d"), (0x30c0, "f")] 752 for i in range(0, payloadCount): 753 data.append((0x1400 + i*48, "f")) 754 755 self._handler.requestRead(data, self._handleWeights, 756 extra = callback) 757 758 def _handleWeights(self, data, callback): 759 """Callback for the weights retrieval request.""" 760 zfw = data[0] * const.LBSTOKG / 256.0 761 grossWeight = data[1] * const.LBSTOKG 762 payload = sum(data[2:]) * const.LBSTOKG 763 dow = zfw - payload 764 callback(dow, payload, zfw, grossWeight) 739 765 740 766 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.