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

Control configuration changes not reflected on drone? #24

Closed mikehamer closed 11 years ago

mikehamer commented 11 years ago

It appears that changes in control parameters (and other CAT_USER) settings do not affect the drone.

When running ardrone_driver, the following is printed:

Wait authentification
===================+> 192.168.1.1
[ INFO] [1352234370.655983884]: Root Frame is: 0
[ INFO] [1352234370.656905814]: No values found for `~cov/imu_la` in parameters, set all to zero.
[ INFO] [1352234370.657902223]: No values found for `~cov/imu_av` in parameters, set all to zero.
[ INFO] [1352234370.658896658]: No values found for `~cov/imu_or` in parameters, set all to zero.
[ INFO] [1352234370.663244082]: SET ~bitrate_ctrl_mode            : 0.00
[ INFO] [1352234370.664260742]: SET ~max_bitrate                  : 2000.00
[ INFO] [1352234370.665207506]: SET ~outdoor                      : 1.00
[ INFO] [1352234370.666118191]: SET ~flight_without_shell         : 1.00
[ INFO] [1352234370.667830458]: SET ~altitude_max                 : 5000.00
[ INFO] [1352234370.668715842]: SET ~altitude_min                 : 100.00
[ INFO] [1352234370.670661813]: SET ~enemy_colors                 : 3.00
[ INFO] [1352234370.671968513]: SET ~enemy_without_shell          : 0.00
[ INFO] [1352234370.673430208]: SET ~control_vz_max               : 2000.00
[ INFO] [1352234370.674487957]: SET ~control_yaw                  : 350.00
[ INFO] [1352234370.675655010]: SET ~euler_angle_max              : 0.50
[ INFO] [1352234370.676419481]: SET ~bitrate                      : 2000.00
[ INFO] [1352234370.677528147]: SET ~navdata_demo                 : 0.00
[ INFO] [1352234370.678744205]: SET ~detect_type                  : 10.00
[ INFO] [1352234370.679771770]: SET ~detections_select_h          : 32.00
[ INFO] [1352234370.680836172]: SET ~detections_select_v_hsync    : 4.00
Input device Teleop added
Starting thread video_stage
Starting thread video_recorder
Starting thread update_ros

video stage thread initialisation

Video multisocket : init 2 sockets
Video multisocket : connecting socket 0 on port 5555 UDP
Video multisocket : connecting socket 1 on port 5555 TCP
Thread `update_ros` started 
Video recorder thread initialisation
Set IP_TOS ok
Starting thread navdata_update
Starting thread ardrone_control
Thread navdata_update in progress...
PA : MEMORY SPACE ALLOWED : 40 MB
Start thread thread_academy
Start thread thread_academy_upload
Start thread thread_academy_download 
Academy download stage resumed
Academy download stage paused
Timeout when reading navdatas - resending a navdata request on port 5554
Academy download stage resumed
Academy download stage paused
Sending default CAT_SESSION settings
[ INFO] [1352234375.681546174]: Successfully connected to 'My ARDrone' (AR-Drone 2.0 - Firmware: 2.1.20) - Battery(%): 57

Investigating the drone's configuration files (see next code snippet) shows that the CAT_SESSION values (for example detect_type, detections_select_h, detections_select_v_hsync) are correctly set (as implied by the driver output), but custom CAT_USER settings are not set. The type of each parameter can be read in config_keys.h.

CAT_SESSION parameters correctly set

# pwd
/data/custom.configs/sessions
# cat config.7bc641ad.ini 

[control]
flying_mode                    = 0
hovering_range                 = 1000

[video]
codec_fps                      = 30
video_codec                    = 129
max_bitrate                    = 2000
video_channel                  = 0

[detect]
groundstripe_colors            = 16
detect_type                    = 10
detections_select_h            = 32
detections_select_v_hsync      = 4
detections_select_v            = 0

[userbox]

[gps]
latitude                       = 5.0000000000000000e+02
longitude                      = 5.0000000000000000e+02
altitude                       = 0.0000000000000000e+00

[custom]
application_id                 = e182b69b
profile_id                     = 00000000
session_id                     = 7bc641ad
session_desc                   = Session 7bc641ad

But CAT_USER not?

# cd ../profiles/
# ls

There are no user profiles created by the application.

Further debugging by setting #define _GENERAL_NAVDATA_DEBUG (1) in ardrone_general_navdata.c produces the following output on driver startup:

Wait authentification
===================+> 192.168.1.1
[ INFO] [1352234370.655983884]: Root Frame is: 0
[ INFO] [1352234370.656905814]: No values found for `~cov/imu_la` in parameters, set all to zero.
[ INFO] [1352234370.657902223]: No values found for `~cov/imu_av` in parameters, set all to zero.
[ INFO] [1352234370.658896658]: No values found for `~cov/imu_or` in parameters, set all to zero.
[ INFO] [1352234370.663244082]: SET ~bitrate_ctrl_mode            : 0.00
[ INFO] [1352234370.664260742]: SET ~max_bitrate                  : 2000.00
[ INFO] [1352234370.665207506]: SET ~outdoor                      : 1.00
[ INFO] [1352234370.666118191]: SET ~flight_without_shell         : 1.00
[ INFO] [1352234370.667830458]: SET ~altitude_max                 : 5000.00
[ INFO] [1352234370.668715842]: SET ~altitude_min                 : 100.00
[ INFO] [1352234370.670661813]: SET ~enemy_colors                 : 3.00
[ INFO] [1352234370.671968513]: SET ~enemy_without_shell          : 0.00
[ INFO] [1352234370.673430208]: SET ~control_vz_max               : 2000.00
[ INFO] [1352234370.674487957]: SET ~control_yaw                  : 350.00
[ INFO] [1352234370.675655010]: SET ~euler_angle_max              : 0.50
[ INFO] [1352234370.676419481]: SET ~bitrate                      : 2000.00
[ INFO] [1352234370.677528147]: SET ~navdata_demo                 : 0.00
[ INFO] [1352234370.678744205]: SET ~detect_type                  : 10.00
[ INFO] [1352234370.679771770]: SET ~detections_select_h          : 32.00
[ INFO] [1352234370.680836172]: SET ~detections_select_v_hsync    : 4.00
Input device Teleop added
Starting thread video_stage
Starting thread video_recorder
Starting thread update_ros

video stage thread initialisation

Video multisocket : init 2 sockets
Video multisocket : connecting socket 0 on port 5555 UDP
Video multisocket : connecting socket 1 on port 5555 TCP
Thread `update_ros` started 
 Video recorder thread initialisation
Set IP_TOS ok
Starting thread navdata_update
Starting thread ardrone_control
Thread navdata_update in progress...
PA : MEMORY SPACE ALLOWED : 40 MB
Start thread thread_academy
Start thread thread_academy_upload
Start thread thread_academy_download 
Academy download stage resumed
Academy download stage paused
Timeout when reading navdatas - resending a navdata request on port 5554
[286] General Navdata : Need to check multiconfig ... request config file
Academy download stage resumed
Academy download stage paused
[69] General Navdata : Config callback called with result 1
[72] General Navdata : State : 6
[76] General Navdata : Got config file
[102] General Navdata : End of config callback call
[166] General Navdata : Checking drone version ...
[170] General Navdata : Drone supports multiconfig
[69] General Navdata : Config callback called with result 1
[72] General Navdata : State : 7
[80] General Navdata : Got ids list
[102] General Navdata : End of config callback call
[184] General Navdata : Got AR.Drone ID list. Switch->1,1,1. ND->1
[198] General Navdata : Checking application efc8fd84 (desc : com.parrot.freeflight)
[198] General Navdata : Checking application b6bc397b (desc : com.digitalsirup.dronecontrolhd)
[198] General Navdata : Checking application e182b69b (desc : ardrone_driver)
[201] General Navdata : Found our application ... should not init
[234] General Navdata : We're requesting default user (00000000), do nothing.
Sending default CAT_SESSION settings
[69] General Navdata : Config callback called with result 1
[72] General Navdata : State : 8
[84] General Navdata : Got current ids
[102] General Navdata : End of config callback call
[292] General Navdata : Send application navdata demo/options
[69] General Navdata : Config callback called with result 1
[72] General Navdata : State : 9
[88] General Navdata : Got navdatas
[102] General Navdata : End of config callback call
[301] General Navdata : Refreshing from MULTICONFIG FSM
[ INFO] [1352234375.681546174]: Successfully connected to 'My ARDrone' (AR-Drone 2.0 - Firmware: 2.1.20) - Battery(%): 57

The driver seems to use the default user profile, which is not updated according to the set ros parameters.

Changing the euler_angle_max parameter to 30º instead of the default 12º and running the drone in a vicon system shows no change in drone behavior with the increased parameter value (this is also visually apparent).

Perhaps I am doing something incorrectly, in which case please let me know! If however this is an issue, I am happy to help debug – let me know what I can do!

Mike

mani-monaj commented 11 years ago

Thanks for debugging this issue @mikehamer . I personally found this issue a couple of month ago, but I have not looked into it with details.

Regarding the "ARDrone SDK 2 Developers Guide" (Multiconfiguration) Section (in addition to what you said), there are four types of configurations:

• CAT_COMMON : This is the default category, common to all applications. • CAT_APPLI : This setting will be saved for the current application (regardless of the device it is running on). • CAT_USER : This setting will be saved for the current user (regardless of the application). For more information about users, see the user section of this documentation. (User cate- gory is also called "profile" category). • CAT_SESSION : This setting will be saved for the current flight session (regardless of application/user).

First time that I implemented the rosparam based configuration, I did not pay attention to this fact and considered all params CAT_COMMON.

This is my suggested roadmap to fix this problem:

  1. Group all configurations used by the driver into above categories.
  2. Find the problems for each group.

This is what have been found so-far:

mikehamer commented 11 years ago

Fixed in my pull-request #26