Hey I´m currently doing exercise 4.13 and I have no plan how I should solve it. It isn´t very clear how these Action Servers work and if the named Test.Action msg should be implemented in the client or in the server file. Also after publishing via terminal in the takeoff topic, the drone doesn´t stop moving upwards. When I´m calling also the action_as ardrone_action.launch or something like that. The drone starts moving in a square but always goes upwards. When I´m canceling the server and also restart the kernel, the drone doesn´t stop moving, although I used the land command before start the takeoff topic without starting the ardrone_action.

My code:

! /usr/bin/env python

import rospy import time import actionlib from ardrone_as.msg import ArdroneAction, ArdroneGoal, ArdroneResult, ArdroneFeedback from geometry_msgs.msg import Twist from std_msgs.msg import Empty

nImage = 1

def moveForward(side): x = 0 while x <= side: vel.linear.x = 0.1 vel.angular.z = 0 x += 0.1 print(x)

def turnRight(): vel.linear.x = 0 vel.angular.z = 0.1 time.ctime(20)

def turnLeft(): vel.linear.x = 0 vel.angular.z = -0.1 time.ctime(20)

def feedback_callback(feedback): timeTook = time.localtime() publisherTake.publish(Empty) global nImage print('[Feedback] image n.%d received'%nImage) nImage += 1 while client.get_state() == 0 or client.get_state() == 1: moveForward(goal.side) turnRight(goal.side) moveForward(goal.side) turnLeft(goal.side) moveForward(goal.side) publisher.publish(vel)

vel.linear.x = 0
vel.angular.z = 0

rospy.init_node('drone_action_client') publisher = rospy.Publisher('/cmd_vel', Twist, queue_size=1) publisherTake = rospy.Publisher('/takeoff', Empty, queue_size=1) takeoff = Empty() vel = Twist() client = actionlib.SimpleActionClient('/action_server', ArdroneAction) client.wait_for_server() goal = ArdroneGoal() goal.side = 10 client.send_goal(goal, feedback_cb=feedback_callback)


print('[Result] State: %d'%(client.get_state()))

asked 12 Jun, 10:22

florian-pfuetzenreuter%40hotmail's gravatar image

accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 12 Jun, 10:22

question was seen: 94 times

last updated: 12 Jun, 10:22

powered by OSQA