Ch10 mastering ROS: AsyncSpinner not found (Kinetic) [closed]
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?
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
, notmove_group_interface::MoveGroupInterface
.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()
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
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();
@marcusvini178 please don't use comments to give more code. That's not what they're for (plus it's completely unreadable)