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