Woofer Client

class woofer_client

woofer_client defines a socket client interface for the real-time controller to send commands to the woofer. The woofer object will initialize the socket interface to musher.ucolick.org and then allow 52-element actuator command vectors to be sent to the woofer server. The server on musher can be set up to run either the ALPAO woofer DM itself, or a simulator LED box connected to the ALPAO controller.

class woofer_client.woofer_client(aw, config='real')

The woofer_client class handles the client (RTC) side of the connection to the woofer server on another machine (currently called musher) and also coordinates tilt-offload commands to the telescope.

The argument aw is the pointer into the rtc2 state vector, offset to the start of the woofer’s state. Keyword argument config can be either “real” or “simulated” with “real” causing an actual socket connection and “simulated” creating a virtual socket to the sauce simulator.

hello()

Send a hello message to the server, which checks if it is running. If it’s running, the server responds with technobabble. If it’s not, it will print a timeout error

offload(tip, tilt)

convert tip and tilt to RA and DEC and tell the telescope to move that far

send(command)

Send a command vector to the woofer. The argument command must be a 52-element list, with values between -1 and +1

set_callback(callback_function)

set the callback routine for the simulator This should only be called if you configured the client in simulate mode

set_offload(start=True)

Tell the offloader to start or stop watching for tilt on the woofer and generating the appropriate commands to the offload server if they exceed threshold.

set_offload_direction_cosine(A)

2 x 2 transformation matrix from tip/tilt on the woofer to RA and DEC of the telescope. Since the Shane is on an equatorial mount, this only needs to be updated if the tub angle is changed

set_rate(hz)

change the rate at which the thread sends commands to the woofer server. Argument is in updates per second (Hz). It is recommended that it be no higher than 200 Hz and no lower than 1 Hz. The communication overhead has been determined experimentally to be around 1 ms and the jitter around 0.5 ms.

start_thread()

begin the background thread that sends commands to the woofer on a regular clock cycle (default is 200 Hz)

stop_thread()

kill the background thread that is sending commands to the woofer server

zero()

Send a zero command vector to the woofer. This is the same as send([0.]*52)

class woofer_client.woofer_thread(aw=None, config='real')

This is the background thread that sends commands periodically to the woofer. Argument aw is a pointer into the live rtc2 state vector at the woofer state. The woofer thread is implemented nominally for 200 Hz operation, so mu=0.005. If you want to change this, use the set_sample method

run()

defines woofer_thread activity. Do not call this method directly. Instead, use the start() method to initiate the background thread.

set_sample(mu)

set the sample interval of the thread, in seconds.

stop()

stops the woofer communication background thread

class woofer_client.virtual_woofer_server

functions like the real woofer server, but uses the sauce simulator instead. It has methods equivalent to a socket object, so it behaves compatably in simulation mode.

close()

close the virtual connection

connect(params)

make a virtual connection

recv(n)

receive a message

sendall(data)

send a message

settimeout(dt)

set a virtual timeout

Test Code

woofer_client.test_code()

Out-of-box test code for the client side connection to real woofer server. On 1/29/13 this was working with the woofer server on musher

>>> woofer_client.test_code()
hi ('128.114.23.218', 59538)

{t,1,1391042997.5756121,1391042997.5755999}

{m,2,1391042997.5792639,success,1391042997.5787671,1391042997.5792620}