ROS-Control专题:PR2的六个概念【5】
时间:2022-08-29 16:00:00
一、 提要
ROS-control是ROS重要概念,而 ROS-control是通过PR因此,从本质上讲,它是由开发产生的PR2本质是彻底理解ROS-control;本文主要阐述ROS-control的消息;
ROS-control的基础是pr2,PR2(Personal Robot 2.2代个人机器人)Willow Garage该公司设计的机器人平台数字2代表第二代机器人。本文将介绍ROS中的pr2机制及相应的接口开发原理。
二、pr2的六个关键
2.1 Pr六个关键知识点如下
- pr2_controller_interface:实时控制器 C 接口
- pr2_controller_manager:允许您在实时循环中操作和管理多个控制器的基础设施
- pr2_hardware_interface:PR2 硬件的 C 接口包括执行器、压力传感器、加速度计、数字输出和投影仪接口。
- pr2_mechanism_model:基于力控机器人的模型 urdf 机器人描述格式。
- pr2_mechanism_msgs:包括实时控制器、关节和执行器状态在内的实时控制电路通信消息。
- realtime_tools:实时发布到 ROS 主题工具。
本文主要讨论pr2_mechanism_msgs和realtime_tools;
三、关于pr2_mechanism_msgs
该包定义了与实时控制循环通信的服务。它还定义了实时控制器、关节和执行器状态的信息。
ROS Message / Service / Action Types
ROS Message Types | ROS Service Types | ROS Action Types |
ActuatorStatistics ControllerStatistics JointStatistics MechanismStatistics |
ListControllerTypes ListControllers LoadController ReloadControllerLibraries SwitchController UnloadController |
SwitchController |
四、ROS Message Types
4.1 pr2_mechanism_msgs/ActuatorStatistics
此消息包含 pr2 执行器在机器人上的状态。 通过电机和编码器包含执行器transmission传输到关节。
# actuator的名称
stringname
#ethercat 链中 MCB 的序列号。
#链条中的第一个设备 deviced_id 为零
int32device_id
#测量执行器状态的时间
timetimestamp
# theencoderposition,representedbythenumberofencoderticks
int32encoder_count
#Theangularoffset(inradians)thatisaddedtotheencoderreading,
#togettothepositionoftheactuator.Thisnumberiscomputedwhenthereferece
#sensoristriggeredduringthecalibrationphase
float64encoder_offset
#theencoderpositioninradians
float64position
#theencodervelocityinencodertickspersecond
float64encoder_velocity
#theencodervelocityinradianspersecond
float64velocity
#thevalueofthecalibrationreading:low(false)orhigh(true)
boolcalibration_reading
#booltoindicateifthejointalreadytriggeredtherising/fallingedgeofthereferencesensor
boolcalibration_rising_edge_valid
boolcalibration_falling_edge_validbr>
# the encoder position when the last rising/falling edge was observed.
# only read this value when the calibration_rising/falling_edge_valid is true
float64 last_calibration_rising_edge
float64 last_calibration_falling_edge
# flag to indicate if this actuator is enabled or not.
# An actuator can only be commanded when it is enabled.
bool is_enabled
# indicates if the motor is halted. A motor can be halted because of a voltage or communication problem
bool halted
# the last current/effort command that was requested
float64 last_commanded_current
float64 last_commanded_effort
# the last current/effort command that was executed by the actuator
float64 last_executed_current
float64 last_executed_effort
# the last current/effort that was measured by the actuator
float64 last_measured_current
float64 last_measured_effort
# the motor voltate
float64 motor_voltage
# the number of detected encoder problems
int32 num_encoder_errors
4.2 pr2_mechanism_msgs/ControllerStatistics
消息文件:pr2_mechanism_msgs/ControllerStatistics.msg
# This message contains the state of one realtime controller
# that was spawned in pr2_mechanism_control
# the name of the controller
string name
# the time at which these controller statistics were measured
time timestamp
# bool that indicates if the controller is currently
# in a running or a stopped state
bool running
# the maximum time the update loop of the controller ever needed to complete
duration max_time
# the average time the update loop of the controller needs to complete.
# the average is computed in a sliding time window.
duration mean_time
# the variance on the time the update loop of the controller needs to complete.
# the variance applies to a sliding time window.
duration variance_time
# the number of times this controller broke the realtime loop
int32 num_control_loop_overruns
# the timestamp of the last time this controller broke the realtime loop
time time_last_control_loop_overrun
4.3 pr2_mechanism_msgs/JointStatistics
消息文件:pr2_mechanism_msgs/JointStatistics.msg
# This message contains the state of one joint of the pr2 robot.
# This message is specificly designed for the pr2 robot.
# A generic joint state message can be found in sensor_msgs::JointState
# the name of the joint
string name
# the time at which these joint statistics were measured
time timestamp
# the position of the joint in radians
float64 position
# the velocity of the joint in radians per second
float64 velocity
# the measured joint effort
float64 measured_effort
# the effort that was commanded to the joint.
# the actual applied effort might be different
# because the safety code can limit the effort
# a joint can apply
float64 commanded_effort
# a flag indicating if the joint is calibrated or not
bool is_calibrated
# a flag inidcating if the joint violated one of its position/velocity/effort limits
# in the last publish cycle
bool violated_limits
# the total distance travelled by the joint, measured in radians.
float64 odometer
# the lowest position reached by the joint in the last publish cycle
float64 min_position
# the highest position reached by the joint in the last publish cycle
float64 max_position
# the maximum absolute velocity reached by the joint in the last publish cycle
float64 max_abs_velocity
# the maximum absolute effort applied by the joint in the last publish cycle
float64 max_abs_effort
4.4 pr2_mechanism_msgs/MechanismStatistics
消息文件:pr2_mechanism_msgs/MechanismStatistics.msg
# This message describes the state of the pr2 mechanism. It contains the state of
# each actuator, each joint, and each controller that is spawned in pr2_mechanism_control.
Header header
ActuatorStatistics[] actuator_statistics
JointStatistics[] joint_statistics
ControllerStatistics[] controller_statistics
五、ROS Service Types
5.1 pr2_mechanism_msgs/ListControllerTypes
服务文件:pr2_mechanism_msgs/ListControllerTypes.srv
# The ListControllers service returns a list of controller types that are known
# to pr2_mechanism_control.
string[] types
5.2 pr2_mechanism_msgs/ListControllers
服务文件:pr2_mechanism_msgs/ListControllers.srv
# The ListControllers service returns a list of controller names that are spawned
# inside pr2_mechanism_control, and their corresponding stats. The state is either
# running or stopped.
string[] controllers
string[] state
5.3 pr2_mechanism_msgs/LoadController
服务文件:pr2_mechanism_msgs/LoadController.srv
# The LoadController service allows you to load a single controller
# inside pr2_controller_manager
# To load a controller, specify the "name" of the controller.
# The return value "ok" indicates if the controller was successfully
# constructed and initialized or not.
string name
bool ok
5.4 pr2_mechanism_msgs/ReloadControllerLibraries
服务文件:pr2_mechanism_msgs/ReloadControllerLibraries.srv
# The ReloadControllerLibraries service will reload all controllers that are available in
# the system as plugins
# Reloading libraries only works if there are no controllers loaded. If there
# are still some controllers loaded, the reloading will fail.
# If this bool is set to true, all loaded controllers will get
# killed automatically, and the reloading can succeed.
bool force_kill
---
bool ok
5.5 pr2_mechanism_msgs/SwitchController
pr2_mechanism_msgs/SwitchController.srv
# The SwitchController service allows you stop a number of controllers
# and start a number of controllers, all in one single timestep of the
# pr2_mechanism_control control loop.
# To switch controllers, specify
# * the list of controller names to start,
# * the list of controller names to stop, and
# * the strictness (BEST_EFFORT or STRICT)
# * STRICT means that switching will fail if anything goes wrong (an invalid
# controller name, a controller that failed to start, etc. )
# * BEST_EFFORT means that even when something goes wrong with on controller,
# the service will still try to start/stop the remaining controllers
# The return value "ok" indicates if the controllers were switched
# successfully or not. The meaning of success depends on the
# specified strictness.
string[] start_controllers
string[] stop_controllers
int32 strictness
int32 BEST_EFFORT=1
int32 STRICT=2
---
bool ok
5.6 pr2_mechanism_msgs/UnloadController
pr2_mechanism_msgs/UnloadController.srv
# The UnloadController service allows you to unload a single controller
# that is loaded in pr2_controller_manager.
# To unload a controller, specify the "name" of the controller.
# The return value "ok" indicates if the controller was unloaded or not.
# There are three cases when unloadinng a controller will fail:
# * No controller with the specified name exists
# * The controller is still running
# * Another controller depends on the specified controller
string name
---
bool ok
六、ROS Action Types
6.1 pr2_mechanism_msgs/SwitchController
消息文件:pr2_mechanism_msgs/SwitchController.action
string[] start_controllers
string[] stop_controllers
---
---