Skip to content

Commit a637a5e

Browse files
author
sascha
committed
bugfixes in antennaposition, extaid pos
git-svn-id: http://isvn/svn/rep_IEP-I000261_LINUX-KERNEL/01_Entwicklung/trunk/10_Entwicklung/28_SW_Komponente_XCOM/30_IMPL/XCOM_Client_Python/dependencies/ixcom-public@11726 fa3a88b2-825e-5648-bb98-bb0d4e3c2968
1 parent 443fb12 commit a637a5e

4 files changed

Lines changed: 40 additions & 22 deletions

File tree

ixcom/commands.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,31 @@ class CMD_LOG_Payload(DefaultCommandPayload):
1212
PayloadItem(name = 'divider', dimension = 1, datatype = 'H'),
1313
])
1414

15+
@command(0x3)
16+
class CMD_CONF_Payload(DefaultCommandPayload):
17+
command_payload = Message([
18+
PayloadItem(name = 'configAction', dimension = 1, datatype = 'I'),
19+
])
20+
1521
@command(0x4)
1622
class CMD_EKF_Payload(DefaultCommandPayload):
1723
command_payload = Message([
1824
PayloadItem(name = 'subcommand', dimension = 1, datatype = 'H'),
1925
PayloadItem(name = 'numberOfParams', dimension = 1, datatype = 'H'),
2026
])
2127

22-
@command(0x3)
23-
class CMD_CONF_Payload(DefaultCommandPayload):
28+
@command(0x5)
29+
class XcomCommandPayload(DefaultCommandPayload):
2430
command_payload = Message([
25-
PayloadItem(name = 'configAction', dimension = 1, datatype = 'I'),
31+
PayloadItem(name = 'mode', dimension = 1, datatype = 'H'),
32+
PayloadItem(name = 'channelNumber', dimension = 1, datatype = 'H'),
2633
])
2734

28-
@command(0x1)
29-
class CMD_EXT_Payload(DefaultCommandPayload):
35+
@command(0x7)
36+
class CMD_EXTAID_Payload(DefaultCommandPayload):
3037
command_payload = Message([
3138
PayloadItem(name = 'time', dimension = 1, datatype = 'd'),
3239
PayloadItem(name = 'timeMode', dimension = 1, datatype = 'H'),
3340
PayloadItem(name = 'cmdParamID', dimension = 1, datatype = 'H'),
3441
])
3542

36-
@command(0x5)
37-
class XcomCommandPayload(DefaultCommandPayload):
38-
command_payload = Message([
39-
PayloadItem(name = 'mode', dimension = 1, datatype = 'H'),
40-
PayloadItem(name = 'channelNumber', dimension = 1, datatype = 'H'),
41-
])

ixcom/grep.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def message_callback(in_bytes):
5555
message_bytes_dict[message_id].write(in_bytes)
5656
except:
5757
message_bytes_dict[message_id] = io.BytesIO(in_bytes)
58+
message_bytes_dict[message_id].write(in_bytes) # initial bytes werden von write ueberschrieben
5859

5960
config = {}
6061
def parameter_callback(msg, from_device):

ixcom/parser.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ def process_buffer_unsafe(self, buffer):
4040
inbytelen = len(inBytes)
4141
while current_msg_start_idx < inbytelen:
4242
current_msg_length = inBytes[current_msg_start_idx + 4] + 256*inBytes[current_msg_start_idx + 5]
43+
if current_msg_start_idx + current_msg_length > inbytelen: # Message nicht mehr komplett
44+
break
4345
self.publish(inBytes[current_msg_start_idx:current_msg_start_idx+current_msg_length])
4446
current_msg_start_idx += current_msg_length
4547

4648
def process_bytes(self, inBytes):
4749
inByteIdx = 0
4850
while inByteIdx < len(inBytes):
49-
5051
if self.searcherState == MessageSearcherState.waiting_for_sync:
5152
poppedByte = inBytes[inByteIdx]
5253
inByteIdx += 1
@@ -69,8 +70,7 @@ def process_bytes(self, inBytes):
6970
else:
7071
self.searcherState = MessageSearcherState.waiting_for_sync
7172
elif self.searcherState == MessageSearcherState.fetching_bytes:
72-
if len(
73-
inBytes) - 1 >= self.remainingByteCount + inByteIdx - 1: # Der Buffer ist Länger als der Rest der Nachricht.
73+
if len(inBytes) - 1 >= self.remainingByteCount + inByteIdx - 1: # Der Buffer ist Länger als der Rest der Nachricht.
7474
self.currentBytes[self.currentByteIdx:self.currentByteIdx + self.remainingByteCount] = inBytes[
7575
inByteIdx:inByteIdx + self.remainingByteCount]
7676
self.currentByteIdx = self.currentByteIdx + self.remainingByteCount
@@ -902,6 +902,19 @@ def set_autozupt(self, enable: bool):
902902
parekf_zupt.payload.data['action']= data.ParameterAction.CHANGING
903903
self.send_msg_and_waitfor_okay(parekf_zupt)
904904

905+
def get_startup(self):
906+
'''Convenience getter for startup parameters of the device.
907+
908+
Raises:
909+
ClientTimeoutError: Timeout while waiting for response or parameter from the XCOM server
910+
ResponseError: The response from the system was not 'OK'.
911+
912+
'''
913+
msgToSend = data.getParameterWithID(data.PAREKF_STARTUPV2_Payload.parameter_id)
914+
msgToSend.payload.data['action'] = data.ParameterAction.REQUESTING
915+
self.send_msg_and_waitfor_okay(msgToSend)
916+
return self.wait_for_parameter()
917+
905918
def set_startup(self, initPos=PositionTuple(Lon=0.1249596927, Lat=0.8599914412, Alt=311.9),
906919
initPosStdDev: Sequence[float] = [10, 10, 10], posMode: data.StartupPositionMode = data.StartupPositionMode.GNSSPOS, initHdg: float = 0,
907920
initHdgStdDev: float = 1, hdgMode: data.StartupHeadingMode = data.StartupHeadingMode.DEFAULT, realign: bool = False, inMotion: bool = False,
@@ -1100,6 +1113,7 @@ def disable_postproc(self):
11001113

11011114
def aid_pos(self, lonLatAlt: Sequence[float], llhStdDev: Sequence[float],
11021115
leverarmXYZ: Sequence[float], leverarmStdDev: Sequence[float],
1116+
enableMSLaltitude = 0,
11031117
time: float = 0, timeMode: protocol.ExtAidingTimeMode = protocol.ExtAidingTimeMode.LATENCY):
11041118
'''External position aiding
11051119
@@ -1108,18 +1122,19 @@ def aid_pos(self, lonLatAlt: Sequence[float], llhStdDev: Sequence[float],
11081122
llhStdDev: Standard deviation in the directions of (Lon, Lat, Alt) in (m, m, m)
11091123
leverarmXYZ: Leverarm in m
11101124
leverarmStdDev: Standard deviation of the leverarm in m
1125+
enableMSLaltitude: Set 1 if Altitude is meansealevel
11111126
time: Timestamp or latency, depending on the timeMode argument
11121127
timeMode (protocol.ExtAidingTimeMode): Selects whether the timestamp is a GPS second of week or a latency.
11131128
11141129
Raises:
11151130
ClientTimeoutError: Timeout while waiting for response or log from the XCOM server
11161131
ResponseError: The response from the system was not 'OK'.
11171132
'''
1118-
msgToSend = data.getCommandWithID(data.CMD_EXT_Payload.command_id)
1133+
msgToSend = data.getCommandWithID(data.CMD_EXTAID_Payload.command_id)
11191134
msgToSend.payload.data['time'] = time
11201135
msgToSend.payload.data['timeMode'] = timeMode
11211136
msgToSend.payload.data['cmdParamID'] = 3
1122-
msgToSend.payload.structString += 'dddddddddddd'
1137+
msgToSend.payload.structString += '12dI'
11231138
msgToSend.payload.data['lon'] = lonLatAlt[0]
11241139
msgToSend.payload.data['lat'] = lonLatAlt[1]
11251140
msgToSend.payload.data['alt'] = lonLatAlt[2]
@@ -1132,6 +1147,7 @@ def aid_pos(self, lonLatAlt: Sequence[float], llhStdDev: Sequence[float],
11321147
msgToSend.payload.data['laXStdDev'] = leverarmStdDev[0]
11331148
msgToSend.payload.data['laYStdDev'] = leverarmStdDev[1]
11341149
msgToSend.payload.data['laZStdDev'] = leverarmStdDev[2]
1150+
msgToSend.payload.data['enableMSL_Alt'] = enableMSLaltitude
11351151
self.send_msg_and_waitfor_okay(msgToSend)
11361152

11371153
def aid_vel(self, vNED: Sequence[float], vNEDStdDev: Sequence[float], time: float = 0, timeMode: protocol.ExtAidingTimeMode = protocol.ExtAidingTimeMode.LATENCY):
@@ -1147,7 +1163,7 @@ def aid_vel(self, vNED: Sequence[float], vNEDStdDev: Sequence[float], time: floa
11471163
ClientTimeoutError: Timeout while waiting for response or log from the XCOM server
11481164
ResponseError: The response from the system was not 'OK'.
11491165
'''
1150-
msgToSend = data.getCommandWithID(data.CMD_EXT_Payload.command_id)
1166+
msgToSend = data.getCommandWithID(data.CMD_EXTAID_Payload.command_id)
11511167
msgToSend.payload.data['time'] = time
11521168
msgToSend.payload.data['timeMode'] = timeMode
11531169
msgToSend.payload.data['cmdParamID'] = 4
@@ -1173,7 +1189,7 @@ def aid_heading(self, heading: float, standard_dev: float, time: float = 0, time
11731189
ClientTimeoutError: Timeout while waiting for response or log from the XCOM server
11741190
ResponseError: The response from the system was not 'OK'.
11751191
'''
1176-
msgToSend = data.getCommandWithID(data.CMD_EXT_Payload.command_id)
1192+
msgToSend = data.getCommandWithID(data.CMD_EXTAID_Payload.command_id)
11771193
msgToSend.payload.data['time'] = time
11781194
msgToSend.payload.data['timeMode'] = timeMode
11791195
msgToSend.payload.data['cmdParamID'] = 5
@@ -1195,7 +1211,7 @@ def aid_height(self, height: float, standard_dev: float, time: float =0, timeMod
11951211
ClientTimeoutError: Timeout while waiting for response or log from the XCOM server
11961212
ResponseError: The response from the system was not 'OK'.
11971213
'''
1198-
msgToSend = data.getCommandWithID(data.CMD_EXT_Payload.command_id)
1214+
msgToSend = data.getCommandWithID(data.CMD_EXTAID_Payload.command_id)
11991215
msgToSend.payload.data['time'] = time
12001216
msgToSend.payload.data['timeMode'] = timeMode
12011217
msgToSend.payload.data['cmdParamID'] = 6
@@ -1242,7 +1258,7 @@ def get_antoffset(self, antenna):
12421258
'''
12431259
msgToSend = data.getParameterWithID(data.PARGNSS_ANTOFFSET_Payload.parameter_id)
12441260
msgToSend.payload.data['action'] = data.ParameterAction.REQUESTING
1245-
msgToSend.payload.data['reserved'] = antenna
1261+
msgToSend.payload.data['reserved_paramheader'] = antenna
12461262
self.send_msg_and_waitfor_okay(msgToSend)
12471263
return self.wait_for_parameter()
12481264

@@ -1263,7 +1279,7 @@ def set_antoffset(self, antenna=0, offset=[0, 0, 0], stdDev=[0.1, 0.1, 0.1]):
12631279
'''
12641280
msgToSend = data.getParameterWithID(data.PARGNSS_ANTOFFSET_Payload.parameter_id)
12651281
msgToSend.payload.data['action'] = data.ParameterAction.CHANGING
1266-
msgToSend.payload.data['reserved'] = antenna
1282+
msgToSend.payload.data['reserved_paramheader'] = antenna
12671283
msgToSend.payload.data['antennaOffset'] = offset
12681284
msgToSend.payload.data['stdDev'] = stdDev
12691285
self.send_msg_and_waitfor_okay(msgToSend)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
long_description = open(readmePath, "rt").read()
1515

1616
setup(name='ixcom',
17-
version='1.1.5',
17+
version='1.1.6',
1818
description='Library for communicating with xcom devices over network',
1919
author='iMAR Navigation GmbH',
2020
author_email='[email protected]',

0 commit comments

Comments
 (0)