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

What is float64?

asked 2015-03-21 09:56:26 -0500

abcgarden gravatar image

Many ROS message uses the date type float64 so I decided to use this type in my code but I have this error:

   error: ‘float64’ does not name a type
             private: float64 direction_x_;
                      ^

I cannot find out the definition of float64. Anyone can tell me what files I should include to find out this data type definition?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2015-03-21 13:50:43 -0500

Thomas D gravatar image

updated 2015-03-21 13:52:46 -0500

Dan's answer is correct for describing what a float64 is.

If you want to get rid of the error you are seeing you probably need to have the following in your source (or header) file:

#include <std_msgs/Float64.h>

and change your variable declaration to:

std_msgs::Float64 direction_x_;

Check out the std_msgs and float64 wiki pages. You may also need to add std_msgs to your package.xml and CMakeLists.txt files in your package.

edit flag offensive delete link more

Comments

Thank you @dan, @Thomas. Actually, these two answers combine to be the best answer. But in the std_msgs/Float64 there is one filed "float64 data". It seems that the initial float64 is defined elsewhere. What's the source?

abcgarden gravatar image abcgarden  ( 2015-03-21 18:19:51 -0500 )edit
6

answered 2015-03-21 10:54:35 -0500

The msg wiki page has a table showing what message types are deserialized to in Python and C++. Specifically, float64 is a double (C++) or float (Python).

edit flag offensive delete link more

Comments

Thak you Dan Lazewatsky, this is the best answer.

أسامة الادريسي gravatar image أسامة الادريسي  ( 2017-06-30 09:57:19 -0500 )edit

This info helps.

Bo Shang gravatar image Bo Shang  ( 2017-08-25 17:01:11 -0500 )edit

This is the best answer.

Amos gravatar image Amos  ( 2018-03-16 01:30:52 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-21 09:56:26 -0500

Seen: 24,724 times

Last updated: Mar 21 '15