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

Ch10 mastering ROS: AsyncSpinner not found (Kinetic) [closed]

asked 2019-06-20 15:46:56 -0500

Vini71 gravatar image

updated 2019-06-21 06:24:48 -0500

gvdhoorn gravatar image

I am having the following errors:

home/marcus/catkin_ws/src/seven_dof_arm_test/src/test_random.cpp:9:6: error: ‘AsyncSpinner’ was not declared in this scope
  ros:AsyncSpinner async_spinner(1);


/home/marcus/catkin_ws/src/seven_dof_arm_test/src/test_random.cpp:10:2: error: ‘spinner’ was not declared in this scope
  spinner.start();
  ^
/home/marcus/catkin_ws/src/seven_dof_arm_test/src/test_random.cpp:13:2: error: ‘move_group_interface’ has not been declared
  move_group_interface::MoveGroupInterface move_group("arm");
  ^
/home/marcus/catkin_ws/src/seven_dof_arm_test/src/test_random.cpp:15:2: error: ‘group’ was not declared in this scope
  group.setRandomTarget();

OBS: I have already copied the following code from github: "spinner,h" inside the moveit library and edited the cmakelists...to include this library....I am using kinetic so this library did not existed in the "/opt/ros/kinetic/include/moveit/move_group_interface$"

It only existed the move_group.h and the move_group_interface.h .....so I created the spinner.h too However You can see that in the error ....."the spinner" ..."the move_group"...."the move_group_interface" was not declared...

My test_random.cpp is below:

//Movelt! header file
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/move_group_interface/spinner.h>
#include <moveit/move_group_interface/move_group.h>
int main(int argc, char **argv)
{
    ros::init(argc, argv, "test_random_node", ros::init_options::AnonymousName);
    //start a ROS spinning thread
    ros:AsyncSpinner async_spinner(1);
    spinner.start();
    //this connects to a running instance of the move_group node
    //Here the Planning group is "arm"
    move_group_interface::MoveGroupInterface move_group("arm");
    //Specify that our target will be a random one
    group.setRandomTarget();
    //plan the motion and then move the group to the sampled target 
    group.move();
ros::waitForShutdown();
}

Edit: To link with roscpp I wrote in C.makeLists:

cmake_minimum_required(VERSION 2.8.3)
project(seven_dof_arm_test)

add_compile_options(-std=c++11)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  interactive_markers
  cmake_modules
  moveit_core
  moveit_ros_perception
  moveit_ros_planning_interface
  pluginlib
  roscpp
  std_msgs
).....................................etc....

and I included <ros/ros.h> and removed the spinner.h in include....However the terminal displayed the same error unfortunately.

Do you have another suggestion my friend?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Vini71
close date 2019-06-27 16:44:28.432315

Comments

Please show us your complete CMakeLists.txt.

And "the same error" is too vague. Please show verbatim copy-pastes of error messages.

And I believe on Kinetic the correct type would be moveit::planning_interface::MoveGroupInterface, not move_group_interface::MoveGroupInterface.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-21 06:31:12 -0500 )edit

Thanks for the answer. I tried to implement you suggestion above, unfortonately it did not work. My complete CMakeLists is following below:

cmake_minimum_required(VERSION 2.8.3) project(seven_dof_arm_test)

add_compile_options(-std=c++11)

Compile as C++11, supported in ROS Kinetic and newer

add_compile_options(-std=c++11)

Find catkin macros and libraries

if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)

is used, also find other catkin packages

find_package(catkin REQUIRED COMPONENTS interactive_markers cmake_modules moveit_core moveit_ros_perception moveit_ros_planning_interface pluginlib roscpp std_msgs )

System dependencies are found with CMake's conventions

find_package(Boost REQUIRED COMPONENTS system)

Uncomment this if the package has a setup.py. This macro ensures

modules and global scripts declared therein get installed

See http://ros.org/doc/api/catkin/html/us...

catkin_python_setup()

Vini71 gravatar image Vini71  ( 2019-06-21 13:14:42 -0500 )edit

The terminal error is below:

In file included from /home/marcus/catkin_ws/src/seven_dof_arm_test/src/test_random.cpp:4:0: /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:43:2: warning: #warning "This header is deprecated and will go away in ROS lunar." "Please use moveit/move_group_interface/move_group_interface.h" "and the class MoveGroupInterface instead of MoveGroup" [-Wcpp] #warning "This header is deprecated and will go away in ROS lunar."\ ^ /home/marcus/catkin_ws/src/seven_dof_arm_test/src/test_random.cpp: In function ‘int main(int, char**)’: /home/marcus/catkin_ws/src/seven_dof_arm_test/src/test_random.cpp:9:6: error: ‘AsyncSpinner’ was not declared in this scope ros:AsyncSpinner async_spinner(1); ^ /home/marcus/catkin_ws/src/seven_dof_arm_test/src/test_random.cpp:9:6: note: suggested alternative: In file included from /opt/ros/kinetic/include/ros/node_handle.h:46:0, from /opt/ros/kinetic/include/ros/ros.h:45, from

Vini71 gravatar image Vini71  ( 2019-06-21 13:15:30 -0500 )edit

And finally my test_random.cpp is below:

//Movelt! header file

include <moveit move_group_interface="" move_group_interface.h="">

include<ros ros.h="">

include <moveit move_group_interface="" move_group.h="">

int main(int argc, char **argv) { ros::init(argc, argv, "test_random_node", ros::init_options::AnonymousName); //start a ROS spinning thread ros:AsyncSpinner async_spinner(1); spinner.start(); //this connects to a running instance of the move_group node //Here the Planning group is "arm" moveit::planning_interface::MoveGroupInterface move_group("arm"); //move_group_interface::MoveGroupInterface move_group("arm"); //Specify that our target will be a random one group.setRandomTarget(); //plan the motion and then move the group to the sampled target group.move(); ros::waitForShutdown();

Vini71 gravatar image Vini71  ( 2019-06-21 13:16:05 -0500 )edit

@marcusvini178 please don't use comments to give more code. That's not what they're for (plus it's completely unreadable)

jayess gravatar image jayess  ( 2019-06-21 17:17:58 -0500 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2019-06-21 16:02:37 -0500

ssnover gravatar image

Your line ros:AsyncSpinner async_spinner(1); is missing a colon for the namespace. Add the colon to make it ros::AsyncSpinner async_spinner(1);.

edit flag offensive delete link more
0

answered 2019-06-20 16:21:33 -0500

gvdhoorn gravatar image
//Movelt! header file
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/move_group_interface/spinner.h>
#include <moveit/move_group_interface/move_group.h>

I don't think this has anything to do with Kinetic vs Indigo: you're not including the required headers.

Remove the spinner.h you created and add

#include <ros/ros.h>

That should resolve your issues.

Be sure to also link against roscpp.

edit flag offensive delete link more

Comments

Thanks it worked. I think I am with probllems in C++ and in to comprehend ROS errors...I having another problem with the test_custom.cpp in arm tutorial from chapter 10 of Mastering ROS....I am very sad..

Vini71 gravatar image Vini71  ( 2019-06-23 16:18:44 -0500 )edit

Question Tools

Stats

Asked: 2019-06-20 15:46:56 -0500

Seen: 299 times

Last updated: Jun 21 '19