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

How to control ardrone in tum_simulator with command line?

asked 2016-11-16 14:42:00 -0500

frenchie007 gravatar image

updated 2016-11-16 14:42:33 -0500

I've installed tum_simulator for ros indigo and am having some troubles controlling the drone. Ultimately I want to control the drone from a python program, so for now I would like to control it via the command line so as to ease compatibility with my python program.

I am having pretty simple troubles, mostly about stabilization. For example when I run

rostopic pub -1 /ardrone/takeoff std_msgs/Empty

the drone successfully takes off, but it never stops elevating.

How can I make the drone take off and stabilize itself at a certain altitude?

edit retag flag offensive close merge delete

Comments

Hi frenchie007, I'm having the same problem, my guess it has something to do with sonar sensor..have you manage to solve it?

patricia gravatar image patricia  ( 2017-09-11 11:08:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-03-17 14:22:23 -0500

jayess gravatar image

updated 2017-03-17 14:23:08 -0500

Have you looked at the documentation? It tells you how to do exactly what you want. For example, in section 3.3.2 terminal command control, it says that to move around in the using the command line you simply publish geometry_msgs/Twist messages to the /cmd_vel topic. Here's the example that it gives

# fly forward
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 1.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

# fly backward
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: -1.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

# fly to left 
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.0, y: 1.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

# fly to right 
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.0, y: -1.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

# fly up 
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.0, y: 0.0, z: 1.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

# fly down 
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.0, y: 0.0, z: -1.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

# counterclockwise rotation
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 1.0}}'

# clockwise rotation
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: -1.0}}'

# stop
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

If this is too tedious for you (I wouldn't want to do it this way) you should follow the http://wiki.ros.org/roscpp/Overview/P... or http://wiki.ros.org/rospy/Overview/Pu... tutorials and modify them so that when you press a key in the terminal (e.g. w => forward, s => backward, a => left, d => right, q => yaw counter clockwise, e => yaw clockwise) your node publishes the correct messages to move the quadcopter in the appropriate direction.

Also, check out Mike Hamer's excellent AR.Drone tutorials. They're dated, but are still great examples on how to do what you want.

edit flag offensive delete link more

Comments

hi , I managed to fly it but i have little problem that is when sending a fly to right `'{linear: {x: 0.0, y: -1.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}' command it keeps going right and never stops. is there anyway other than sending 'Stop' after each single 'Move' including take off

Caesar84 gravatar image Caesar84  ( 2018-04-08 15:28:36 -0500 )edit

Not that I'm aware of. Using the command line for this is rather tedious and inefficient (from my experience). IMO you'd be better off writing a node to control the your drone.

jayess gravatar image jayess  ( 2018-04-08 15:43:35 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-11-16 14:42:00 -0500

Seen: 1,276 times

Last updated: Mar 17 '17