The motion module

motion is an abstraction layer that interfaces with the modules actually controlling the hardware and provides a unified API. The compatible modules presently implemented are:

Pool and identification

During init_motion, the initialization function for the particular model is called. Its name must be init_MODEL (e.g.: init_th_apt). The convention style for MODEL is a two-letter maker symbol plus the model, separated by an underscore (_). Any other function from the motion controller module must be able to determine how to address the hardware only based on its model_id.

Initialization

As pointed out previously, cmd_motion provides a function init_motion and requires functions init_MODEL from the modules with which it interfaces. The init_motion declaration is:

init_motion(motion_id, conf_string)

Initialize motion system with id motion_id. Provide the conf_strings for its axis.

Functions

A series of functions in cmd_motion interface the corresponding functions on the motion controller modules. In most cases, a call to the function of the same name is performed (replacing _motion by _MODEL). All motion controller modules must include, at least, an implementation of the following functions:

  • init_MODEL (model_id,*conf_string*)
  • deinit_MODEL (model_id)
  • config_MODEL (model_id, pos_max, pos_min)
  • inval_MODEL (model_id)
  • move_MODEL (model_id, displacement, speed, acceleration)
  • get_pos_MODEL (model_id)

See the API below for a description of their functionality:

API

cmd_motion.init_motion(motion_id, conf_string)[source]

Initialize axis of motion system with conf_string

cmd_motion.deinit_motion(motion_id)[source]

Deinitialize motion system

cmd_motion.config_motion(motion_id, pos_max, pos_min)[source]

Configure the motion system to use the maximum and minimum values pos_max and pos_min.

cmd_motion.inval_motion(motion_id)[source]

Invalidate motion system

cmd_motion.home_motion(motion_id, direction, speed)[source]

Home motion system at speed

cmd_motion.is_homed_motion(motion_id)[source]

Get the homed status of the system. Returns 1 if is homed, 0 otherwise.

cmd_motion.set_origin_motion(motion_id)[source]

Set a local coordinate origin other than the default 0 for all axis

cmd_motion.move_motion(motion_id, displacement, speed, acceleration)[source]

Move along a displacement with speed and acceleration

cmd_motion.goto_motion(motion_id, pos, speed, acceleration)[source]

Go to position pos with speed and acceleration

cmd_motion.get_pos_motion(motion_id)[source]

Get the position of the system

cmd_motion.get_limits_motion(motion_id, real='undef')[source]

Get the limits of the motion system. real determines whether local (0, default) or real (1) coordinates are used. Returns max_1,max_2,max_3;min_1,min_2,min3

cmd_motion.go_min_motion(motion_id, speed, acceleration)[source]

Go to the minimum configured

cmd_motion.go_max_motion(motion_id, speed, acceleration)[source]

Go to the maximum configured