tf2_ros::Buffer::canTransform() returning False for existing transformationWhat should main() return in C and C++?Is it possible to write a template to check for a function's existence?Qt is not executing functions correctly as the console doesDeleting pointer to object in unordered_mapLong time to return from a method C++Suggestions on how to approach averaging of objects detectedUsing cv::rgbd::Odometry::computeLive 2D laser scanner data in rospyHow to drive a brushless motor using a commercial ESC with ROS?RTabMap Cannot locate node

How to level a picture frame hung on a single nail?

What's the global, general word that stands for "center tone of a song"?

Calculate the Ultraradical

SOQL injection vulnerability issue

What are one's options when facing religious discrimination at the airport?

Why does `FindFit` fail so badly in this simple case?

How to identify whether a publisher is genuine or not?

Everyone Gets a Window Seat

GPLv3 forces us to make code available, but to who?

Does the 'java' command compile Java programs?

How to have hashes doubled _and_ things expanded?

Enlightenment finding me

How do we know neutrons have no charge?

The answer is a girl's name (my future granddaughter) - can anyone help?

Does Bank Manager's discretion still exist in Mortgage Lending

Realistically, how much do you need to start investing?

Why does it seem the best way to make a living is to invest in real estate?

Can an untrusted VPN client monitor my network activity?

Windows 10 deletes lots of tiny files super slowly. Can anything that be done to speed it up?

Booting Ubuntu from USB drive on MSI motherboard -- EVERYTHING fails

Isn't the detector always measuring, and thus always collapsing the state?

Replace zeros in a list with last nonzero value

How dangerous is a very out-of-true disc brake wheel?

How to say "respectively" in German when listing (enumerating) things



tf2_ros::Buffer::canTransform() returning False for existing transformation


What should main() return in C and C++?Is it possible to write a template to check for a function's existence?Qt is not executing functions correctly as the console doesDeleting pointer to object in unordered_mapLong time to return from a method C++Suggestions on how to approach averaging of objects detectedUsing cv::rgbd::Odometry::computeLive 2D laser scanner data in rospyHow to drive a brushless motor using a commercial ESC with ROS?RTabMap Cannot locate node






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









1















I'm writing a package that, among other things, needs to get a transformation from the /base_laser frame to the (world) /odom frame. Both frames exist, and rosrun tf tf_echo /odom /base_laser returns the correct transformation values. The problem appears when I try to get the transformation using a TransformListener in my node; in this case, canTransform() always returns false.



The code is part of a test using the husky_simulator package to get the laser measurements and the environment.



This is the relevant part of the code:



tf2_ros::Buffer tfBuffer;
tf2_ros::TransformListener tfListener(tfBuffer);

geometry_msgs::TransformStamped transformStamped;

try

ros::Time now = ros::Time::now();
if (tfBuffer.canTransform("odom",
"base_laser",
now,
ros::Duration(0.01)))

transformStamped = tfBuffer.lookupTransform("odom",
"base_laser",
now);
ROS_INFO("canTransform: TRUE");
ROS_INFO("Transform: [%.2f, %.2f, %.2f]",
transformStamped.transform.translation.x,
transformStamped.transform.translation.y,
transformStamped.transform.translation.z);

else

ROS_INFO("canTransform: FALSE");


catch (tf2::TransformException &ex)

ROS_WARN("%s", ex.what());
ros::Duration(1);



When launching the node, the output shows the following:



[ INFO] [1553804232.701323614, 0.176000000]: canTransform: FALSE
[ INFO] [1553804232.736923460, 0.207000000]: canTransform: FALSE
[ INFO] [1553804232.813116964, 0.275000000]: canTransform: FALSE
[ INFO] [1553804232.856465945, 0.311000000]: canTransform: FALSE
[ INFO] [1553804232.923821528, 0.365000000]: canTransform: FALSE
[ INFO] [1553804233.977405692, 0.397000000]: canTransform: FALSE


and keeps this way, without returning a true.



This code is inside a function that is called periodically from the node main function. Everything else works as expected.



Running ROS Melodic in Ubuntu 18.04



Any help is welcome.










share|improve this question
































    1















    I'm writing a package that, among other things, needs to get a transformation from the /base_laser frame to the (world) /odom frame. Both frames exist, and rosrun tf tf_echo /odom /base_laser returns the correct transformation values. The problem appears when I try to get the transformation using a TransformListener in my node; in this case, canTransform() always returns false.



    The code is part of a test using the husky_simulator package to get the laser measurements and the environment.



    This is the relevant part of the code:



    tf2_ros::Buffer tfBuffer;
    tf2_ros::TransformListener tfListener(tfBuffer);

    geometry_msgs::TransformStamped transformStamped;

    try

    ros::Time now = ros::Time::now();
    if (tfBuffer.canTransform("odom",
    "base_laser",
    now,
    ros::Duration(0.01)))

    transformStamped = tfBuffer.lookupTransform("odom",
    "base_laser",
    now);
    ROS_INFO("canTransform: TRUE");
    ROS_INFO("Transform: [%.2f, %.2f, %.2f]",
    transformStamped.transform.translation.x,
    transformStamped.transform.translation.y,
    transformStamped.transform.translation.z);

    else

    ROS_INFO("canTransform: FALSE");


    catch (tf2::TransformException &ex)

    ROS_WARN("%s", ex.what());
    ros::Duration(1);



    When launching the node, the output shows the following:



    [ INFO] [1553804232.701323614, 0.176000000]: canTransform: FALSE
    [ INFO] [1553804232.736923460, 0.207000000]: canTransform: FALSE
    [ INFO] [1553804232.813116964, 0.275000000]: canTransform: FALSE
    [ INFO] [1553804232.856465945, 0.311000000]: canTransform: FALSE
    [ INFO] [1553804232.923821528, 0.365000000]: canTransform: FALSE
    [ INFO] [1553804233.977405692, 0.397000000]: canTransform: FALSE


    and keeps this way, without returning a true.



    This code is inside a function that is called periodically from the node main function. Everything else works as expected.



    Running ROS Melodic in Ubuntu 18.04



    Any help is welcome.










    share|improve this question




























      1












      1








      1








      I'm writing a package that, among other things, needs to get a transformation from the /base_laser frame to the (world) /odom frame. Both frames exist, and rosrun tf tf_echo /odom /base_laser returns the correct transformation values. The problem appears when I try to get the transformation using a TransformListener in my node; in this case, canTransform() always returns false.



      The code is part of a test using the husky_simulator package to get the laser measurements and the environment.



      This is the relevant part of the code:



      tf2_ros::Buffer tfBuffer;
      tf2_ros::TransformListener tfListener(tfBuffer);

      geometry_msgs::TransformStamped transformStamped;

      try

      ros::Time now = ros::Time::now();
      if (tfBuffer.canTransform("odom",
      "base_laser",
      now,
      ros::Duration(0.01)))

      transformStamped = tfBuffer.lookupTransform("odom",
      "base_laser",
      now);
      ROS_INFO("canTransform: TRUE");
      ROS_INFO("Transform: [%.2f, %.2f, %.2f]",
      transformStamped.transform.translation.x,
      transformStamped.transform.translation.y,
      transformStamped.transform.translation.z);

      else

      ROS_INFO("canTransform: FALSE");


      catch (tf2::TransformException &ex)

      ROS_WARN("%s", ex.what());
      ros::Duration(1);



      When launching the node, the output shows the following:



      [ INFO] [1553804232.701323614, 0.176000000]: canTransform: FALSE
      [ INFO] [1553804232.736923460, 0.207000000]: canTransform: FALSE
      [ INFO] [1553804232.813116964, 0.275000000]: canTransform: FALSE
      [ INFO] [1553804232.856465945, 0.311000000]: canTransform: FALSE
      [ INFO] [1553804232.923821528, 0.365000000]: canTransform: FALSE
      [ INFO] [1553804233.977405692, 0.397000000]: canTransform: FALSE


      and keeps this way, without returning a true.



      This code is inside a function that is called periodically from the node main function. Everything else works as expected.



      Running ROS Melodic in Ubuntu 18.04



      Any help is welcome.










      share|improve this question
















      I'm writing a package that, among other things, needs to get a transformation from the /base_laser frame to the (world) /odom frame. Both frames exist, and rosrun tf tf_echo /odom /base_laser returns the correct transformation values. The problem appears when I try to get the transformation using a TransformListener in my node; in this case, canTransform() always returns false.



      The code is part of a test using the husky_simulator package to get the laser measurements and the environment.



      This is the relevant part of the code:



      tf2_ros::Buffer tfBuffer;
      tf2_ros::TransformListener tfListener(tfBuffer);

      geometry_msgs::TransformStamped transformStamped;

      try

      ros::Time now = ros::Time::now();
      if (tfBuffer.canTransform("odom",
      "base_laser",
      now,
      ros::Duration(0.01)))

      transformStamped = tfBuffer.lookupTransform("odom",
      "base_laser",
      now);
      ROS_INFO("canTransform: TRUE");
      ROS_INFO("Transform: [%.2f, %.2f, %.2f]",
      transformStamped.transform.translation.x,
      transformStamped.transform.translation.y,
      transformStamped.transform.translation.z);

      else

      ROS_INFO("canTransform: FALSE");


      catch (tf2::TransformException &ex)

      ROS_WARN("%s", ex.what());
      ros::Duration(1);



      When launching the node, the output shows the following:



      [ INFO] [1553804232.701323614, 0.176000000]: canTransform: FALSE
      [ INFO] [1553804232.736923460, 0.207000000]: canTransform: FALSE
      [ INFO] [1553804232.813116964, 0.275000000]: canTransform: FALSE
      [ INFO] [1553804232.856465945, 0.311000000]: canTransform: FALSE
      [ INFO] [1553804232.923821528, 0.365000000]: canTransform: FALSE
      [ INFO] [1553804233.977405692, 0.397000000]: canTransform: FALSE


      and keeps this way, without returning a true.



      This code is inside a function that is called periodically from the node main function. Everything else works as expected.



      Running ROS Melodic in Ubuntu 18.04



      Any help is welcome.







      c++ ros






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 1 at 16:16







      davidvg

















      asked Mar 28 at 20:21









      davidvgdavidvg

      64 bronze badges




      64 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          I finally found what was going on: the husky_simulator code uses tf while I was trying to get the transforms using tf2; once I switched to tf, the transform was found.






          share|improve this answer


























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406243%2ftf2-rosbuffercantransform-returning-false-for-existing-transformation%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0
















            I finally found what was going on: the husky_simulator code uses tf while I was trying to get the transforms using tf2; once I switched to tf, the transform was found.






            share|improve this answer





























              0
















              I finally found what was going on: the husky_simulator code uses tf while I was trying to get the transforms using tf2; once I switched to tf, the transform was found.






              share|improve this answer



























                0














                0










                0









                I finally found what was going on: the husky_simulator code uses tf while I was trying to get the transforms using tf2; once I switched to tf, the transform was found.






                share|improve this answer













                I finally found what was going on: the husky_simulator code uses tf while I was trying to get the transforms using tf2; once I switched to tf, the transform was found.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 1 at 16:19









                davidvgdavidvg

                64 bronze badges




                64 bronze badges

































                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406243%2ftf2-rosbuffercantransform-returning-false-for-existing-transformation%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해