ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

arkin's profile - activity

2022-09-11 17:37:30 -0500 received badge  Self-Learner (source)
2022-09-11 17:37:30 -0500 received badge  Teacher (source)
2020-04-27 21:15:15 -0500 commented answer frame passed to lookupTransform does not exist

Good explanation, and thanks!

2020-04-27 21:14:43 -0500 received badge  Supporter (source)
2018-07-20 11:43:01 -0500 received badge  Famous Question (source)
2018-06-12 04:40:35 -0500 received badge  Notable Question (source)
2017-10-13 01:23:31 -0500 marked best answer class construction error when using tf2_ros::Buffer

Hi all, I am trying to use tf2_ros::Buffer in a simple code. When I put it in the main function, everything works fine. But when put in a class, building error occurs. The code is like this:

#include <ros/ros.h>
#include <tf2_ros/buffer.h>
#include <tf2_ros/transform_listener.h>
#include <geometry_msgs/TransformStamped.h>
#include <geometry_msgs/Twist.h>

class test_class

{
private:
    double start;
    double duration;
    ros::Time start_time;
    ros::Time end_time;
    std::string robot_name;

    tf2_ros::Buffer tf_buffer; // problem
    tf2_ros::TransformListener* tfListener;
    geometry_msgs::TransformStamped transformStamped;

public:
    std::string space_name;
    std::string node_name;

    test_class()
    {
        space_name = ros::this_node::getNamespace();
        node_name = ros::this_node::getName();
    }

    ~test_class()
    {}

    bool initialize(const ros::NodeHandle& n)
    {
        ROS_INFO("Class auto_mav_flight initialized done!");
        return true;
    }
    void timer_callback(const ros::TimerEvent& event)
    {
        ROS_INFO("Timer Callback triggered.");
        return;
    }
}; 

int main(int argc, char** argv)
{
    ros::init(argc, argv, "auto_mav_node");
    ros::NodeHandle node;
    ROS_WARN("The node is initilized and started.");
    test_class amf = test_class();
    amf.initialize(node);
    ros::Timer timer_1 = node.createTimer(ros::Duration(0.5), &test_class::timer_callback, &amf);
    ros::spin();
    return EXIT_SUCCESS;
}

and the building error information is:

/home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp: In function ‘int main(int, char**)’:
/home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:73:44: error: no matching function for call to ‘test_class::test_class(test_class)’
  test_class amf = test_class();
                                            ^
/home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:73:44: note: candidates are:
/home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:26:2: note: test_class::test_class()
  test_class()
  ^
/home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:26:2: note:   candidate expects 0 arguments, 1 provided
/home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:9:7: note: test_class::test_class(test_class&)
 class test_class
       ^
/home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:9:7: note:   no known conversion for argument 1 from ‘test_class’ to ‘test_class&’
make[2]: *** [auto_mav_flight/CMakeFiles/auto_mav_flight_node.dir/src/node_main.cpp.o] Error 1
make[1]: *** [auto_mav_flight/CMakeFiles/auto_mav_flight_node.dir/all] Error 2
make: *** [all] Error 2

I found that if I comment the code line:

 tf2_ros::Buffer tf_buffer;

the error disappear.

Why the tf2_ros::Buffer can cause problem of class construction even I just declare it as a member of class?

Any help will be appreciated.

Thanks in advance.

2017-10-13 01:23:31 -0500 received badge  Scholar (source)
2017-10-13 01:23:23 -0500 edited answer class construction error when using tf2_ros::Buffer

For reference: https://stackoverflow.com/questions/46662748/building-error-when-declare-tf2-rosbuffer-in-class From tf2

2017-10-13 01:20:50 -0500 commented answer class construction error when using tf2_ros::Buffer

Sure, Thank you. :-)

2017-10-12 01:39:49 -0500 received badge  Enthusiast
2017-10-11 10:45:34 -0500 received badge  Popular Question (source)
2017-10-11 08:36:45 -0500 answered a question class construction error when using tf2_ros::Buffer

For reference: https://stackoverflow.com/questions/46662748/building-error-when-declare-tf2-rosbuffer-in-class

2017-10-10 04:11:32 -0500 edited question class construction error when using tf2_ros::Buffer

class construction error when using tf2_ros::Buffer Hi all, I am trying to use tf2_ros::Buffer in a simple code. When I

2017-10-10 03:34:10 -0500 edited question class construction error when using tf2_ros::Buffer

class construction error when using tf2_ros::Buffer Hi all, I am trying to use tf2_ros::Buffer in a simple code. When I

2017-10-10 03:31:33 -0500 edited question class construction error when using tf2_ros::Buffer

class construction error when using tf2_ros::Buffer Hi all, I am trying to use tf2_ros::Buffer in a simple code. When I

2017-10-10 02:34:33 -0500 edited question class construction error when using tf2_ros::Buffer

class construction error when using tf2_ros::Buffer Hi all, I am trying to use tf2_ros::Buffer in a simple code as follo

2017-10-10 02:33:04 -0500 edited question class construction error when using tf2_ros::Buffer

class construction error when using tf2_ros::Buffer Hi all, I am trying to use tf2_ros::Buffer in a simple code as follo

2017-10-10 02:30:09 -0500 edited question class construction error when using tf2_ros::Buffer

class construction error when using tf2_ros::Buffer Hi all, I am trying to use tf2_ros::Buffer in a simple code as follo

2017-10-09 23:47:26 -0500 asked a question class construction error when using tf2_ros::Buffer

class construction error when using tf2_ros::Buffer Hi all, I am trying to use tf2_ros::Buffer in a simple code as follo

2017-07-16 11:16:30 -0500 received badge  Great Question (source)
2016-04-04 23:18:06 -0500 received badge  Good Question (source)
2015-08-16 12:25:30 -0500 received badge  Nice Question (source)
2015-05-03 19:13:51 -0500 received badge  Student (source)
2014-08-16 01:48:41 -0500 received badge  Famous Question (source)
2014-08-15 09:27:07 -0500 commented question How to install ROS indigo in Ubuntu 14.04 trusty 64-bit?

I don't know how to make the code typed in a console showed in a cell. How to make it? It makes the text very easy to read.

2014-08-15 09:19:09 -0500 commented answer How to install ROS indigo in Ubuntu 14.04 trusty 64-bit?

Thank you. I tried the commands and replaced the "$DISTRIB_CODENAME" with my ubuntu versin "trusty", but it still does not work. It shows:

$uname -m

arkin@arkin-OptiPlex-790:~$ sudo apt-get install ros-indigo-desktop-full

Reading package lists... Done Building dependency tree
Reading state information... Done

Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.

The following information may help to resolve the situation:

The following packages have unmet dependencies: ros-indigo-desktop-full:i386 : Depends: ros-indigo-desktop:i386 but it is not going to be installed Depends: ros-indigo-perception:i386 but it is not going to be installed Depends: ros-indigo-simulators:i386 but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

Is there any problems with my package manager setting ... (more)

2014-08-14 10:09:38 -0500 received badge  Notable Question (source)
2014-08-14 09:00:11 -0500 received badge  Editor (source)
2014-08-14 08:59:21 -0500 edited question How to install ROS indigo in Ubuntu 14.04 trusty 64-bit?

when I tried to install ROS in a 64-bit Ubuntu, some problems occurred.


arkin@arkin-OptiPlex-790:~$ sudo apt-get install ros-indigo-desktop-full 

Reading package lists... Done

Building dependency tree     

Reading state information... Done

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:

 ros-indigo-desktop-full:i386 : 

Depends: ros-indigo-desktop:i386 but it is not going to be installed

Depends: ros-indigo-perception:i386 but it is not going to be installed

Depends: ros-indigo-simulators:i386 but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

===============================================

What is the problem? How to solve it?

Also I tried in Synaptic. I typed "ros-indigo-desktop" in the filter and the results are:

ros-indigo-rosh-desktop: i386

ros-indigo-rosh-desktop-plugins: i386

ros-indigo-desktop-full: i386

ros-indigo-desktop: i386

why they all have an suffix "i386"? (my OS is Ubuntu-14.04-AMD64)

But if I search it in terminal, it shows that:

arkin@arkin-OptiPlex-790:~$ sudo apt-cache search ros-indigo-desktop

[sudo] password for arkin: 

ros-indigo-desktop - A metapackage to aggregate several packages.

ros-indigo-desktop-full - A metapackage to aggregate several packages.

Does the ROS have 64bits version and 32bits version respectively?

How to install a 64-bit version of ROS correctly in a AMD64 version of Ubuntu 14.04 trusty?

Thank you!

2014-08-14 08:39:26 -0500 received badge  Popular Question (source)
2014-08-14 08:04:11 -0500 commented answer How to install ROS indigo in Ubuntu 14.04 trusty 64-bit?

I just tried to install the ROS indigo following the tips on the ROS website http://wiki.ros.org/indigo/Installati... . But how to let the apt-get download a AMD64 version ROS? Is there ROS indigo 64bits and 32bits respectively?