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

Error running C++ file on ROS, what am I doing wrong? --- std_msgs::Float64: command not found

asked 2020-03-11 17:38:41 -0600

user_engin_22 gravatar image

here's all the errors I got:

/home/ws/src/motor_controller/src/convertor.cpp: line 6: std_msgs::Float64: command not found
/home/ws/src/motor_controller/src/convertor.cpp: line 7: std_msgs::Float64: command not found
/home/ws/src/motor_controller/src/convertor.cpp: line 8: std_msgs::Float64: command not found
/home/ws/src/motor_controller/src/convertor.cpp: line 9: std_msgs::Float64: command not found
/home/ws/src/motor_controller/src/convertor.cpp: line 10: std_msgs::Float64: command not found
/home/ws/src/motor_controller/src/convertor.cpp: line 11: std_msgs::Float64: command not found
/home/ws/src/motor_controller/src/convertor.cpp: line 13: syntax error near unexpected token `('
/home/materov/MATEROV_2019_ws/src/motor_controller/src/convertor.cpp: line 13: `void callbackRollSetpoint(const std_msgs::Float64::ConstPtr& msg64){'

I'm not sure why my code is not running due to the errors because it seems to compile just fine (by entering catkin_make in my workspace), and it seems that it doesn't recognize Float64 as a type in the code, although I included the std_msgs Float64 type??? Feedback greatly appreciated!!!

edit retag flag offensive close merge delete

Comments

Please post content of your convertor.cpp file, so we have more information

Thazz gravatar image Thazz  ( 2020-03-13 04:30:00 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-03-12 02:14:06 -0600

gvdhoorn gravatar image

updated 2020-03-12 02:15:19 -0600

C++ is a language which must be compiled before you can run any executables.

You cannot execute a .cpp directly.

You'll first have to build your workspace (see wiki/catkin/Tutorials/create_a_workspace for a bare-bones tutorial about this).

I would suggest you first try and find some good C++ tutorials, get sufficient experience with it and then come back to ROS. Learning all of this at the same time is not easy -- or at least, that is what my students tell me.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2020-03-11 17:38:41 -0600

Seen: 838 times

Last updated: Mar 12 '20