Exercise 4.6 pulishing Twist message for drone cruise flight doesn't work

Hello to everybody,
my own program for the exercise 4.6 went pretty well. But to make the drone flying around is a problem.
It doesn’t work. After take off the drone is still standing in the air and will land as requireed after taking 10 pictures.

I studied my program several times and compared it finally with the given solution. The given solution of the course works perfectly. I produced for that program a new package to separate it from my own staff. My own program listing looks very similar and my program is running pretty good as well only the cruise flight sequence to make the drone flying around after take off doesn’t work. It seems to me the command “pub_flight.publish(flight_msg)” doesn’t reach the drone action server

I assume the mistake in anywhere by using the geometry_msg.msg.
Here the commands I used:

from geometry_msgs.msg import Twist

pub_flight = rospy.Publisher("/drone/cmd_vel", Twist, queue_size=10)

while state_result < DONE:
flight_msg.linear.x = 2
flight_msg.angular.z = 2
pub_flight.publish(flight_msg)
rate.sleep()

I’m appreciate to get some help or hints for new ideas to find the mistake
Thanks a lot
Matthias

Hello @matham.latif,

I believe the topic used to move the Drone is not /drone/cmd_vel, but just /cmd_vel. Could you try to change that in your code and check if that fixes the issues?

Best,

1 Like

Hello albertoezquerro,
yes you are right I changed it and it works. Thanks a lot.
I saw already that difference while comparing it to the solution. But I didn’t changed it because I thought that is only the name of the publisher and to make it more nicer I added to all my three publisher the same name prefix.

I will learn the publisher lecture once again because now I’m a little bite confused about how to use the name of a publisher.

But for now thanks again to help me out in a dead end lane.
Regards
Matthias

1 Like