Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ARDrone-SDK
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
just-drone
ARDrone-SDK
Commits
87bbd642
Commit
87bbd642
authored
Jun 15, 2019
by
15김건우
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok tank you!
parent
b5cc0a06
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
43 deletions
+12
-43
control.c
Examples/Linux/custom_test/Sources/Control/control.c
+8
-11
navdata.c
Examples/Linux/custom_test/Sources/Navdata/navdata.c
+2
-32
main.c
Examples/Linux/custom_test/Sources/main.c
+2
-0
No files found.
Examples/Linux/custom_test/Sources/Control/control.c
View file @
87bbd642
...
...
@@ -15,7 +15,7 @@ input_device_t control_device = {
close_control_device
};
controller_info_t
controller_state
;
controller_info_t
controller_state
,
_z
=
{}
;
// TODO: remove this in final; not required
// Get keyboard input; return -1 if no input
...
...
@@ -37,10 +37,7 @@ int kbhit(void) {
}
C_RESULT
open_control_device
(
void
)
{
control_state
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
controller_state
=
_z
;
return
C_OK
;
}
...
...
@@ -49,15 +46,17 @@ C_RESULT update_control_device(void) {
if
(
key
==
'1'
)
{
controller_state
.
start
=
!
controller_state
.
start
;
ardrone_academy_navdata_takeoff
();
ardrone_tool_set_ui_pad_start
(
controller_state
.
start
);
//ardrone_academy_navdata_takeoff();
}
else
if
(
key
==
'2'
)
{
controller_state
.
emergency
=
!
controller_state
.
emergency
;
ardrone_academy_navdata_emergency
();
ardrone_tool_set_ui_pad_select
(
controller_state
.
emergency
);
//ardrone_academy_navdata_emergency();
}
else
{
#define _INC(_c, _v) case _c : controller_state. _v += 0.
01f; if ( controller_state. _v > 1
.0f) controller_state. _v = 1.0f; break
#define _DEC(_c, _v) case _c : controller_state. _v -= 0.
01f; if ( controller_state. _v < -1
.0f) controller_state. _v = -1.0f; break
#define _INC(_c, _v) case _c : controller_state. _v += 0.
5f; if ( controller_state. _v > 1000000
.0f) controller_state. _v = 1.0f; break
#define _DEC(_c, _v) case _c : controller_state. _v -= 0.
5f; if ( controller_state. _v < -1000000
.0f) controller_state. _v = -1.0f; break
switch
(
key
)
{
_INC
(
'q'
,
phi
);
_INC
(
'w'
,
theta
);
...
...
@@ -80,7 +79,6 @@ C_RESULT update_control_device(void) {
}
#undef _INC
#undef _DEC
if
(
key
!=
-
1
)
{
int32_t
flags
=
(
controller_state
.
hover_mode
?
1
:
0
)
|
(
controller_state
.
yaw_mode
?
2
:
0
)
|
(
controller_state
.
absolute_mode
?
4
:
0
);
ardrone_tool_set_progressive_cmd
(
flags
,
...
...
@@ -92,7 +90,6 @@ C_RESULT update_control_device(void) {
controller_state
.
magneto_psi_accuracy
);
}
}
return
C_OK
;
}
...
...
Examples/Linux/custom_test/Sources/Navdata/navdata.c
View file @
87bbd642
...
...
@@ -3,40 +3,11 @@
#include <Navdata/navdata.h>
#include <Control/control.h>
#include <stdio.h>
#include <stdlib.h>
#define CTRL_STATES_STRING
#include "control_states.h"
const
char
*
ctrl_state_str
(
uint32_t
ctrl_state
)
{
#define MAX_STR_CTRL_STATE 256
static
char
str_ctrl_state
[
MAX_STR_CTRL_STATE
];
ctrl_string_t
*
ctrl_string
;
uint32_t
major
=
ctrl_state
>>
16
;
uint32_t
minor
=
ctrl_state
&
0xFFFF
;
if
(
strlen
(
ctrl_states
[
major
])
<
MAX_STR_CTRL_STATE
)
{
vp_os_memset
(
str_ctrl_state
,
0
,
sizeof
(
str_ctrl_state
));
strcat_s
(
str_ctrl_state
,
sizeof
(
str_ctrl_state
),
ctrl_states
[
major
]);
ctrl_string
=
control_states_link
[
major
];
if
(
ctrl_string
!=
NULL
&&
(
strlen
(
ctrl_states
[
major
])
+
strlen
(
ctrl_string
[
minor
])
<
MAX_STR_CTRL_STATE
)
)
{
strcat_s
(
str_ctrl_state
,
sizeof
(
str_ctrl_state
),
" | "
);
strcat_s
(
str_ctrl_state
,
sizeof
(
str_ctrl_state
),
ctrl_string
[
minor
]
);
}
}
else
{
vp_os_memset
(
str_ctrl_state
,
'#'
,
sizeof
(
str_ctrl_state
)
);
}
return
str_ctrl_state
;
}
/* Initialization local variables before event loop */
inline
C_RESULT
demo_navdata_client_init
(
void
*
data
)
{
...
...
@@ -49,7 +20,7 @@ inline C_RESULT demo_navdata_client_process( const navdata_unpacked_t* const nav
const
navdata_demo_t
*
nd
=
&
navdata
->
navdata_demo
;
printf
(
"===================== Navdata for flight demonstrations =====================
\n
"
);
printf
(
"Control state : %i / Battery level : %i mV
\n
"
,
ctrl_state_str
(
nd
->
ctrl_state
)
,
nd
->
vbat_flying_percentage
);
printf
(
"Control state : %i / Battery level : %i mV
\n
"
,
nd
->
ctrl_state
,
nd
->
vbat_flying_percentage
);
printf
(
"Altitude : %i
\n
"
,
nd
->
altitude
);
printf
(
"Orientation : [Theta] %4.3f [Phi] %4.3f [Psi] %4.3f
\n
"
,
nd
->
theta
,
nd
->
phi
,
nd
->
psi
);
printf
(
"Speed : [vX] %4.3f [vY] %4.3f [vZ] %4.3f
\n
"
,
nd
->
vx
,
nd
->
vy
,
nd
->
vz
);
...
...
@@ -58,7 +29,6 @@ inline C_RESULT demo_navdata_client_process( const navdata_unpacked_t* const nav
printf
(
"[Gaz] %4.3f
\n
"
,
controller_state
.
gaz
);
printf
(
"[Theta] %4.3f [Phi] %4.3f [Yaw] %4.3f [magnet-Psi] %4.3f
\n
"
,
controller_state
.
theta
,
controller_state
.
phi
,
controller_state
.
yaw
,
controller_state
.
magneto_psi
);
printf
(
"Mode : [hover] %i [yaw] %i [absolute] %i [psi-accuracy] %4.3f
\n
"
,
controller_state
.
hover_mode
,
controller_state
.
yaw_mode
,
controller_state
.
absolute_mode
,
controller_state
.
magneto_psi_accuracy
);
printf
(
"
\033
[10A"
);
return
C_OK
;
}
...
...
Examples/Linux/custom_test/Sources/main.c
View file @
87bbd642
...
...
@@ -4,6 +4,8 @@
* @date 2009/07/01
*/
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <VP_Os/vp_os_types.h>
//ARDroneLib
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment