Skip to main content
Version: 2.0.1

Servo API

The Servo service allows to drive RC elements like servomotor

Its type has access to all common capabilities.


Functions​

Function name and parametersActionComment
control(self)Displays service type graphical interfaceOnly available using Jupyter notebook

Variables​

Variable nameActionType
rot_positionRotation position in °.read / write: float
max_angleSets max_angle value, in degrees (°) (180.0 by default)read / write: Float
min_pulseSets PWM minimum pulse value, in seconds (s) (0.0005 by default)read / write: Float
max_pulseSets PWM maximum pulse value, in seconds (s) (0.0015 by default)read / write: Float

ROS topics​

Topic nameMessage typeComment
/servo1_mod/variables/rot_position/readstd_msgs/msg/Float32value in radians
/servo1_mod/variables/rot_position/writestd_msgs/msg/Float32value in radians
/servo1_mod/variables/max_angle/readstd_msgs/msg/Float32value in radians
/servo1_mod/variables/max_angle/writestd_msgs/msg/Float32value in radians
/servo1_mod/variables/min_pulse/readstd_msgs/msg/Float32
/servo1_mod/variables/min_pulse/writestd_msgs/msg/Float32
/servo1_mod/variables/max_pulse/readstd_msgs/msg/Float32
/servo1_mod/variables/max_pulse/writestd_msgs/msg/Float32

Example code​

Example command from ROS topics​

Move the servo1 to 1.57 radians:

ros2 topic pub -1 /servo1_mod/variables/rot_position/write std_msgs/msg/Float32 data:\ 1.57\