Erro quando compilo um programa stack/package exemplo1 not found [closed]

asked 2013-09-01 17:36:42 -0500

alexprocopio gravatar image

Olá! Eu compilo este programa, mas quando vou executa-lo aparece essa msg Error: stack/package exemplo1 not found alguém pode me ajudar...

Segue abaixo o codigo CPP, mais o package.xml e o CMakeList.txt

exemplo1.cpp

// This program published randomly-generated velocity // messages for turtlesim. #include <ros ros.h=""> #include <turtlesim velocity.h=""> // For turtlesim::Velocity #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<turtlesim::velocity>( "turtle1/command_velocity", 1000);

// Seed the random number generator. srand(time(0));

// Loop at 2Hz until the node is shut down. ros::Rate rate(2); while(ros::ok()) { // Create and fill in the message. turtlesim::Velocity msg; msg.linear = float(rand())/float(RAND_MAX); msg.angular = 2*float(rand())/float(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
  << " angular=" << msg.angular);

// Wait until it's time for another iteration.
rate.sleep();

} }

Conteúdo do arquivo package.xml <package> <name>exemplo</name> <version>0.0.1</version> <description> Exemplos </description> <maintainer <a="" href="mailto:email=" alex.procopio@hotmail.com""="">email="alex.procopio@hotmail.com"> Alex Proc </maintainer> <license/> <buildtool_depend>catkin</buildtool_depend> <build_depend>turtlesim</build_depend> <run_depend>turtlesim</run_depend> </package>

Conteúdo do arquivo CMakeList.txt

What version of CMake is needed?

cmake_minimum_required(VERSION 2.8.3)

The name of this package.

project(exemplo1)

Find the catkin build system, and any other packages on which we depend.

find_package(catkin REQUIRED COMPONENTS roscpp turtlesim std_srvs)

Declare our catkin package.

catkin_package()

Specify locations of header files.

include_directories(include ${catkin_INCLUDE_DIRS})

Declare the executable, along with its source files.

add_executable(exemplo1 exemplo1.cpp)

Specify libraries against which to link.

target_link_libraries(exemplo1 ${catkin_LIBRARIES})

edit retag flag offensive reopen merge delete

Closed for the following reason Question does not follow our guidelines for questions. Please see: http://wiki.ros.org/Support for more details. by gvdhoorn
close date 2016-09-27 09:10:10.743085