minute read
Active Parameters
You are reading our Automation1 API documentation for the Python™ programming language.
The Basics
In the Python API, Parameters lets you get and set active controller parameters on the Automation1 controller. Controller parameters dictate how the controller behaves. They are categorized into axis, task, and system categories:
- Axis controller parameters depend on the electrical and mechanical devices that make up an axis. They configure things like units, axis names, and jog speeds.
- Task controller parameters configure things like task-based coordinated motion.
- System controller parameters configure things like memory allocation and communication.
See The Three Controller Categories: Axis, Task, and System for more information.
Controller Parameters That You Can Adjust at Runtime
Typically, it is not necessary for you to change the active controller parameters. The parameters that Machine Setup configures for you are almost always the best ones to use. But you can adjust most of the controller parameters at runtime, such as the servo loop gains.
The changes that you make to active controller parameters have an effect immediately, but they are not permanent. This occurs because the values that you specify for these parameters are erased after you reset the controller. To permanently save your changes to the controller parameters, use the ConfiguredParameters class. See the example program in the Example Code section of the Configuration page.
Controller Parameters That You Cannot Adjust at Runtime
There are some controller parameters that you cannot change at runtime. You must change them by using the ConfiguredParameters class. Then reset the controller for these changes to have an effect. See the example program in the Example Code section of the Configuration page.
Controller Parameter Data Types
Controller parameters have different data types. They are as follows:
- 32-bit integers,
- single-precision floating-point numbers,
- double-precision floating-point numbers,
- strings.
In the Python API, these data types are represented as Numeric parameters and String parameters. Numeric parameter values are floats in Python. String parameter values are strings in Python.
How to Use
In the Python API, Parameters is part of the Controller.runtime property. For all the APIs that operate under this property, the Automation1 controller must be running before you can get or set the active controller parameters. For more information about this property, see the Controller page.
First, access the Controller.runtime.parameters property. All the controller parameters are categorized into axis, task, and system categories:
- Axis controller parameters require you to specify the axis from which to get the parameter. You can specify an axis by its axis name or axis index.
- Task controller parameters require you to specify the task from which to get the parameter. You can specify a task by its task name or task index.
- The Automation1 controller is the only system. The system property does not require you to specify a system from which to get or set the parameters.
You can access specific controller parameters by using the axes, tasks, or system property. When you do this, you get all the parameters that are specific to that property. Refer to the example that follows.
controller.runtime.parameters.axes[axis]
controller.runtime.parameters.tasks[task]
controller.runtime.parameters.system
In each category, parameters are further organized into groups for convenience and filtering. See The Three Controller Categories: Axis, Task, and System. You can access them as follows:
- You can access the controller parameters through these groups. For example, axes["X"] gives you all the controller parameters for the X axis.
- You can ignore the groups and index the axes[axis], tasks[task], or system property. If you do this, make sure to index the axes[axis] or tasks[task] property with the name of the parameter or its ID. Index the system property with the name of the parameter. To see how this looks in the code, refer to the Example Code section of this page.
To get or set the value of a controller parameter, use the value property. Refer to the example that follows.
value = controller.runtime.parameters.axes[axis].motion.maxjogspeed.value
value = controller.runtime.parameters.axes[axis][param].value
Example Code
# Get the value of the MaxJogSpeed active controller parameter through the motion parameter group.
maxjogspeed_value = controller.runtime.parameters.axes["X"].motion.maxjogspeed.value
# Set the value of the MaxJogSpeed active controller parameter by using the axes property and indexing it with the parameter ID.
controller.runtime.parameters.axes["X"][a1.AxisParameterId.MaxJogSpeed].value = 1.0
# Set the value of the MaxJogSpeed active controller parameter by using the axes property and indexing it with the parameter name.
controller.runtime.parameters.axes["X"]["MaxJogSpeed"].value = 1.0
Thread Safety
The threading library is the only multithreading library that is officially supported by the Automation1 Python API.
All the methods and properties that operate under the Controller.runtime.parameters property are thread safe. You can call them from two or more threads without interference.