SliderModule
robodyno.components.webots.slider_module
Slider module.
This module provides functions to control slider module in Webots. The slider module is a lead screw driven linear module with a robodyno motor.
Examples:
from robodyno.components import SliderModule
from robodyno.interfaces import Webots
webots = Webots()
slider = SliderModule(webots, 0x10)
slider.enable()
slider.set_pos(0.1)
webots.step(10)
print(slider.get_pos())
slider.disable()
webots.stop()
SliderModule
Bases: object
Slider module.
Attributes:
Name | Type | Description |
---|---|---|
motor |
Motor
|
Motor object of the slider module. |
__init__(webots, id_=16, type_=None, max_vel=0.02, lead=0.01)
Initialize the slider module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
webots |
Webots
|
Webots object. |
required |
id_ |
int
|
ID of the slider module. |
16
|
type_ |
string
|
Type of the slider module. |
None
|
max_vel |
float
|
Maximum velocity of the slider module in m/s. |
0.02
|
lead |
float
|
Lead of the slider module in meter. |
0.01
|
set_max_vel(max_vel)
Sets max velocity of the slider module.
This function configures the motor to position track mode with max velocity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_vel |
float
|
Max velocity of the slider module in m/s. |
required |
enable()
Enables the slider module.
disable()
Disables the slider module.
set_pos(pos)
Sets position of the slider module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pos |
float
|
Position of the slider module in m. |
required |
set_abs_pos(pos)
Sets absolute position of the slider module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pos |
float
|
Absolute position of the slider module in m. |
required |
get_pos(timeout=None)
Reads position of the slider module.
Timeout is not supported in Webots.
Returns:
Type | Description |
---|---|
float
|
Position of the slider module in m. |
get_abs_pos(timeout=None)
Reads absolute position of the slider module.
Timeout is not supported in Webots.
Returns:
Type | Description |
---|---|
float
|
Absolute position of the slider module in m. |