Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problems with geometry_msgs::PoseStamped

Hi, I am try to write a tool that uses geometry_msgs::PoseStamped. Unfortunately I always get the error

src/systemplatform.cpp.o: In function `feedbackLoop(geometry_msgs::PoseStamped_<std::allocator<void> > const&)':  .../systemplatform.cpp:44: undefined reference to `Tool::getPose(geometry_msgs::PoseStamped_<std::allocator<void> >, double*)' 
collect2: error: ld returned 1 exit status

The error appears in Source File: systemplatform.c with the call of tool.getPose(msgPose, posetypeRNum); I don't find the error, but can imagine that is related to the use or call of msgPose which should be geometry_msgs::PoseStamped rosTopicMsg; It would be really nice if you could help me. I have added the code as following:

Thanks a lot in Advance!!!

//=============================================================================

//Header File: systemplatform.c

/* Required Headers */
#include "ros/ros.h"
#include "geometry_msgs/Twist.h"
#include "std_msgs/String.h"
#include "std_msgs/Empty.h"
#include "std_srvs/Empty.h"
#include <cstdlib>
#include <string>
#include <iostream>
#include <curses.h>
#include "tf/tf.h"
#include "tf/transform_broadcaster.h"
#include "geometry_msgs/PoseStamped.h"
#include "tool.h"

//=============================================================================

//Source File: systemplatform.c

#include "systemplatform.h"

/*Tool-class-pointers*/
Tool toolPtr;

/*Subscriber initialization*/
ros::Subscriber toolSubscriber;


void feedbackLoop(const geometry_msgs::PoseStamped& msgPose)
{
    typeRNum posetypeRNum [5]={0,0,0,0,0};
    tool.getPose(msgPose, posetypeRNum);
}

int main(int argc, char **argv)
{

    ros::init(argc, argv, "tool");
    ros::NodeHandle ntool;  //For receiving OptitrackData

    toolSubscriber = ntool.subscribe("tooltopic", 10, feedbackLoop);
    ros::spin();

    return 0;
}

//=============================================================================

//Header File: tool.h

/* Required Headers */
#include "ros/ros.h"
#include "geometry_msgs/Twist.h"
#include "tf/tf.h"
#include "tf/transform_broadcaster.h"
#include "geometry_msgs/PoseStamped.h"

class Tool
{
  public:

  void getPose(geometry_msgs::PoseStamped rosTopicMsg, double* posetypeRNum);
};
#endif

//=============================================================================

//Source File: tool.cpp

#include "tool.h"
void Toll::getPose(geometry_msgs::PoseStamped rosTopicMsg, double* array)
{
...
}