CBPComponent

class lsst.ts.cbp.CBPComponent

Bases: object

This class is for implementing the CBP component.

The component implements a python wrapper over DMC code written by DFM Manufacturing. The following api exposes commands that move the motors of the CBP, sets the focus and selects the mask.

Notes

The class uses the python socket module to build TCP/IP connections to the Galil controller for the CBP. The underlying api is built on DMC.

Attributes:
log : logging.Logger

The logger for the component

socket : socket.Socket

The socket that handles the TCP/IP connection for the CBP

altitude : float

The value of the CBP altitude encoder in degrees.

azimuth : float

The value of the CBP azimuth encoder in degrees.

mask : str

The current mask name

mask_rotation : float

The current value of the mask rotation encoder in degrees.

masks : SimpleNamespace

A simplenamespace that contains the mask names and rotation values and id.

focus : float

The current value of the focus encoder in microns.

panic_status : float

The current value of the panic variable in the CBP dmc code. A non-zero value represents a panic state and causes the motors to cease functioning until panic is dealt with or goes away. This status is set by the values of the other statuses.

auto_park : float

The current value of the auto_park variable. If this value is one, that means that CBP suffered a power loss that lasted more than 12 seconds and was on battery back up. The CBP will then park itself automatically, moving azimuth to 0 and altitude to -70 and locking focus and mask. To un-park CBP, the park variable should be set to zero.

park : float

The current value of the park variable. This value can be set to one or zero, if set to one it will park the CBP if set to zero it will un-park.

encoder_status : Status

A flag enum that contains the status information for each encoder.

Methods Summary

change_focus(position) This changes the focus to whatever value the user sent.
check_auto_park() Gets the autopark variable from CBP
check_cbp_status() Checks the status of the encoders.
check_panic_status() Gets the panic variable from CBP
check_park() Gets the park variable from CBP
configure(config)
connect() Creates a socket and connects to the CBP’s static address and designated port.
disconnect() Disconnects from the tcp socket.
generate_mask_info() Generates initial mask info.
get_altitude() This gets the altitude value from the altitude encoder in degrees.
get_azimuth() Gets azimuth value from azimuth encoder which is in degrees.
get_cbp_telemetry() Gets the position data of the CBP.
get_focus() This gets the value of the focus encoder.
get_mask() This gets the current mask value from the encoder which is converted into the name of the mask.
get_mask_rotation() This gets the mask rotation value from the encoder which is in degrees.
move_altitude(position) This moves the vertical axis to the value that the user sent.
move_azimuth(position) This moves the horizontal axis to the value sent by the user.
publish() This updates the attributes within the component.
send_command(msg) Sends the encoded command and reads the reply.
set_mask(mask) This sets the mask value
set_mask_rotation(mask_rotation) This sets the mask rotation
set_park(park) A function that tells the CBP to park or un-park depending on the value given.
set_simulation_mode(simulation_mode)

Methods Documentation

change_focus(position: int)

This changes the focus to whatever value the user sent.

Parameters:
position: int

The value of the new focus in microns.

Returns:
None
check_auto_park()

Gets the autopark variable from CBP

Returns:
None
check_cbp_status()

Checks the status of the encoders.

Returns:
None
check_panic_status()

Gets the panic variable from CBP

Returns:
None
check_park()

Gets the park variable from CBP

Returns:
None
configure(config)
connect()

Creates a socket and connects to the CBP’s static address and designated port.

Returns:
None

Nothing

disconnect()

Disconnects from the tcp socket.

generate_mask_info()

Generates initial mask info.

get_altitude()

This gets the altitude value from the altitude encoder in degrees.

Returns:
None
get_azimuth()

Gets azimuth value from azimuth encoder which is in degrees.

Returns:
None
get_cbp_telemetry()

Gets the position data of the CBP.

Returns:
None
get_focus()

This gets the value of the focus encoder. Units: microns

Returns:
None
get_mask()

This gets the current mask value from the encoder which is converted into the name of the mask.

Returns:
None
get_mask_rotation()

This gets the mask rotation value from the encoder which is in degrees.

Returns:
None
move_altitude(position: float)

This moves the vertical axis to the value that the user sent.

Parameters:
position: float

The value to move the altitude to which is in degrees.

Returns:
None
move_azimuth(position: float)

This moves the horizontal axis to the value sent by the user.

Parameters:
position: float

This is the value in degrees that is sent to the CBP in order to move the horizontal axis.

Returns:
None
publish()

This updates the attributes within the component.

Returns:
None
send_command(msg)

Sends the encoded command and reads the reply.

Parameters:
msg : str

The string command to be sent.

set_mask(mask: str)

This sets the mask value

Parameters:
mask: str

This is the name of the mask which is converted to an int using a dictionary.

Returns:
None
set_mask_rotation(mask_rotation: float)

This sets the mask rotation

Parameters:
mask_rotation: float

The mask_rotation value that will be sent.

Returns:
None
set_park(park: int = 0)

A function that tells the CBP to park or un-park depending on the value given.

Parameters:
park: int {0,1}

A boolean int which tells the CBP to park or not.

Returns:
None
set_simulation_mode(simulation_mode)