|
i2cpwm_board
0.5.1
ROS Package for PCA9685 based 16 channel PWM Board with I2C Interface
|
Functions | |
| bool | set_pwm_frequency (i2cpwm_board::IntValue::Request &req, i2cpwm_board::IntValue::Response &res) |
| service to set set PWM frequency More... | |
| bool | config_servos (i2cpwm_board::ServosConfig::Request &req, i2cpwm_board::ServosConfig::Response &res) |
| store configuration data for servos on the active board More... | |
| bool | config_drive_mode (i2cpwm_board::DriveMode::Request &req, i2cpwm_board::DriveMode::Response &res) |
| set drive mode and drive servos More... | |
| bool | stop_servos (std_srvs::Empty::Request &req, std_srvs::Empty::Response &res) |
| service to stop all servos on all boards More... | |
| bool set_pwm_frequency | ( | i2cpwm_board::IntValue::Request & | req, |
| i2cpwm_board::IntValue::Response & | res | ||
| ) |
#include <src/i2cpwm_controller.cpp>
service to set set PWM frequency
The PWM boards drive LED and servos using pulse width modulation. The 12 bit interface means values are 0..4096. The size of the minimum width is determined by the frequency. is service is needed when using a board configured other than with the default I2C address and when using multiple boards.
If using the set_active_board() service, it must be used before using other services or topics from this package.
Warning: Changing the frequency will affect any active servos.
| [in] | req | an Int16 value for the requested pulse frequency |
| [out] | res | the return value will be the new active frequency |
i2cpwm_board::IntValue
Example
Definition at line 1172 of file i2cpwm_controller.cpp.
| bool config_servos | ( | i2cpwm_board::ServosConfig::Request & | req, |
| i2cpwm_board::ServosConfig::Response & | res | ||
| ) |
#include <src/i2cpwm_controller.cpp>
store configuration data for servos on the active board
A service to set each servo's center value, direction of rotation (1 for forward and -1 for reverse motion), the center or nul value, range, and direction of one or more servos. and range between full left and right or maximun forward and backward speed.
Setting these data are required before sending messages to the servos_proportional() topic as well as the servos_drive() topic.
If more than one PWM board is present, the set_active_board() service is used to switch between boards prior to configuring servos.
| [in] | req | an array of 'ServoConfig' which consists of a servo number (one based), center(0..4096), range(0..4096), and direction (±1). |
| [out] | res | integer non-zero if an error occured |
i2cpwm_board::ServosConfig
i2cpwm_board::ServoConfig
Example
Definition at line 1228 of file i2cpwm_controller.cpp.
| bool config_drive_mode | ( | i2cpwm_board::DriveMode::Request & | req, |
| i2cpwm_board::DriveMode::Response & | res | ||
| ) |
#include <src/i2cpwm_controller.cpp>
set drive mode and drive servos
A service to set the desired drive mode. It must be called before messages are handled by the servos_drive() topic. Setting these data are required before sending messages to the servos_proportional() topic.
The drive mode consists of a string value for the type of drive desired: ackerman, differential, or mecanum. For each mode, the drive servos must be specified.
| req | [in] DriveMode configuration data |
| res | [out] non-zero on error |
The DriveMode input requires drive system details included: wheel RPM, wheel radius, and track width. ROS uses meters for measurements. The values of radius and track are expected in meters.
A scale factor is available if necessary to compensate for linear vector values.
The mode string is one of the following drive systems:
The servo message is used for indicating which servos are used for the drive system. The message consists of 'servo' number, and data 'value'.
The 'value' field indicates the positon the corresponding servo within the drive system. The applicable servos are assigned positions as follows:
| positon | ackerman | differential | mecanum |
|---|---|---|---|
| position 1 corresponds to | drive | left | left-front |
| position 2 corresponds to | right | right-front | |
| position 3 corresponds to | left-rear | ||
| position 4 corresponds to | right-rear |
i2cpwm_board::DriveMode
i2cpwm_board::Position
Example
Definition at line 1327 of file i2cpwm_controller.cpp.
| bool stop_servos | ( | std_srvs::Empty::Request & | req, |
| std_srvs::Empty::Response & | res | ||
| ) |
#include <src/i2cpwm_controller.cpp>
service to stop all servos on all boards
A service to stop all of the servos on all of the PWM boards and set their power state to off / coast.
This is different from setting each servo to its center value. A centered servo is still under power and it's in a brake state.
| req | is empty |
| res | is empty |
Example
Definition at line 1370 of file i2cpwm_controller.cpp.
1.8.11