class
RosPublisherThe class internally contains a YARP based ROS node and a set of publishers.
Current implementation consists of
- Joint states publisher
- Wrenches publisher
- Transform broadcaster Although the class might be ROS independent, in order to run the code, ROS is required and usual YARP-ROS connections need to be made.
Constructors, destructors, conversion operators
- RosPublisher(const std::string& nodeName)
- Constructor.
- ~RosPublisher()
- Destructor.
- RosPublisher(const RosPublisher& other) deleted
- delete copy constructor
- RosPublisher(RosPublisher&& other) deleted
- delete move constructor
Public functions
-
auto initialize(std::weak_ptr<BipedalLocomotion::
ParametersHandler:: IParametersHandler> handler) -> bool - Configures the publishers and ROS topics for publishing messages The parameters used to configure the RosPublisher,.
- void stop()
- Clear internal configuration and close the node.
-
auto publishJointStates(const BipedalLocomotion::
GenericContainer:: Vector<const std::string>::Ref jointList, const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointPositions) -> bool - Publish the joint states over the configured joint states topic The joint velocities and joint efforts are set to zero.
-
auto publishJointStates(const BipedalLocomotion::
GenericContainer:: Vector<const std::string>::Ref jointList, const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointPositions, const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointVelocities) -> bool - Publish the joint states over the configured joint states topic The joint velocities and joint efforts are set to zero.
-
auto publishJointStates(const BipedalLocomotion::
GenericContainer:: Vector<const std::string>::Ref jointList, const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointPositions, const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointVelocities, const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointEfforts) -> bool - Publish the joint states over the configured joint states topic The joint velocities and joint efforts are set to zero.
-
auto publishWrench(const std::string& frameName,
BipedalLocomotion::
GenericContainer:: Vector<const double>::Ref wrench6d) -> bool - Publish the wrenches over the configured wrench topic associated to the frame.
-
auto publishTransform(const std::string& target,
const std::string& source,
const BipedalLocomotion::
GenericContainer:: Vector<const double>::Ref transformAsVector16d) -> bool - Publish transforms to the transform server.
- auto configureTransformServer(const std::string& transformServerPort) -> bool
- Configure which transform server to connect to.
- auto configureJointStatePublisher(const std::string& topicName) -> bool
- Configure the topic over which joint states are published.
- auto configureWrenchPublisher(const std::string& frameName, const std::string& topicName) -> bool
- Add or reconfigure a wrench publisher.
- auto removeWrenchPublisher(const std::string& frameName) -> bool
- Remove wrench publisher.
- auto operator=(const RosPublisher& other) -> RosPublisher& deleted
- delete copy assignment operator
- auto operator=(RosPublisher&& other) -> RosPublisher& deleted
- delete move assignment operator
Function documentation
BipedalLocomotion:: YarpUtilities:: RosPublisher:: RosPublisher(const std::string& nodeName)
Constructor.
Parameters | |
---|---|
nodeName in | Name of the ROS publisher node |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: initialize(std::weak_ptr<BipedalLocomotion:: ParametersHandler:: IParametersHandler> handler)
Configures the publishers and ROS topics for publishing messages The parameters used to configure the RosPublisher,.
Parameters | |
---|---|
handler in | Parameter handler |
- "joint_states_topic" name of the topic over which the joint states need to be published
- "transform_server_port" name of the already running transform server's remote port
- "WrenchPublishers" is group with the following parameters,
- "frame_names" a list containing the frames at which the published wrenches should be expressed
"topics" a list containing the topics over which the wrenches need to be published. Must be the same size and order as frame_names.
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: publishJointStates(const BipedalLocomotion:: GenericContainer:: Vector<const std::string>::Ref jointList,
const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointPositions)
Publish the joint states over the configured joint states topic The joint velocities and joint efforts are set to zero.
Parameters | |
---|---|
jointList in | list of joints |
jointPositions in | list of joint positions in m or rad with the same size as the joints list |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: publishJointStates(const BipedalLocomotion:: GenericContainer:: Vector<const std::string>::Ref jointList,
const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointPositions,
const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointVelocities)
Publish the joint states over the configured joint states topic The joint velocities and joint efforts are set to zero.
Parameters | |
---|---|
jointList in | list of joints |
jointPositions in | list of joint positions in m or rad with the same size as the joints list |
jointVelocities in | list of joint velocities in m/s or rad/s with the same size as the joints list |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: publishJointStates(const BipedalLocomotion:: GenericContainer:: Vector<const std::string>::Ref jointList,
const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointPositions,
const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointVelocities,
const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref jointEfforts)
Publish the joint states over the configured joint states topic The joint velocities and joint efforts are set to zero.
Parameters | |
---|---|
jointList in | list of joints |
jointPositions in | list of joint torques/forces in Nm or N with the same size as the joints list |
jointVelocities in | list of joint velocities in m/s or rad/s with the same size as the joints list |
jointEfforts |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: publishWrench(const std::string& frameName,
BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref wrench6d)
Publish the wrenches over the configured wrench topic associated to the frame.
Parameters | |
---|---|
frameName in | frame at which the wrench will be expressed |
wrench6d in | 6d wrench as force-torque in N-Nm with serialziation as fx fy fz tx ty tz |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: publishTransform(const std::string& target,
const std::string& source,
const BipedalLocomotion:: GenericContainer:: Vector<const double>::Ref transformAsVector16d)
Publish transforms to the transform server.
Parameters | |
---|---|
target in | target frame for the transform |
source in | source frame of the transform |
transformAsVector16d in | 4x4 transform as a vector data in row-major order |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: configureTransformServer(const std::string& transformServerPort)
Configure which transform server to connect to.
Parameters | |
---|---|
transformServerPort in | name of the transform server port |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: configureJointStatePublisher(const std::string& topicName)
Configure the topic over which joint states are published.
Parameters | |
---|---|
topicName in | topic name |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: configureWrenchPublisher(const std::string& frameName,
const std::string& topicName)
Add or reconfigure a wrench publisher.
Parameters | |
---|---|
frameName in | frame name |
topicName in | topic name |
bool BipedalLocomotion:: YarpUtilities:: RosPublisher:: removeWrenchPublisher(const std::string& frameName)
Remove wrench publisher.
Parameters | |
---|---|
frameName in | frame name |