Professional Documents
Culture Documents
0
through ROS with the joystick
This project of joystick quadrocopters ArDrone 2.0 c of ROS.
1. quadrocopters ArDrone 2.0
Parrot AR.Drone - This radio-controlled quadrocopter, ie a helicopter with four rotors placed on extension of the diagonal
beams. Himself AR.Drone is running the operating system Linux, as well as a remote control to quadrocopters can serve
almost any touchscreen smartphone and tablet Android or iOS. Distance sustainable management of Wi-Fi - from 25 to
100 meters, depending on the room and the weather conditions, if the flight is on the street.
Quadrocopters Parrot AR.Drone 2.0 is equipped with 4 motors power 14.5 W and issuing 28,500 RPM. The gearbox
gears nilatrona used for noise reduction and bronze self-lubricating bearings allow all this effectively rotate. On each
motor controller uses 8 MIPS AVR CPU, and the controller itself humidity resistant.Maximum flight speed - 18 km / h
on board quadrocopters updated version with 2 video cameras:
Front HD camera provides 720p, 30 fps angle lens with 92 degrees.
The lower chamber QVGA (320x240) 60 fps with the angle of the lens 64 degrees. Her AR.Drone also uses the measured
horizontal velocity.
"Brains" drone represent a 1GHz ARM Cortex A8 processor with a 800 MHz DSP TMS320DMC64x video. 1Gbit DDR2
RAM at 200MHz. And manage it all with the help of Linux 2.6.32. The connection to the "remote" control (which is the iOS
and Android Soup) occurs WiFi. So copter carries a WiFi point.
orientation in space is due to the 3-axis gyroscope, 3-axis accelerometer, 3-axis magnetometer (magnetic compass), a
pressure sensor and an ultrasound altimeter
Specifications
Video features:
Specifications
Weight: 380g with housing for flights on the street, 420g - with housing for indoor flight
Processor 16MHz 32 bit ARM Cortex A8 with 800MHz video DSP TMS320DMC64x
Wi-Fi b / g / n
3-axis accelerometer
AR.Drone quadrocopter is not easy, and quadrocopter with ideas for the idea of augmented reality (Augmented Reality
Drone). For him, there is an augmented reality video games, and even had an open API.
Due to the low cost, a large number of high-quality sensors, as well as its open API, AR.Drone has become a popular
platform for scientific experiments and educational purposes. It is used in the works on automatic control, learning AI,
autonomous video surveillance, human-machine interaction, etc.
I had a desire to organize voice control AR.Drone of ROS, in the long term, he worked in tandem with the robot
Turtlebot. But first you need a safety net to make Ardrone controlled with convenient device. I decided to choose the
joystick.
2. Driver quadrocopters ArDrone 2.0 for ROS
Ardrone_autonomy is ROS driver for quadrocopters Parrot ArDrone. Supports quadrocopters ArDrone 1.0 and ArDrone
2.0. This package is an offshoot of the package ArDrone Brown. The package allows you to receive messages from
sensors ArDrone, receive images from the cameras, control the movement of quadrocopters and the LEDs.
Installation of ArDrone autonomy. First clone the code directory packages (ROS_PACKAGE_PATH - I ros_pkgs)
?
1
2
3
4
$
$
$
$
Cd ~ / ros_pkgs
Git Clone https: //github.com/AutonomyLab/ardrone_autonomy.git
Rosstack profile && rospack profile
Roscd ardrone_autonomy
$ ./build_sdk
If the compilation was successful - check the contents of the lib directory
?
$ Ls ./lib
rosmake ardrone_autonomy
To run driver
?
/ Ardrone / camera_info
/ Ardrone / image_raw
/ Ardrone / imu
/ Ardrone / land
/ Ardrone / mag
/ Ardrone / navdata
/ Ardrone / reset
/ Ardrone / takeoff
/ Cmd_vel
/ Tf
/ Ardrone / flattrim
/ Ardrone / imu_recalib
/ Ardrone / setcamchannel
/ Ardrone / setflightanimation
/ Ardrone / setledanimation
/ Ardrone / togglecam
/ Ardrone_driver / get_loggers
/ Ardrone_driver / set_logger_level
Information obtained from the quadrocopters driver publishes the topic ardrone / navdata. Message Type
ardrone_autonomy :: Navdata
The following information
header: ROS message header
The experimental subject Base published messages like sensor_msg / Imu, issuing evidence of linear acceleration,
angular velocity and orientation ustroychtva axes x, y, z.
Cameras
Both AR-Drone 1,0 and 2,0 is equipped with two cameras. A front camera is directed forward and one vertical camera
down. Driver ardrone_driver creates three threads ardrone / image_raw, ardrone / front / image_raw and ardrone /
bottom / image_raw. Each of these topics is published messages like image_transport
To display the camera (current)
?
Sboros parameters (emergency stop) - sending a blank message to the topic ardrone / reset
?
After take-off motion control ArDrone need to send messages like geometry_msgs :: Twist topic cmd_vel
-Linear.x: move backwards
+ Linear.x: move forward
-Linear.y: move right
+ Linear.y: move left
-Linear.z: move down
+ Linear.z: move up
-Angular.z: Turn left
+ Angular.z: turn right
The range for each component should be from -1.0 to 1.0. The maximum range can be configured using the ROS
parameters are discussed later in this document. Publication of "0" value for all components make rumble keep hovering.
?
LED animation
Call service ardrone / setledanimation will cause the execution of one of the 14 predefined animations for LED ArDrone.
Options
uint8 types: the type of animation that is a number in the range [0 .. 13];
BLINK_GREEN_RED;
2.
BLINK_GREEN;
3.
BLINK_RED;
4.
BLINK_ORANGE;
5.
SNAKE_GREEN_RED;
6.
FIRE;
7.
STANDARD;
8.
RED;
9.
GREEN;
10.
RED_SNAKE;
11.
BLANK;
12.
LEFT_GREEN_RIGHT_RED;
13. LEFT_RED_RIGHT_GREEN;
14. BLINK_STANDARD.
These animations can be tested on the command line, for example,
?
Flight animation
Call service ardrone / setflightanimation will perform one of 20 predefined animations flight (flight figures) for
ArDrone. Options:
uint8 types: the type of flight animation, the number in the range [0 .. 19]
uint16 duration: the duration of the animation. Use 0 for the duration of the default (recommended)
1. ARDRONE_ANIM_PHI_M30_DEG;
2. ARDRONE_ANIM_PHI_30_DEG;
3. ARDRONE_ANIM_THETA_M30_DEG;
4. ARDRONE_ANIM_THETA_30_DEG;
5. ARDRONE_ANIM_THETA_20DEG_YAW_200DEG;
6. ARDRONE_ANIM_THETA_20DEG_YAW_M200DEG;
7. ARDRONE_ANIM_TURNAROUND;
8. ARDRONE_ANIM_TURNAROUND_GODOWN;
9. ARDRONE_ANIM_YAW_SHAKE;
10. ARDRONE_ANIM_YAW_DANCE;
11. ARDRONE_ANIM_PHI_DANCE;
12. ARDRONE_ANIM_THETA_DANCE;
13. ARDRONE_ANIM_VZ_DANCE;
14. ARDRONE_ANIM_WAVE;
15. ARDRONE_ANIM_PHI_THETA_MIXED;
16. ARDRONE_ANIM_DOUBLE_PHI_THETA_MIXED;
17. ARDRONE_ANIM_FLIP_AHEAD;
18. ARDRONE_ANIM_FLIP_BEHIND;
19. ARDRONE_ANIM_FLIP_LEFT;
20. ARDRONE_ANIM_FLIP_RIGHT.
These animations can be tested on the command line, for example,
?
Defender Game Racer X7 has 12 buttons (including the D-Pad and 2 analog sticks), as well as buttons Turbo, Clear and
Home. The device supports vibration feedback, which works with the help of 2 vibration motor. Connection to the
computer is done via USB. The joystick can operate in two modes, one of which HID-device, the other - the controller
XBOX360. Switching is done by pressing the Mode.
We connect the joystick to your computer with Linux.
?
$ Ls / dev / input
The joystick device called by the JSX, I had our joystick js0. Make sure that the joystick is working.
?
1
img
On the server, set the parameter setting joy_node / dev, which is the port connecting our joystick
?
Putting package
?
$ Rosmake vp_ardrone1
Now we need to write a script that creates the node that will receive messages from the topic of joy and send control
commands quadrocopters Ardrone. The script is written in python.
Use the joystick to execute the following commands
take-off,
planting,
movement (up, down, left, right, up, down, turn) at the joystick,
hang,
Flight animation 0-14 of 19, except for flip (to turn a somersault string adjust num2 = min (num2 + 1,14) for num2
= min (num2 + 1,18).
The current value of the led-animation and flight-animation stored on the server settings (parameters and joystick_num1
joystick_num2). Recent data values sent to the topic cmd_vel also stored on the server settings (option). Here are the
contents (nodes / ros_ardrone1_joystick_to_move.py).
1
2
3
4
5
6
7
8
9
10
eleven
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
thirty
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
ardrone_autonomy.msg import *
ardrone_autonomy.srv import *
sensor_msgs.msg import Joy
std_msgs.msg import String
std_msgs.msg import Empty
std_msgs.msg import Int32
geometry_msgs.msg import Twist
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
elif (data.axes [0]! = 0.0 or data.axes [1]! = 0.0 or data.axes [3]! = 0.0 or data.a
pub3 = rospy.Publisher ( 'cmd_vel' , Twist)
joistick_prev_odom = rospy.get_param ( "joystick_prev_odom" )
odom = Twist ()
odom.linear.x = data.axes [1]
odom.linear.y = data.axes [0]
odom.linear.z = data.axes [4]
odom.angular.x = 0.0
odom.angular.y = 0.0
odom.angular.z = data.axes [3]
pub3.publish (odom)
joistick_prev_odom [0] = data.axes [0]
joistick_prev_odom [1] = data.axes [1]
joistick_prev_odom [2] = data.axes [2]
joistick_prev_odom [3] = data.axes [3]
joistick_prev_odom [4] = data.axes [4]
joistick_prev_odom [5] = data.axes [5]
rospy.set_param ( "joystick_prev_odom" , joistick_prev_odom)
rospy.loginfo ( "movement !!!!" )
else : # shutdown joysticks
joistick_prev_odom = rospy.get_param ( "joystick_prev_odom" )
odom = Twist ()
if (joistick_prev_odom [0]! = data.axes [0] or joistick_prev_odom [1]! = data.axes [1]
joistick_prev_odom [3]! = data.axes [3] or joistick_prev_odom [4]! = data.axes [4]):
pub3 = rospy.Publisher ( 'cmd_vel' , Twist)
odom.linear.x = 0.0
odom.linear.y = 0.0
odom.linear.z = 0.0
odom.angular.x = 0.0
odom.angular.y = 0.0
odom.angular.z = 0.0
pub3.publish (odom)
joistick_prev_odom [0] = 0.0
joistick_prev_odom [1] = 0.0
joistick_prev_odom [2] = 0.0
joistick_prev_odom [3] = 0.0
joistick_prev_odom [4] = 0.0
joistick_prev_odom [5] = 0.0
rospy.set_param ( "joystick_prev_odom" , joistick_prev_odom)
rospy.loginfo ( "stop on the joystick !!!!" )
#
# Rospy.loginfo (data.axes)
# Rospy.loginfo (data.buttons)
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Run
?