TurtleBot Real Robot cannot do Math (?!)

Hi The Construct Team,

I have been using TurtleBot in Real Robot Lab and I am experiencing something really weird.

I am using #include <cmath> in my C++ program to perform pow() function for squares and square root calculation.

I have a piece of code [sorry I cannot share it here] that calculates standard deviation.

The calculation works fine in Simulation but not on Real Robot.

Can somebody help me? Attached screenshots below.

Simulation Results: [WORKS FINE HERE]

Real Robot Lab: [Displays long values or negative nan or infinity - standard deviation should be positive, non-zero and non-infinite number]

Thanks in advance,
Girish

Hello @girishkumar.kannan,

without seeing the code that confirms your claim I can only speculate at this time and do some wild-guessing.
Maybe between simulation and real robot there is an input that is changed, or reversed, right is left and left is right or up is down and down is up. could be one possible cause. I would start checking that and follow each step from input to the output on the screen an compare both in simulation and real robot.
The very last cause that i would think of is that one of the core c++ libraries are broken. But should you regardless think that the math library is broken after carefully checking everything multiple times you could try build your code with a different compiler. But this might be a major undertaking since the process is not free of pain. I would not recommend doing that.
Sorry if I am kind of poking around in the dark but without the code and the environment where it runs I am feeling that further troubleshooting is not really effective at the moment.

Cheers,

Roberto

2 Likes

Hi @rzegers ,

Thanks you very much for replying. I almost forgot I posted this.
I had written the code this way for the ROS Basics in 5 Days with C++.
At this point, I have finished my presentation for ROS Basics course (Py and C++) and have obtained the certificates.
Nevertheless, I will share the code as a private message with a link to this post.

Just like you explained, I noticed that the real robot arena was rotated 180 degrees.
To give you a quick reference, the double pedestrian crossing line that you see next to the 4 obstacles in the center of the arena was actually on the direct diagonal opposite side in the real robot. So as you said, the left was right and up was down.

Thank you very much for getting back to me on this issue.
Girish

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.