Open ppianpak opened 6 years ago
Any update on this? It doesn't seem to be working for me either.
Got it to work using the code below:
actionlib::SimpleActionClient<hector_uav_msgs::PoseAction> pose_("action/pose", true);
hector_uav_msgs::PoseActionFeedback pose_feedback;
ROS_INFO("Waiting for action server to start.");
// wait for the action server to start
pose_.waitForServer();
ROS_INFO("Action server started, sending goal.");
// send a goal to the action
hector_uav_msgs::PoseGoal pose_goal;
ROS_INFO("Current pose %f", pose_feedback.feedback.current_pose.pose.position.z);
pose_goal.target_pose = pose_feedback.feedback.current_pose;
pose_goal.target_pose.pose.position.z = 3.0;
pose_goal.target_pose.header.frame_id = "world";
pose_.sendGoal(pose_goal, &doneCb, &activeCb, &feedbackCb);
pose_.waitForResult(ros::Duration(30.0));
if (pose_.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
{
actionlib::SimpleClientGoalState state = pose_.getState();
ROS_INFO("Action finished: %s",state.toString().c_str());
}
else
ROS_INFO("Action did not finish before the time out.");
return 0;
@rishabhgks I just want to make sure that I understand this correctly. The code that you present is using the action server for sending goals to a ROS Navigation Stack launched somewhere else? This code does NOT give 3D go-to-goal navigation functionality of the hector drone?
I saw there are implementations of
landing_action
,pose_action
, andtakeoff_action
inhector_quadrotor/hector_quadrotor_actions
. I tried to use it by mimicking the code inhector_quadrotor_teleop/quadrotor_teleop.cpp
but there is no reaction on Gazebo at all. I just want to ask whether the the action server implementations work for you guys?Detail here: In terminal 1 I run:
roslaunch hector_quadrotor_gazebo quadrotor_empty_world.launch
In terminal 2 I run a piece of code:output:
I also set
takeoff_height
inhector_quadrotor/hector_quadrotor_actions/takeoff_action.cpp
to 10.0 (originally set to 0.3) to make sure I see it clearly, but there is no movement of the drone in Gazebo at all.