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

I use actionlib to set goal, but I can't catkin_make

asked 2017-11-08 02:08:41 -0600

wings0728 gravatar image

my code:

#include <ros/ros.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <actionlib/client/simple_action_client.h>
#include <tf/transform_broadcaster.h>
#include <sstream>

typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;

int main(int argc, char** argv){
    ros::init(argc, argv, "navigation_goals");
MoveBaseClient ac("move_base", true);

while(!ac.waitForServer(ros::Duration(5.0))){
    ROS_INFO("Waiting for the move_base action server");
}

move_base_msgs::MoveBaseGoal goal;

goal.target_pose.header.frame_id = "map";
goal.target_pose.header.stamp = ros::Time::now();

goal.target_pose.pose.position.x = 1.0;
goal.target_pose.pose.position.y = 1.0;
goal.target_pose.pose.orientation.w = 1.0;

ROS_INFO("Sending goal");
    ac.sendGoal(goal);

    ac.waitForResult();

    if(ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
        ROS_INFO("You have arrived to the goal position");
    else{
        ROS_INFO("The base failed for some reason");
    }
    return 0;
}

when I catkin_make, error:

CMakeFiles/t3_sendGoals.dir/src/t3_sendGoals.cpp.o:在函数‘actionlib::GoalManager<move_base_msgs::MoveBaseAction_<std::allocator<void> > >::initGoal(move_base_msgs::MoveBaseGoal_<std::allocator<void> > const&, boost::function<void (actionlib::ClientGoalHandle<move_base_msgs::MoveBaseAction_<std::allocator<void> > >)>, boost::function<void (actionlib::ClientGoalHandle<move_base_msgs::MoveBaseAction_<std::allocator<void> > >, boost::shared_ptr<move_base_msgs::MoveBaseFeedback_<std::allocator<void> > const> const&)>)’中:
t3_sendGoals.cpp:(.text._ZN9actionlib11GoalManagerIN14move_base_msgs15MoveBaseAction_ISaIvEEEE8initGoalERKNS1_13MoveBaseGoal_IS3_EEN5boost8functionIFvNS_16ClientGoalHandleIS4_EEEEENSB_IFvSD_RKNSA_10shared_ptrIKNS1_17MoveBaseFeedback_IS3_EEEEEEE[_ZN9actionlib11GoalManagerIN14move_base_msgs15MoveBaseAction_ISaIvEEEE8initGoalERKNS1_13MoveBaseGoal_IS3_EEN5boost8functionIFvNS_16ClientGoalHandleIS4_EEEEENSB_IFvSD_RKNSA_10shared_ptrIKNS1_17MoveBaseFeedback_IS3_EEEEEEE]+0xc1):对‘actionlib::GoalIDGenerator::generateID()’未定义的引用
CMakeFiles/t3_sendGoals.dir/src/t3_sendGoals.cpp.o:在函数‘actionlib::GoalManager<move_base_msgs::MoveBaseAction_<std::allocator<void> > >::GoalManager(boost::shared_ptr<actionlib::DestructionGuard> const&)’中:
t3_sendGoals.cpp:(.text._ZN9actionlib11GoalManagerIN14move_base_msgs15MoveBaseAction_ISaIvEEEEC2ERKN5boost10shared_ptrINS_16DestructionGuardEEE[_ZN9actionlib11GoalManagerIN14move_base_msgs15MoveBaseAction_ISaIvEEEEC5ERKN5boost10shared_ptrINS_16DestructionGuardEEE]+0x72):对‘actionlib::GoalIDGenerator::GoalIDGenerator()’未定义的引用
CMakeFiles/t3_sendGoals.dir/src/t3_sendGoals.cpp.o:在函数‘actionlib::ActionClient<move_base_msgs::MoveBaseAction_<std::allocator<void> > >::initClient(ros::CallbackQueueInterface*)’中:
t3_sendGoals.cpp:

(.text._ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE[_ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE]+0x3aa):对‘actionlib::ConnectionMonitor::ConnectionMonitor(ros::Subscriber&, ros::Subscriber&)’未定义的引用
t3_sendGoals.cpp:(.text._ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueue



InterfaceE[_ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE]+0x3e8):对‘actionlib::ConnectionMonitor::goalDisconnectCallback(ros::SingleSubscriberPublisher const&)’未定义的引用
    t3_sendGoals.cpp:(.text._ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE[_ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE]+0x46f):对‘actionlib::ConnectionMonitor::goalConnectCallback(ros::SingleSubscriberPublisher const&)’未定义的引用
    t3_sendGoals.cpp:

(.text._ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE[_ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE]+0x61d):对‘actionlib::ConnectionMonitor::cancelDisconnectCallback(ros::SingleSubscriberPublisher const&)’未定义的引用

t3_sendGoals.cpp:(.text._ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE[_ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE10initClientEPN3ros22CallbackQueueInterfaceE]+0x6b1):对‘actionlib::ConnectionMonitor::cancelConnectCallback(ros::SingleSubscriberPublisher const&)’未定义的引用
CMakeFiles/t3_sendGoals.dir/src/t3_sendGoals.cpp.o:在函数‘actionlib::ActionClient<move_base_msgs::MoveBaseAction_<std::allocator<void> > >::statusCb(ros::MessageEvent<actionlib_msgs::GoalStatusArray_<std::allocator<void> > const> const&)’中:
t3_sendGoals.cpp:(.text._ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE8statusCbERKN3ros12MessageEventIKN14actionlib_msgs16GoalStatusArray_IS3_EEEE[_ZN9actionlib12ActionClientIN14move_base_msgs15MoveBaseAction_ISaIvEEEE8statusCbERKN3ros12MessageEventIKN14actionlib_msgs16GoalStatusArray_IS3_EEEE]+0x1dd):

对‘actionlib::ConnectionMonitor::processStatus(boost::shared_ptr<actionlib_msgs::GoalStatusArray_<std::allocator<void> > const> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)’未定义的引用
collect2: error: ld returned 1 exit status
t3_robot/CMakeFiles/t3_sendGoals.dir/build.make:113: recipe for target '/home/jason/catkin_ws/devel/lib/t3_robot/t3_sendGoals' failed
make[2]: *** [/home/jason/catkin_ws/devel/lib/t3_robot/t3_sendGoals] Error 1
CMakeFiles/Makefile2:2081: recipe for target 't3_robot/CMakeFiles/t3_sendGoals.dir/all' failed
make[1]: *** [t3_robot/CMakeFiles/t3_sendGoals.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
edit retag flag offensive close merge delete

Comments

Can you include your CMakeLists.txt file?

l4ncelot gravatar image l4ncelot  ( 2017-11-08 03:07:37 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2017-11-08 03:14:28 -0600

wings0728 gravatar image

I add dep "tf" to my CMakeLists.txt, it's working.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-11-08 02:08:41 -0600

Seen: 471 times

Last updated: Nov 08 '17