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.


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.


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:


cmd_motion.init_motion(motion_id, conf_string)[source]

Initialize axis of motion system with conf_string


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.


Invalidate motion system

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

Home motion system at speed


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


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


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