-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.py
More file actions
45 lines (32 loc) · 1.02 KB
/
command.py
File metadata and controls
45 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import cmd
from hti.server.axes.axis_control import AxisControl
class CommandShell(cmd.Cmd):
intro = 'Interactive command shell for axis control'
prompt = '>>> '
axis_control = AxisControl()
def do_exit(self, arg):
return True
def do_connect(self, arg):
if self.axis_control.connected():
print('Already connected')
return
self.axis_control.connect()
def do_disconnect(self, arg):
if not self.axis_control.connected():
print('Not connected')
return
self.axis_control.disconnect()
def do_rest(self, arg):
print('Setting axes to resting speed')
self.axis_control.set_resting()
def do_stop(self, arg):
print('Stopping axes')
self.axis_control.set_axis_speeds(ra_dps=0.0, dec_dps=0.0)
def do_ra(self, arg):
print(f'Setting RA axis speed to {float(arg)}')
self.axis_control.set_axis_speeds(ra_dps=float(arg))
def do_dec(self, arg):
print(f'Setting DEC axis speed to {float(arg)}')
self.axis_control.set_axis_speeds(dec_dps=float(arg))
if __name__ == '__main__':
CommandShell().cmdloop()