motors module

This is the most basic driver. It implement goto and track features in alpha/beta axis. It can be consider as AltAz mount but without aligment routines.

class synscan.motors.motors(udp_ip='192.168.4.1', udp_port=11880)[source]

Implementation of motor commands and logic following the document: https://inter-static.skywatcher.com/downloads/skywatcher_motor_controller_command_set.pdf

IMPORTANT NOTES (based on the above doc):

  • In the motor controller, there is a hardware timer T1 that is used to generate stepping pulse for stepper motor or reference position for servomotor. The input clocks frequency of the timer, plus the preset value of this timer, determine the slewing speed of the motors.

  • For GOTO mode, the motor controller will take care of T1 automatically. But motion mode has to be set to tracking=False

When T1 generates an interrupt, it might:

  • Drive the motor to move 1 step (1 micro-step or 1 encoder tick) for low speed slewing.

  • Drive the motor to move up to 32 steps for high speed slewing. This method applies to motor controller firmware version 2.xx. For motor controller with firmware 3.xx or above, the motor controller always drive the motor controller 1 steps/interrupt.

Typical session:

  • Check whether the motor is in full stop status. If not, stop it.

  • Set the motion mode.

  • Set the parameters, for example, destination or preset value of T1.

  • Set the “Start” command.

  • For a GOTO slewing, check the motor status to confirm that the motor stops (Generally means arriving the destination. ). For a Speed mode slewing, send “Stop” command to end the session.

Generally, the motor controller returns to “Speed Mode” when the motor stops automatically.

NOTE: Methods begining with axis prefix act only onto selected axis.

axis_get_pos(axis)[source]

Get actual position in Degrees.

axis_get_posCounts(axis)[source]

Get actual position in StepsCounts.

axis_goto(axis, targetDegrees)[source]

Move given axis to target (goto)

axis_set_goto_target(axis, targetDegrees)[source]

GoTo Target value in Degrees. Motors has to be stopped

axis_set_goto_targetCounts(axis, targetCounts)[source]

GoTo Target value in StepsCounts. Motors has to be stopped

axis_set_goto_targetIncrementCounts(axis, targetCounts)[source]

GoTo Target increment in StepsCounts. Motors has to be stopped

axis_set_motion_mode(axis, Tracking, CW=True, fastSpeed=False)[source]

Set Motion Mode.

NOTE: Channel will always be set to Tracking Mode after stopped

Motion mode msg is 1byte msg (2 HEX digits)

HEX Digit 1 bits:

  • B0: 0=Goto, 1=Tracking

  • B1: 0=Slow, 1=Fast (T)

    0=Fast, 1=Slow (G)

  • B2: 0=S/F, 1=Medium

  • B3: 1x SlowGoto

HEX Digit 2 bits:

  • B0: 0=CW,1=CCW

  • B1: 0=Noth,1=South

  • B2: 0=Normal Goto,1=Coarse Goto

axis_set_pos(axis, degrees)[source]

Synchronize position Degrees.

axis_set_posCounts(axis, counts)[source]

Synchronize position Counts.

axis_set_speed(axis, degreesPerSecond)[source]

Set the tracking speed in degreesPerSecond

axis_start_motion(axis)[source]

Start Goto

axis_stop_motion(axis, synchronous=True)[source]

Soft stop. If synchronous==True wait to finish

axis_stop_motion_hard(axis, synchronous=True)[source]

Hard stop. If synchronous==True wait to finish

axis_wait2stop(axis)[source]

Wait for given axis to Stop, or overshoot Target

counts2degrees(axis, counts)[source]

Return position or speed in degrees for a given counts or counts/seconds value

degrees2counts(axis, degrees)[source]

Return position or speed in counts for a given deg or deg/seconds value

get_parameters()[source]

Get main motor parameters. Some of this parameters are needed for all calculations so they have to be available to the rest of the code

Parameters are stored in a dict with te following keys:

  • countsPerRevolution

  • TimerInterruptFreq

  • StepPeriod

  • MotorBoardVersion

  • HighSpeedRatio

get_values(parameterDict)[source]

Send all cmd in the parameterDict for both axis and return a dictionary with the values.

Used by get_parameters and update_current_values functions

goto(alpha, beta, synchronous=False)[source]

GOTO. alpha,beta in degrees

set_pos(alpha, beta)[source]

Synchronize actual position with alpha and beta

set_switch(on)[source]

Switch on/off auxiliary switch

track(alpha, beta)[source]

GOTO. alpha,beta in degrees per second

update_current_values(logaxis=2)[source]

Update current status and values logaxis can be 1,2,3 or None. 1 for only log current values of axis 1…

comm module

Module to manage UDP comunications. It should not be used by user but by the others drivers.

class synscan.comm.comm(udp_ip='192.168.4.1', udp_port=11880)[source]

UDP Comunication module. Virtual. Used as base class. All members are protected

_hex2int(data)[source]
Convert data recived from motors following

Synscan Motor Protocol rules

  • 24 bits Data Sample: for HEX number 0x123456, in the data segment of a command or response, it is sent/received in this order: “5” “6” “3” “4” “1” “2”.

  • 16 bits Data Sample: For HEX number 0x1234, in the data segment of a command or response, it is sent/received in this order: “3” “4” “1” “2”.

  • 8 bits Data Sample: For HEX number 0x12, in the data segment of a command or response, it is sent/received in this order: “1” “2”.

_int2hex(data, ndigits=6)[source]
Convert data prior to send to the motors following

Synscan Motor Protocol rules

  • 24 bits Data Sample: for HEX number 0x123456, in the data segment of a command or response, it is sent/received in this order: “5” “6” “3” “4” “1” “2”.

  • 16 bits Data Sample: For HEX number 0x1234, in the data segment of a command or response, it is sent/received in this order: “3” “4” “1” “2”.

  • 8 bits Data Sample: For HEX number 0x12, in the data segment of a command or response, it is sent/received in this order: “1” “2”.

_send_cmd(cmd, axis, data=None, ndigits=6)[source]

Command function

_send_raw_cmd(cmd, timeout_in_seconds=2)[source]

Low level send command function

_test_comm()[source]

Control msg to check comms