SMACC
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
cl_move_base_z::CpTFListener Class Reference

#include <cp_tf_listener.h>

Inheritance diagram for cl_move_base_z::CpTFListener:
Inheritance graph
Collaboration diagram for cl_move_base_z::CpTFListener:
Collaboration graph

Public Member Functions

 CpTFListener ()
 
virtual void update () override
 
void getLastTransform (std::string &targetPoseFrameName, std::string &referenceBaseFrame, geometry_msgs::Pose &out)
 
std::future< geometry_msgs::Pose > waitForNextTransform (std::string &targetName, std::string &referenceBaseFrame)
 
- Public Member Functions inherited from smacc::ISmaccComponent
 ISmaccComponent ()
 
virtual ~ISmaccComponent ()
 
virtual std::string getName () const
 
- Public Member Functions inherited from smacc::ISmaccUpdatable
 ISmaccUpdatable ()
 
 ISmaccUpdatable (ros::Duration duration)
 
void executeUpdate ()
 
void setUpdatePeriod (ros::Duration duration)
 

Private Attributes

std::mutex m_mutex_
 
std::list< std::shared_ptr< TfPoseTrack > > poseTracks_
 

Static Private Attributes

static std::shared_ptr< tf::TransformListener > tfListener_
 
static std::mutex listenerMutex_
 

Additional Inherited Members

- Protected Member Functions inherited from smacc::ISmaccComponent
virtual void initialize (ISmaccClient *owner)
 
void setStateMachine (ISmaccStateMachine *stateMachine)
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage)
 
template<typename TClient >
void requiresClient (TClient *&requiredClientStorage)
 
virtual void onInitialize ()
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createSiblingComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createSiblingNamedComponent (std::string name, TArgs... targs)
 
virtual void update ()=0
 
- Protected Attributes inherited from smacc::ISmaccComponent
ISmaccStateMachinestateMachine_
 
ISmaccClientowner_
 

Detailed Description

Definition at line 29 of file cp_tf_listener.h.

Constructor & Destructor Documentation

◆ CpTFListener()

cl_move_base_z::CpTFListener::CpTFListener ( )

Member Function Documentation

◆ getLastTransform()

void cl_move_base_z::CpTFListener::getLastTransform ( std::string &  targetPoseFrameName,
std::string &  referenceBaseFrame,
geometry_msgs::Pose &  out 
)
inline

Definition at line 62 of file cp_tf_listener.h.

63 {
64 }

◆ update()

virtual void cl_move_base_z::CpTFListener::update ( )
inlineoverridevirtual

Implements smacc::ISmaccUpdatable.

Definition at line 34 of file cp_tf_listener.h.

35 {
36 for(auto& poseTrack: poseTracks_)
37 {
38 tf::StampedTransform transform;
39 try
40 {
41 {
42 std::lock_guard<std::mutex> lock(listenerMutex_);
43 tfListener_->lookupTransform(poseTrack->referenceBaseFrame_,poseTrack->targetPoseFrame_,
44 ros::Time(0), transform);
45 }
46
47 {
48 std::lock_guard<std::mutex> guard(m_mutex_);
49 tf::poseTFToMsg(transform, poseTrack->pose_.pose);
50 poseTrack->pose_.header.stamp = transform.stamp_;
51 poseTrack->pose_.header.frame_id = poseTrack->referenceBaseFrame_;
52 poseTrack->isInitialized = true;
53 }
54 }
55 catch (tf::TransformException ex)
56 {
57 ROS_ERROR_STREAM_THROTTLE(1, "[Component pose] (" << poseFrameName_ << "/[" << referenceFrame_ << "] ) is failing on pose update : " << ex.what());
58 }
59 }
60 }
std::list< std::shared_ptr< TfPoseTrack > > poseTracks_
static std::shared_ptr< tf::TransformListener > tfListener_
static std::mutex listenerMutex_

References listenerMutex_, m_mutex_, poseTracks_, and tfListener_.

◆ waitForNextTransform()

std::future< geometry_msgs::Pose > cl_move_base_z::CpTFListener::waitForNextTransform ( std::string &  targetName,
std::string &  referenceBaseFrame 
)
inline

Definition at line 66 of file cp_tf_listener.h.

67 {
68 tracks_
69 }

Member Data Documentation

◆ listenerMutex_

std::mutex cl_move_base_z::CpTFListener::listenerMutex_
staticprivate

Definition at line 73 of file cp_tf_listener.h.

Referenced by update().

◆ m_mutex_

std::mutex cl_move_base_z::CpTFListener::m_mutex_
private

Definition at line 75 of file cp_tf_listener.h.

Referenced by update().

◆ poseTracks_

std::list<std::shared_ptr<TfPoseTrack> > cl_move_base_z::CpTFListener::poseTracks_
private

Definition at line 76 of file cp_tf_listener.h.

Referenced by update().

◆ tfListener_

std::shared_ptr<tf::TransformListener> cl_move_base_z::CpTFListener::tfListener_
staticprivate

Definition at line 72 of file cp_tf_listener.h.

Referenced by update().


The documentation for this class was generated from the following file: