CreateRobotState Class
Create a moveit_msgs::msg::RobotState and write it to the Blackboard. More...
Declaration
Included Headers
Base class
| class | ServiceClientBehaviorBase<ServiceT> |
|
A base class for behaviors which need to send a request to a ROS service client and wait for a result. More... | |
Public Constructors Index
| CreateRobotState (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources) | |
|
Constructor for CreateRobotState behavior. More... | |
| CreateRobotState (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< GetPlanningScene > > client_interface) | |
|
Constructor for CreateRobotState behavior that allows for mocking of the rclcpp service client. More... | |
Private Member Functions Index
| tl::expected< std::string, std::string > | getServiceName () override |
|
User-provided function to get the name of the service when initializing the service client. More... | |
| tl::expected< GetPlanningScene::Request, std::string > | createRequest () override |
|
Creates a service request message. More... | |
| tl::expected< bool, std::string > | processResponse (const GetPlanningScene::Response &response) override |
|
Given the planning scene, extract the robot's current joint state and then overwrite the positions, velocities, and efforts according to the input port values. More... | |
| std::shared_future< tl::expected< bool, std::string > > & | getFuture () override |
|
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member. More... | |
Private Member Attributes Index
| std::shared_future< tl::expected< bool, std::string > > | future_ |
|
Holds the result of calling the service asynchronously. More... | |
Public Static Functions Index
| static BT::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
Description
Create a moveit_msgs::msg::RobotState and write it to the Blackboard.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| joint_names | input | std::vector<std::string> |
| positions | input | std::vector<double> |
| velocities | input | std::vector<double> |
| efforts | input | std::vector<double> |
| joint_state_msg | output | moveit_msgs::msg::RobotState |
This Behavior takes the current JointState of the robot and overwrites the positions, velocities and efforts of those joints indicated in the 'joint_names' input port. 'joint_names' and 'positions' are mandatory, and their sizes have to match. Otherwise an error will be returned. 'velocities' and 'efforts' are optional. If specified, their size needs to match with the size of 'joint_names'.
The current robot JointState is retrieved by a call to the '/get_planning_scene' service, which contains the full robot state.
Definition at line 38 of file create_robot_state.hpp.
Public Constructors
CreateRobotState()
|
Constructor for CreateRobotState behavior.
- Parameters
-
name config shared_resources
Declaration at line 47 of file create_robot_state.hpp, definition at line 99 of file create_robot_state.cpp.
CreateRobotState()
|
Constructor for CreateRobotState behavior that allows for mocking of the rclcpp service client.
- Parameters
-
name config shared_resources client_interface Service client interface, allowing a mock to be injected in tests.
Declaration at line 57 of file create_robot_state.hpp, definition at line 105 of file create_robot_state.cpp.
Private Member Functions
createRequest()
| virtual |
Creates a service request message.
- Returns
Returns an instance of GetPlanningScene::Request.
Declaration at line 72 of file create_robot_state.hpp, definition at line 140 of file create_robot_state.cpp.
getFuture()
| inline virtual |
Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.
Definition at line 82 of file create_robot_state.hpp.
getServiceName()
| virtual |
User-provided function to get the name of the service when initializing the service client.
- Returns
Returns the name of the service. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.
Declaration at line 66 of file create_robot_state.hpp, definition at line 135 of file create_robot_state.cpp.
processResponse()
|
Given the planning scene, extract the robot's current joint state and then overwrite the positions, velocities, and efforts according to the input port values.
- Parameters
-
response The response from a service call that contains the planning scene msg.
Declaration at line 79 of file create_robot_state.hpp, definition at line 147 of file create_robot_state.cpp.
Private Member Attributes
future_
|
Holds the result of calling the service asynchronously.
Definition at line 90 of file create_robot_state.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 63 of file create_robot_state.hpp, definition at line 130 of file create_robot_state.cpp.
providedPorts()
| static |
Declaration at line 61 of file create_robot_state.hpp, definition at line 112 of file create_robot_state.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.