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.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
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.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
webots
|
Webots
|
Webots object. |
必需 |
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.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
max_vel
|
float
|
Max velocity of the slider module in m/s. |
必需 |
enable()
Enables the slider module.
disable()
Disables the slider module.
set_pos(pos)
Sets position of the slider module.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
pos
|
float
|
Position of the slider module in m. |
必需 |
set_abs_pos(pos)
Sets absolute position of the slider module.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
pos
|
float
|
Absolute position of the slider module in m. |
必需 |
get_pos(timeout=None)
Reads position of the slider module.
Timeout is not supported in Webots.
返回:
| 类型 | 描述 |
|---|---|
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.
返回:
| 类型 | 描述 |
|---|---|
float
|
Absolute position of the slider module in m. |