AutonomyLab / ardrone_autonomy

ROS driver for Parrot AR-Drone 1.0 and 2.0 quadrocopters
http://wiki.ros.org/ardrone_autonomy
BSD 3-Clause "New" or "Revised" License
357 stars 226 forks source link

Getting Started... #97

Closed charlescva closed 9 years ago

charlescva commented 10 years ago

Hello. I am completely new to ROS and the concept of using it with the AR Drone. Unfortunately I have spent most of my career using java/php and other heavy footprint languages for big data applications, so although the concepts are comfortable with networking, UDP, functions, etc... the syntax and terminology has me lost.

Anyway, I love learning new things and picked up the AR Drone 2.0 last friday. I have enjoyed what it can do, but would like to have better control using event triggered input keys, or predefined inputs, etc.

I am new to the catkin framework, but not new to linux and compiling source and dealing with dependencies. After doing some reading on packages and nodes, I have found that it sounds similar to java 'storm topologies' in which I use graphs of nodes to determine real time data flow in distributed environments, ensuring that no input is ever dropped.

Currently I am able to connect to my drone with wifi, and start the ardrone_driver node in the ardrone_autonomy package. I can see all kinds of parameters and their values, (such as battery life), but I'm not sure where to go from there. Looking through the catkin tutorials, it seems like i should see the node running in 'roscore', but i don't. I understand the concept of sending a command by publishing an empty ROS message to the "ardrone/takeoff and ardrone/land topics" But not sure how to actually send a message to those topics.

http://wiki.ros.org/Topics#Topic_Tools this implies i should be able to use rostopic, but there are a lot of parameters in the launch which define outdoor mode = 1, and maximum_altitude to 3000, but I'm not sure about the unit of measure and I am indoors, perhaps 3000 = 3 meters?

Anyway, I was hoping someone could fill me in a little bit, as I would like to get involved and learn more without destroying my new AR Drone.

Thanks for reading.

Charles

charlescva commented 10 years ago

Okay update.

I got the drone to take off and land.

Modified the launch file (.../src/ardrone_autonomy-hydro-devel/launch/ardrone.launch) and set outdoor mode = 0, which I assume is the same as turning on indoor mode? Then recompiled.

First the ros core daemon has to be running, # roscore (New Terminal) next, started the driver # rosrun ardrone_autonomy ardrone_driver (2nd Terminal)

I wasn't sure what the readme meant by publishing an empty message, so I adopted this from the ROS wiki: (Inside a 3rd Terminal) rostopic pub /topic_name std_msgs/String hello and changed it to: rostopic pub /ardrone/takeoff std_msgs/Empty -1

So, I added the following aliases to my ~/.bashrc source ~/catkin_ws/install/setup.bash alias droneUp="rosrun ardrone_autonomy ardrone_driver" alias takeOff="rostopic pub /ardrone/takeoff std_msgs/Empty -1" alias land="rostopic pub /ardrone/land std_msgs/Empty -1"

Next step, keyboard mapping.

Another question, what is aggressive launch? Sounds suspicious.

mani-monaj commented 10 years ago

@charlescva This might be a very good starting point:

http://robohub.org/up-and-flying-with-the-ar-drone-and-ros-getting-started/

The article is a little outdated, but the ROS API of the driver is the same, so it should work fine. I hope that will help.

charlescva commented 10 years ago

@mani-monaj Thanks for the direction. I am looking into this now.

kbogert commented 10 years ago

If you have a spare PS3 controller lying around I'd definitely recommend that rather than trying to control the drone with a keyboard. You can use my project here: https://github.com/kbogert/ps3_ardrone and the instructions for connecting the controller to ROS: http://wiki.ros.org/ps3joy/Tutorials/PairingJoystickAndBluetoothDongle

IMNSHO controlling the drone with an actual controller is light years better than anything else I've tried.

charlescva commented 10 years ago

I do have a PS3 controller. I was planning to move towards using a gamepad after getting some basic keyboard inputs working. I also have a joystick I purchased to use with flight simulator/ace combat. I figured that would be the ultimate solution for precision control. Thanks for the feedback, I will definitely be going through your projects once I get through setting up the dev environment. Still have a lot to learn about using ROS in general.

charlescva commented 10 years ago

@kbogert So I have a few of the different packages working. First, I am able to run the tutorials package from Mike Hamer, and I can successfully control the AR Drone with the keyboard. However, like you said, it does not feel natural.

So the first thing I did was follow the information here: http://wiki.ros.org/ps3joy/Tutorials/PairingJoystickAndBluetoothDongle I am able to open a 2nd terminal session, run sudo jstest /dev/input/js0 and hit the connect button my PS3 controller and see the outputs. So that seems to be working okay.

Next, I downloaded the ZIP from the ps3_ardrone project, extracted the ps3_ardrone-master folder into my ~/catkin-ws/src folder, and from the catkin workspace ran 'catkin_make install'. This ran without errors, so i then followed the run.txt instructions:

charles@:~/catkin_ws$ sudo bash [sudo] password for charles: root@:~/catkin_ws# rosrun ps3joy ps3joy.py No inactivity timeout was set. (Run with --help for details.) Waiting for connection. Disconnect your PS3 joystick from USB and press the pairing button. Connection activated

Now, at this point I tried to roslaunch the ps3_ardrone launch file: charles@:~$ roslaunch ps3_ardrone ps3_ardrone.launch [ps3_ardrone.launch] is neither a launch file in package [ps3_ardrone] nor is [ps3_ardrone] a launch file name

however, I get the error above. using catkin_find_pkg, i see the package.

charles@:~$ catkin_find_pkg ps3_ardrone Multiple packages found with the same name "ardrone_tutorials":

I guess I'm missing something?

kbogert commented 10 years ago

Hmm, try: source ~/catkin_ws/install/setup.bash

and see if it still can't find it.

kbogert commented 10 years ago

Oh wait, the name of the folder has to be ps3_ardrone, not ps3_ardrone-master. Same with ardrone_autonomy and ardrone_tutorials. The folder name has to match the package name for roslaunch to find it.

charlescva commented 10 years ago

Hmm. Tried renaming the folder as well as sourcing the setup.bash file. Same error. I'll try cleaning out the workspace and building again. Thanks.