1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-10 01:50:46 +02:00

Improved RTPublisher

This commit is contained in:
Simon Rasmussen
2017-02-16 22:49:10 +01:00
parent a78d3eadf3
commit b422107c08
2 changed files with 62 additions and 14 deletions

View File

@@ -6,11 +6,15 @@
#include <geometry_msgs/WrenchStamped.h>
#include <ros/ros.h>
#include <sensor_msgs/JointState.h>
#include <sensor_msgs/Temperature.h>
#include <tf/tf.h>
#include <tf/transform_broadcaster.h>
#include <vector>
#include "ur_modern_driver/ur/consumer.h"
using namespace ros;
using namespace tf;
const std::string JOINTS[] = {
"shoulder_pan_joint",
@@ -27,21 +31,28 @@ private:
Publisher _joint_pub;
Publisher _wrench_pub;
Publisher _tool_vel_pub;
Publisher _joint_temperature_pub;
TransformBroadcaster _transform_broadcaster;
std::vector<std::string> _joint_names;
std::string _base_frame;
std::string _tool_frame;
bool publish_joints(RTShared& packet, ros::Time& t);
bool publish_wrench(RTShared& packet, ros::Time& t);
bool publish_tool(RTShared& packet, ros::Time& t);
bool publish_joints(RTShared& packet, Time& t);
bool publish_wrench(RTShared& packet, Time& t);
bool publish_tool(RTShared& packet, Time& t);
bool publish_transform(RTShared& packet, Time& t);
bool publish_temperature(RTShared& packet, Time& t);
bool publish(RTShared& packet);
public:
RTPublisher(std::string& joint_prefix, std::string& base_frame)
RTPublisher(std::string& joint_prefix, std::string& base_frame, std::string& tool_frame)
: _joint_pub(_nh.advertise<sensor_msgs::JointState>("joint_states", 1))
, _wrench_pub(_nh.advertise<geometry_msgs::WrenchStamped>("wrench", 1))
, _tool_vel_pub(_nh.advertise<geometry_msgs::TwistStamped>("tool_velocity", 1))
, _joint_temperature_pub(_nh.advertise<sensor_msgs::Temperature>("joint_temperature", 1))
, _base_frame(base_frame)
, _tool_frame(tool_frame)
{
for (auto const& j : JOINTS) {
_joint_names.push_back(joint_prefix + j);