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

fatal error: ros/ros.h: No such file or directory

asked 2018-08-17 05:16:29 -0500

Aklinahs gravatar image

updated 2018-08-17 05:27:01 -0500

I'm getting the error

fatal error: ros/ros.h: No such file or directory

when i'm trying

catkin_make

here is my CPP code

 //this progamme publishes randomly-genarated velosity messages for turtlesim
#include "ros/ros.h"
#include "geometry_msgs/Twist.h" //for geometry_msgs::Twist
#include "stdlib.h" // for rand() and RAND_MAX

int main(int argc, char **argv){

  //initialize the ROS system and become a node.
  ros::init(argc, argv, "publish_velocity");
  ros::NodeHandle nh;

  //Create a publisher object.
  ros::Publisher pub = nh.advertise<geometry_msgs::Twist>("turtle1/cmd_vel", 1000);

  //seed the random number genarator
  srand(timeO(0));

  //Loop at 2Hz until the node is shut down
  ros::Rate rate(2);
  while(ros::ok()){

    //The other four fields, set default to 0
    geomatry_msgs::Twist msg;
    msg.linear.x = double(rand())/double(RAND_MAX);
    msg.angular.z = 2*double(rand())/double(RAND_MAX)-1 ;

    //publish the message
    pub.publish(msg);

    //Send a message to rosout with the details.
    ROS_INFO_STREAM("Sending random Velocity command:" <<" Linear = " <<msg.linear.x <<" Angular = " <<msg.angular.z);

    //wait till next iteration
    rate.sleep();
    }
  }

And here is my CMakelist file

cmake_minimum_required(VERSION 2.8.3)

project(velocity)

find_package(catkin REQUIRED COMPONENTS roscpp geometry_msgs)

catkin_package()

include_directories(include${catkin_INCLUDE_DIRS})


add_executable(vel pubvel.cpp)


target_link_libraries(vel ${catkin_LIBRARIES})

and here is the package.XML

<?xml version="1.0"?>
<package format="2">
  <name>velocity</name>
  <version>0.0.0</version>
  <description>The velocity package</description>

  <maintainer email="aklinahs@todo.todo">aklinahs</maintainer>

  <license>TODO</license>

  <build_depend>roscpp</build_depend>
  <build_depend>geometry_msgs</build_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>geometry_msgs</exec_depend>

  <buildtool_depend>catkin</buildtool_depend>


  <export>

  </export>
</package>

what could be the wrong here,....

edit retag flag offensive close merge delete

Comments

1

please help me....

Please don't add these sort of things to questions.

We already know you're looking for help, otherwise you wouldn't be posting here.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-17 05:19:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-17 05:19:16 -0500

gvdhoorn gravatar image
include_directories(include${catkin_INCLUDE_DIRS})

This is missing a space between include and ${catkin_INCLUDE_DIRS}.

edit flag offensive delete link more

Comments

Thanks it worked , thanks a lot (y)

Aklinahs gravatar image Aklinahs  ( 2018-08-17 05:27:44 -0500 )edit

Question Tools

Stats

Asked: 2018-08-17 05:16:29 -0500

Seen: 2,767 times

Last updated: Aug 17 '18