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

gtsam prints pointers instead of values

asked 2021-02-25 09:01:50 -0600

Spyros gravatar image

updated 2021-02-25 09:33:20 -0600

Hello. I'm trying to run some of the gtsam library examples in one of my nodes. When one of the print function is called (i.e. result.print("Final Result:\n");) instead of printing values as shown in the tutorial, it prints pointers.

Final Result:

Values with 5 values:
Value 1: (gtsam::Pose2)
0x558a39e0fef0

Value 2: (gtsam::Pose2)
0x558a39e0ff50

Value 3: (gtsam::Pose2)
0x558a39e0cf10

Value 4: (gtsam::Pose2)
0x558a39e0cf70

Value 5: (gtsam::Pose2)
0x558a39e0cfd0

What can be the problem here? I installed the library with the procedure described here. Is it useful to uninstall and reinstall the library? and if it is, how can I do it without messing up with my nodes that already use gtsam?

Any kind of feedback is appreciated. Thanks in advance.

I use Ubuntu 18, ROS melodic and I have C++ nodes.

edit retag flag offensive close merge delete

Comments

I'm sorry to have to do this for something so seemingly unimportant, but please don't post screenshots of terminal text in question on ROS Answers. It's all text, so there is no need. Just copy-paste the text from the terminal into your question text. Do make sure to format it properly by selecting the text and pressing ctrl+k (or clicking the Preformatted Text button (the one with 101010 on it)).

You don't need to post a new question, just edit your curent one. You can use the edit button/link for this.

After you replace the screenshot with the error message itself, we can re-open your question.

gvdhoorn gravatar image gvdhoorn  ( 2021-02-25 09:23:29 -0600 )edit

@gvdhoorn it requires more than 200 points to reopen a question

Spyros gravatar image Spyros  ( 2021-02-25 09:35:13 -0600 )edit

that's why I wrote:

we can re-open your question.

gvdhoorn gravatar image gvdhoorn  ( 2021-02-25 09:44:33 -0600 )edit

Sorry, i didn't notice. Thanks.

Spyros gravatar image Spyros  ( 2021-02-25 11:30:40 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-02-26 06:43:46 -0600

Spyros gravatar image

I don't know what was causing the problem, but I managed to solve it like this:

  • I uninstalled gtsam by executing xargs rm -rf < install_manifest.txt from the build directory of the gtsam package, as described here.
  • I deleted the whole gtsam package directory with sudo rm -r gtsam/
  • I downloaded again the gtsam package by cloning the repository from here: git clone https://github.com/borglab/gtsam.git
  • I reinstalled the package from source, as described here. Note: I changed the make check and make install commands to sudo make check and sudo make install respectively.

Now the values are displayed as expected:

Final Result:

Values with 5 values:
Value 1: (gtsam::Pose2)
(-3.62586e-13, -1.35991e-12, -5.28358e-13)

Value 2: (gtsam::Pose2)
(2, -3.02085e-12, -7.54546e-13)

Value 3: (gtsam::Pose2)
(4, -3.9288e-11, 1.5708)

Value 4: (gtsam::Pose2)
(4, 2, 3.14159)

Value 5: (gtsam::Pose2)
(2, 2, -1.5708)
edit flag offensive delete link more

Comments

Is there a way to send gtsam::Values object, in your case the variable result, as a ROS message between nodes? I looked at creating custom ROS messages but I am confused on how to do this with gtsam::Values object and gtsam::NonlinearFactorGraph objects.

hunterlineage1 gravatar image hunterlineage1  ( 2023-07-21 11:20:03 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2021-02-25 09:01:50 -0600

Seen: 259 times

Last updated: Feb 26 '21