ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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/Publishers%20and%20Subscribers or http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers 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.
2 | No.2 Revision |
Have you looked at the documentation? 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/Publishers%20and%20Subscribers or http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers 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.