55 #include <geometry_msgs/TransformStamped.h> 67 geometry_msgs::TransformStamped
operator()(
const geometry_msgs::TransformStamped& elem)
69 geometry_msgs::TransformStamped result = elem;
79 tf2_msgs::TFMessage
transformsToMessage(
const std::vector<geometry_msgs::TransformStamped>& tforms,
const std::string& prefix)
81 tf2_msgs::TFMessage msg;
83 msg.transforms.reserve(tforms.size());
84 std::transform(tforms.begin(), tforms.end(), msg.transforms.begin(),
PrefixResolver(prefix));
92 tf2::BufferCore(
ros::Duration(BufferCore::DEFAULT_CACHE_TIME) ),
93 prop_cache_time( BufferCore::DEFAULT_CACHE_TIME ),
94 prop_buffer_size(DEFAULT_BUFFER_SIZE)
110 .doc(
"Lookup the most recent transform from source to target.")
111 .arg(
"target",
"target frame")
112 .arg(
"source",
"source frame");
115 .doc(
"Lookup the most recent transform from source to target at a specific time.")
116 .arg(
"target",
"Target frame")
117 .arg(
"source",
"Source frame")
118 .arg(
"common_time",
"[ros::Time] The common time at which the transform should be computed");
121 .doc(
"Broadcast a stamped transform immediately.")
122 .arg(
"transform",
"[geometry_msgs::TransformStamped]");
125 .doc(
"Broadcast stamped transforms immediately.")
126 .arg(
"transforms",
"[std::vector<geometry_msgs::TransformStamped>]");
129 .doc(
"Broadcast a stamped transform as a static transform immediately.")
130 .arg(
"transform",
"[geometry_msgs::TransformStamped]");
133 .doc(
"Broadcast stamped transforms as static transforms immediately.")
134 .arg(
"transforms",
"[std::vector<geometry_msgs::TransformStamped>]");
137 .doc(
"Check if the transform from source to target can be resolved.")
138 .arg(
"target",
"Target frame")
139 .arg(
"source",
"Source frame");
142 .doc(
"Check if the transform from source to target can be resolved for a given common time.")
143 .arg(
"target",
"Target frame")
144 .arg(
"source",
"Source frame")
145 .arg(
"common_time",
"[ros::Time] The common time for which the transform would resolve");
154 std::string tf_prefix_param_key;
155 if(nh.
searchParam(
"tf_prefix",tf_prefix_param_key)) {
185 const std::string authority =
"unknown_authority";
188 for (std::size_t i = 0; i < msg.transforms.size(); ++i) {
190 this->
setTransform(msg.transforms[i], authority, is_static);
192 log(
Error) <<
"Failure to set received transform from " 193 << msg.transforms[i].child_frame_id <<
" to " 194 << msg.transforms[i].header.frame_id
195 <<
" with error: " << ex.what() << endlog();
209 tf2_msgs::TFMessage msg_in;
213 catch (std::exception& ex)
215 log(
Error) << ex.what() << endlog();
228 const std::string& target,
229 const std::string& source)
const 242 const std::string& target,
243 const std::string& source)
const 249 const std::string& target,
250 const std::string& source)
const 256 const std::string& target,
257 const std::string& source,
264 const std::string& target,
265 const std::string& source,
273 const std::vector<geometry_msgs::TransformStamped> tforms(1, tform);
286 const std::vector<geometry_msgs::TransformStamped> tforms(1, tform);
Property< T > & addProperty(const std::string &name, T &attr)
bool canTransform(const std::string &target, const std::string &source) const
void addTFOperations(RTT::Service::shared_ptr service)
geometry_msgs::TransformStamped lookupTransform(const std::string &target, const std::string &source) const
ORO_CREATE_COMPONENT(BroadcasterComponent)
Service::shared_ptr provides()
bool setTransform(const geometry_msgs::TransformStamped &transform, const std::string &authority, bool is_static=false)
base::InputPortInterface & addEventPort(const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction())
ros::Time getLatestCommonTime(const std::string &target, const std::string &source) const
RTT::OutputPort< tf2_msgs::TFMessage > port_tf_static_out
std::string resolve(const std::string &prefix, const std::string &frame_name)
bool searchParam(const std::string &key, std::string &result) const
bool canTransformAtTime(const std::string &target, const std::string &source, const ros::Time &common_time) const
RTT::OutputPort< tf2_msgs::TFMessage > port_tf_out
base::PortInterface & addPort(const std::string &name, base::PortInterface &port)
virtual bool createStream(ConnPolicy const &policy)
void broadcastTransform(const geometry_msgs::TransformStamped &tform)
const std::string & prefix_
bool canTransform(const std::string &target_frame, const std::string &source_frame, const ros::Time &time, std::string *error_msg=NULL) const
static ConnPolicy buffer(int size, int lock_policy=LOCK_FREE, bool init_connection=false, bool pull=false)
WriteStatus write(const T &sample)
RTT::InputPort< tf2_msgs::TFMessage > port_tf_static_in
CompactFrameID _lookupFrameNumber(const std::string &frameid_str) const
RTT::InputPort< tf2_msgs::TFMessage > port_tf_in
void internalUpdate(tf2_msgs::TFMessage &msg, RTT::InputPort< tf2_msgs::TFMessage > &port, bool is_static)
PrefixResolver(const std::string &prefix)
int _getLatestCommonTime(CompactFrameID target_frame, CompactFrameID source_frame, ros::Time &time, std::string *error_string) const
void broadcastTransforms(const std::vector< geometry_msgs::TransformStamped > &tforms)
virtual void disconnect()
void broadcastStaticTransforms(const std::vector< geometry_msgs::TransformStamped > &tforms)
bool getParam(const std::string &key, std::string &s) const
void broadcastStaticTransform(const geometry_msgs::TransformStamped &tform)
tf2_msgs::TFMessage transformsToMessage(const std::vector< geometry_msgs::TransformStamped > &tforms, const std::string &prefix)
geometry_msgs::TransformStamped operator()(const geometry_msgs::TransformStamped &elem)
RTT_TF(std::string const &name)
geometry_msgs::TransformStamped lookupTransformAtTime(const std::string &target, const std::string &source, const ros::Time &common_time) const
std::string prop_tf_prefix
geometry_msgs::TransformStamped lookupTransform(const std::string &target_frame, const std::string &source_frame, const ros::Time &time) const
virtual const std::string & getName() const