##// END OF EJS Templates
Update models.py Pedestal
eynilupu -
r390:2565c04022e1
parent child
Show More
@@ -80,8 +80,8 class PedestalConfiguration(Configuration):
80 80 return u'Speed: {}º/s {}'.format(self.speed, self.axis.upper())
81 81 if self.mode=='table':
82 82 axis = [x.strip().upper() for x in self.axis.split(',')]
83 speeds = [int(x.strip()) for x in self.speed.split(',')]
84 table = [int(x.strip()) for x in self.angle.split(',')]
83 speeds = [float(x.strip()) for x in self.speed.split(',')]
84 table = [float(x.strip()) for x in self.angle.split(',')]
85 85 return u'Table: Axis {}, Speed {}º/s, Steps {}'.format(axis, speeds, table)
86 86
87 87 @property
@@ -125,17 +125,17 class PedestalConfiguration(Configuration):
125 125 def reset_device(self):
126 126
127 127 try:
128 url = self.device.url() + "aspeed?params="
128 url = self.device.url() + "position?params="
129 129
130 130 payload_el = {'axis': 'elevation', 'position': 0}
131 json_data_el = json.dumps(payload)
132 base64_table_el = base64.standard_b64encode(json_data.encode('ascii'))
131 json_data_el = json.dumps(payload_el)
132 base64_table_el = base64.standard_b64encode(json_data_el.encode('ascii'))
133 133
134 134 r = requests.get(url + base64_table_el.decode('ascii'))
135 135
136 136 payload_az = {'axis': 'azimuth', 'position': 0}
137 json_data_az = json.dumps(payload)
138 base64_table_az = base64.standard_b64encode(json_data.encode('ascii'))
137 json_data_az = json.dumps(payload_az)
138 base64_table_az = base64.standard_b64encode(json_data_az.encode('ascii'))
139 139
140 140 r = requests.get(url + base64_table_az.decode('ascii'))
141 141
@@ -179,8 +179,6 class PedestalConfiguration(Configuration):
179 179
180 180 def start_device(self):
181 181
182 self.reset_device()
183
184 182 AX = {'az':'azimuth', 'el':'elevation'}
185 183 axis = [AX[x.lower().strip()] for x in self.axis.split(',')]
186 184 if len(axis)==1:
@@ -188,12 +186,13 class PedestalConfiguration(Configuration):
188 186
189 187 try:
190 188 if self.mode == 'position':
191 url = self.device.url() + "aspeed?params="
189 url = self.device.url() + "position?params="
192 190 payload = {'axis': axis, 'position': float(self.angle)}
193 191 elif self.mode == 'speed':
194 url = self.device.url() + "aspeed?params="
192 url = self.device.url() + "speed?params="
195 193 payload = {'axis': axis, 'speed': float(self.speed)}
196 194 elif self.mode == 'table':
195 self.reset_device()
197 196 url = self.device.url() + "combinedtable?params="
198 197 list_of_floats = [float(x.strip()) for x in self.angle.split(",")]
199 198 byte_table = []
@@ -211,10 +210,11 class PedestalConfiguration(Configuration):
211 210 'arraylength': len(speed),
212 211 'axis': axis,
213 212 'speed': speed,
214 'table': coded_table_ascii,
213 'bottom': self.min_value,
215 214 'top': self.max_value,
216 'bottom': self.min_value
215 'table': coded_table_ascii
217 216 }
217 time.sleep(15)
218 218
219 219 json_data = json.dumps(payload)
220 220 print(json_data)
General Comments 0
You need to be logged in to leave comments. Login now