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.
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.
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