Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qjs-wrapper
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
qjs-wrapper
Commits
27ae36e4
Commit
27ae36e4
authored
May 02, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Plain Diff
Format logging and stop manual control
See merge request
!7
parents
6dd2502f
ba7bc987
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
199 deletions
+108
-199
Makefile
Makefile
+1
-1
include/mavsdk_wrapper.h
include/mavsdk_wrapper.h
+1
-5
mavsdk_wrapper.cpp
mavsdk_wrapper.cpp
+96
-152
qjs_wrapper.c
qjs_wrapper.c
+10
-41
No files found.
Makefile
View file @
27ae36e4
CFLAGS
=
-std
=
c99
-D_POSIX_C_SOURCE
=
200809L
-pipe
-Wall
-Wextra
-Wpedantic
-Werror
-Wno-overlength-strings
-Wno-unused-parameter
-Wc
++-compat
-Wformat
-Wformat-security
-Wformat-nonliteral
-Wmissing-prototypes
-Wstrict-prototypes
-Wredundant-decls
-Wuninitialized
-Winit-self
-Wcast-qual
-Wstrict-overflow
-Wnested-externs
-Wmultichar
-Wundef
-fno-strict-aliasing
-fexceptions
-fPIC
-fstack-protector-strong
-fstack-clash-protection
-ffunction-sections
-fdata-sections
-fno-unwind-tables
-fno-asynchronous-unwind-tables
-fno-math-errno
-O3
-flto
-fno-fat-lto-objects
-Wshadow
-Wconversion
-fvisibility
=
hidden
-fPIC
CFLAGS
=
-std
=
c99
-D_POSIX_C_SOURCE
=
200809L
-pipe
-Wall
-Wextra
-Wpedantic
-Werror
-Wno-overlength-strings
-Wno-unused-parameter
-Wc
++-compat
-Wformat
-Wformat-security
-Wformat-nonliteral
-Wmissing-prototypes
-Wstrict-prototypes
-Wredundant-decls
-Wuninitialized
-Winit-self
-Wcast-qual
-Wstrict-overflow
-Wnested-externs
-Wmultichar
-Wundef
-fno-strict-aliasing
-fexceptions
-fPIC
-fstack-protector-strong
-fstack-clash-protection
-ffunction-sections
-fdata-sections
-fno-unwind-tables
-fno-asynchronous-unwind-tables
-fno-math-errno
-O3
-flto
-fno-fat-lto-objects
-Wshadow
-Wconversion
-fvisibility
=
hidden
-fPIC
CXXFLAGS
=
-pipe
-Wall
-Wextra
-Wpedantic
-Werror
-Wno-overlength-strings
-Wno-unused-parameter
-Wformat
-Wformat-security
-Wformat-nonliteral
-Wredundant-decls
-Wuninitialized
-Winit-self
-Wcast-qual
-Wstrict-overflow
-Wmultichar
-Wundef
-fno-strict-aliasing
-fexceptions
-fPIC
-fstack-protector-strong
-fstack-clash-protection
-ffunction-sections
-fdata-sections
-fno-unwind-tables
-fno-asynchronous-unwind-tables
-fno-math-errno
-O3
-flto
-fno-fat-lto-objects
-Wshadow
-Wconversion
-fvisibility
=
hidden
-fPIC
CXXFLAGS
=
-pipe
-Wall
-Wextra
-Wpedantic
-Werror
-Wno-overlength-strings
-Wno-unused-parameter
-Wformat
-Wformat-security
-Wformat-nonliteral
-Wredundant-decls
-Wuninitialized
-Winit-self
-Wcast-qual
-Wstrict-overflow
-Wmultichar
-Wundef
-fno-strict-aliasing
-fexceptions
-fPIC
-fstack-protector-strong
-fstack-clash-protection
-ffunction-sections
-fdata-sections
-fno-unwind-tables
-fno-asynchronous-unwind-tables
-fno-math-errno
-O3
-flto
-fno-fat-lto-objects
-Wshadow
-Wconversion
-fvisibility
=
hidden
-fPIC
LDFLAGS
+=
-std
=
c99
-D_POSIX_C_SOURCE
=
200809L
-pipe
-Wall
-Wextra
-Wpedantic
-Werror
-Wno-static-in-inline
-Wno-overlength-strings
-Wno-unused-parameter
-Wc
++-compat
-Wformat
-Wformat-security
-Wformat-nonliteral
-Wmissing-prototypes
-Wstrict-prototypes
-Wredundant-decls
-Wuninitialized
-Winit-self
-Wcast-qual
-Wstrict-overflow
-Wnested-externs
-Wmultichar
-Wundef
-fno-strict-aliasing
-fexceptions
-fPIC
-fstack-protector-strong
-fstack-clash-protection
-ffunction-sections
-fdata-sections
-fno-unwind-tables
-fno-asynchronous-unwind-tables
-fno-math-errno
-O3
-flto
-fno-fat-lto-objects
-Wshadow
-Wconversion
-fvisibility
=
hidden
-fPIC
LDFLAGS
+=
-std
=
c99
-D_POSIX_C_SOURCE
=
200809L
-pipe
-Wall
-Wextra
-Wpedantic
-Werror
-Wno-static-in-inline
-Wno-overlength-strings
-Wno-unused-parameter
-Wc
++-compat
-Wformat
-Wformat-security
-Wformat-nonliteral
-Wmissing-prototypes
-Wstrict-prototypes
-Wredundant-decls
-Wuninitialized
-Winit-self
-Wcast-qual
-Wstrict-overflow
-Wnested-externs
-Wmultichar
-Wundef
-fno-strict-aliasing
-fexceptions
-fPIC
-fstack-protector-strong
-fstack-clash-protection
-ffunction-sections
-fdata-sections
-fno-unwind-tables
-fno-asynchronous-unwind-tables
-fno-math-errno
-O3
-flto
-fno-fat-lto-objects
-Wshadow
-Wconversion
-fvisibility
=
hidden
-fPIC
LIBS
=
-lstdc
++
-lmavsdk
-lmavsdk_action
-lmavsdk_ma
nual_control
-lmavsdk_ma
vlink_passthrough
-lmavsdk_telemetry
-lopen62541
LIBS
=
-lstdc
++
-lmavsdk
-lmavsdk_action
-lmavsdk_mavlink_passthrough
-lmavsdk_telemetry
-lopen62541
LIB_NAME
:=
libqjswrapper.so
LIB_NAME
:=
libqjswrapper.so
...
...
include/mavsdk_wrapper.h
View file @
27ae36e4
...
@@ -20,13 +20,12 @@ extern "C" {
...
@@ -20,13 +20,12 @@ extern "C" {
#endif
#endif
#include <stdint.h>
#include <stdint.h>
// Connexion management functions
// Connexion management functions
int
mavsdk_start
(
const
char
*
url
,
const
char
*
log_file
,
int
timeout
);
int
mavsdk_start
(
const
char
*
ip
,
int
port
,
const
char
*
log_file
,
int
timeout
);
int
mavsdk_stop
(
void
);
int
mavsdk_stop
(
void
);
int
mavsdk_reboot
(
void
);
int
mavsdk_reboot
(
void
);
// Flight state management functions
// Flight state management functions
int
mavsdk_arm
(
void
);
int
mavsdk_arm
(
void
);
int
mavsdk_land
(
void
);
int
mavsdk_takeOff
(
void
);
int
mavsdk_takeOff
(
void
);
int
mavsdk_takeOffAndWait
(
void
);
int
mavsdk_takeOffAndWait
(
void
);
int
mavsdk_triggerParachute
(
void
);
int
mavsdk_triggerParachute
(
void
);
...
@@ -34,9 +33,7 @@ int mavsdk_triggerParachute(void);
...
@@ -34,9 +33,7 @@ int mavsdk_triggerParachute(void);
// Flight management functions
// Flight management functions
int
mavsdk_loiter
(
float
radius
);
int
mavsdk_loiter
(
float
radius
);
int
mavsdk_setAirspeed
(
float
airspeed
);
int
mavsdk_setAirspeed
(
float
airspeed
);
int
mavsdk_setAltitude
(
float
altitude
);
int
mavsdk_setTargetCoordinates
(
double
la
,
double
lo
,
float
a
);
int
mavsdk_setTargetCoordinates
(
double
la
,
double
lo
,
float
a
);
int
mavsdk_setManualControlInput
(
void
);
// Information functions
// Information functions
float
mavsdk_getAltitude
(
void
);
float
mavsdk_getAltitude
(
void
);
...
@@ -53,7 +50,6 @@ float mavsdk_getYaw(void);
...
@@ -53,7 +50,6 @@ float mavsdk_getYaw(void);
float
mavsdk_getSpeed
(
void
);
float
mavsdk_getSpeed
(
void
);
float
mavsdk_getClimbRate
(
void
);
float
mavsdk_getClimbRate
(
void
);
int
mavsdk_healthAllOk
(
void
);
int
mavsdk_healthAllOk
(
void
);
bool
mavsdk_isInManualMode
(
void
);
int
mavsdk_landed
(
void
);
int
mavsdk_landed
(
void
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
mavsdk_wrapper.cpp
View file @
27ae36e4
This diff is collapsed.
Click to expand it.
qjs_wrapper.c
View file @
27ae36e4
...
@@ -405,18 +405,21 @@ static JSValue js_stop_pubsub(JSContext *ctx, JSValueConst thisVal,
...
@@ -405,18 +405,21 @@ static JSValue js_stop_pubsub(JSContext *ctx, JSValueConst thisVal,
static
JSValue
js_mavsdk_start
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
static
JSValue
js_mavsdk_start
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
int
argc
,
JSValueConst
*
argv
)
int
argc
,
JSValueConst
*
argv
)
{
{
const
char
*
url
;
const
char
*
ip
;
const
char
*
log_file
;
const
char
*
log_file
;
int
port
;
int
timeout
;
int
timeout
;
int
res
;
int
res
;
url
=
JS_ToCString
(
ctx
,
argv
[
0
]);
ip
=
JS_ToCString
(
ctx
,
argv
[
0
]);
log_file
=
JS_ToCString
(
ctx
,
argv
[
1
]);
if
(
JS_ToInt32
(
ctx
,
&
port
,
argv
[
1
]))
if
(
JS_ToInt32
(
ctx
,
&
timeout
,
argv
[
2
]))
return
JS_EXCEPTION
;
log_file
=
JS_ToCString
(
ctx
,
argv
[
2
]);
if
(
JS_ToInt32
(
ctx
,
&
timeout
,
argv
[
3
]))
return
JS_EXCEPTION
;
return
JS_EXCEPTION
;
res
=
mavsdk_start
(
url
,
log_file
,
timeout
);
res
=
mavsdk_start
(
ip
,
port
,
log_file
,
timeout
);
JS_FreeCString
(
ctx
,
url
);
JS_FreeCString
(
ctx
,
ip
);
JS_FreeCString
(
ctx
,
log_file
);
JS_FreeCString
(
ctx
,
log_file
);
return
JS_NewInt32
(
ctx
,
res
);
return
JS_NewInt32
(
ctx
,
res
);
...
@@ -442,12 +445,6 @@ static JSValue js_mavsdk_arm(JSContext *ctx, JSValueConst this_val,
...
@@ -442,12 +445,6 @@ static JSValue js_mavsdk_arm(JSContext *ctx, JSValueConst this_val,
return
JS_NewInt32
(
ctx
,
mavsdk_arm
());
return
JS_NewInt32
(
ctx
,
mavsdk_arm
());
}
}
static
JSValue
js_mavsdk_land
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
int
argc
,
JSValueConst
*
argv
)
{
return
JS_NewInt32
(
ctx
,
mavsdk_land
());
}
static
JSValue
js_mavsdk_takeOff
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
static
JSValue
js_mavsdk_takeOff
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
int
argc
,
JSValueConst
*
argv
)
int
argc
,
JSValueConst
*
argv
)
{
{
...
@@ -489,17 +486,6 @@ static JSValue js_mavsdk_setAirspeed(JSContext *ctx, JSValueConst thisVal,
...
@@ -489,17 +486,6 @@ static JSValue js_mavsdk_setAirspeed(JSContext *ctx, JSValueConst thisVal,
return
JS_NewInt32
(
ctx
,
mavsdk_setAirspeed
((
float
)
altitude
));
return
JS_NewInt32
(
ctx
,
mavsdk_setAirspeed
((
float
)
altitude
));
}
}
static
JSValue
js_mavsdk_setAltitude
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
int
argc
,
JSValueConst
*
argv
)
{
double
altitude
;
if
(
JS_ToFloat64
(
ctx
,
&
altitude
,
argv
[
0
]))
return
JS_EXCEPTION
;
return
JS_NewInt32
(
ctx
,
mavsdk_setAltitude
((
float
)
altitude
));
}
static
JSValue
js_mavsdk_setTargetCoordinates
(
JSContext
*
ctx
,
static
JSValue
js_mavsdk_setTargetCoordinates
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
JSValueConst
thisVal
,
int
argc
,
JSValueConst
*
argv
)
int
argc
,
JSValueConst
*
argv
)
...
@@ -520,13 +506,6 @@ static JSValue js_mavsdk_setTargetCoordinates(JSContext *ctx,
...
@@ -520,13 +506,6 @@ static JSValue js_mavsdk_setTargetCoordinates(JSContext *ctx,
(
float
)
a_arg_double
));
(
float
)
a_arg_double
));
}
}
static
JSValue
js_mavsdk_setManualControlInput
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
int
argc
,
JSValueConst
*
argv
)
{
return
JS_NewInt32
(
ctx
,
mavsdk_setManualControlInput
());
}
// Information functions
// Information functions
static
JSValue
js_mavsdk_getAltitude
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
static
JSValue
js_mavsdk_getAltitude
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
...
@@ -605,12 +584,6 @@ static JSValue js_mavsdk_healthAllOk(JSContext *ctx, JSValueConst this_val,
...
@@ -605,12 +584,6 @@ static JSValue js_mavsdk_healthAllOk(JSContext *ctx, JSValueConst this_val,
return
JS_NewBool
(
ctx
,
mavsdk_healthAllOk
());
return
JS_NewBool
(
ctx
,
mavsdk_healthAllOk
());
}
}
static
JSValue
js_mavsdk_isInManualMode
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
int
argc
,
JSValueConst
*
argv
)
{
return
JS_NewBool
(
ctx
,
mavsdk_isInManualMode
());
}
static
JSValue
js_mavsdk_landed
(
JSContext
*
ctx
,
JSValueConst
this_val
,
static
JSValue
js_mavsdk_landed
(
JSContext
*
ctx
,
JSValueConst
this_val
,
int
argc
,
JSValueConst
*
argv
)
int
argc
,
JSValueConst
*
argv
)
{
{
...
@@ -621,19 +594,16 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
...
@@ -621,19 +594,16 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
JS_CFUNC_DEF
(
"setMessage"
,
1
,
js_drone_set_message
),
JS_CFUNC_DEF
(
"setMessage"
,
1
,
js_drone_set_message
),
JS_CFUNC_DEF
(
"runPubsub"
,
6
,
js_run_pubsub
),
JS_CFUNC_DEF
(
"runPubsub"
,
6
,
js_run_pubsub
),
JS_CFUNC_DEF
(
"stopPubsub"
,
0
,
js_stop_pubsub
),
JS_CFUNC_DEF
(
"stopPubsub"
,
0
,
js_stop_pubsub
),
JS_CFUNC_DEF
(
"start"
,
3
,
js_mavsdk_start
),
JS_CFUNC_DEF
(
"start"
,
4
,
js_mavsdk_start
),
JS_CFUNC_DEF
(
"stop"
,
0
,
js_mavsdk_stop
),
JS_CFUNC_DEF
(
"stop"
,
0
,
js_mavsdk_stop
),
JS_CFUNC_DEF
(
"reboot"
,
0
,
js_mavsdk_reboot
),
JS_CFUNC_DEF
(
"reboot"
,
0
,
js_mavsdk_reboot
),
JS_CFUNC_DEF
(
"arm"
,
0
,
js_mavsdk_arm
),
JS_CFUNC_DEF
(
"arm"
,
0
,
js_mavsdk_arm
),
JS_CFUNC_DEF
(
"land"
,
0
,
js_mavsdk_land
),
JS_CFUNC_DEF
(
"takeOff"
,
0
,
js_mavsdk_takeOff
),
JS_CFUNC_DEF
(
"takeOff"
,
0
,
js_mavsdk_takeOff
),
JS_CFUNC_DEF
(
"takeOffAndWait"
,
0
,
js_mavsdk_takeOffAndWait
),
JS_CFUNC_DEF
(
"takeOffAndWait"
,
0
,
js_mavsdk_takeOffAndWait
),
JS_CFUNC_DEF
(
"triggerParachute"
,
0
,
js_mavsdk_triggerParachute
),
JS_CFUNC_DEF
(
"triggerParachute"
,
0
,
js_mavsdk_triggerParachute
),
JS_CFUNC_DEF
(
"loiter"
,
1
,
js_mavsdk_loiter
),
JS_CFUNC_DEF
(
"loiter"
,
1
,
js_mavsdk_loiter
),
JS_CFUNC_DEF
(
"setAirspeed"
,
1
,
js_mavsdk_setAirspeed
),
JS_CFUNC_DEF
(
"setAirspeed"
,
1
,
js_mavsdk_setAirspeed
),
JS_CFUNC_DEF
(
"setAltitude"
,
1
,
js_mavsdk_setAltitude
),
JS_CFUNC_DEF
(
"setTargetCoordinates"
,
3
,
js_mavsdk_setTargetCoordinates
),
JS_CFUNC_DEF
(
"setTargetCoordinates"
,
3
,
js_mavsdk_setTargetCoordinates
),
JS_CFUNC_DEF
(
"setManualControlInput"
,
0
,
js_mavsdk_setManualControlInput
),
JS_CFUNC_DEF
(
"getAltitude"
,
0
,
js_mavsdk_getAltitude
),
JS_CFUNC_DEF
(
"getAltitude"
,
0
,
js_mavsdk_getAltitude
),
JS_CFUNC_DEF
(
"getAltitudeRel"
,
0
,
js_mavsdk_getAltitudeRel
),
JS_CFUNC_DEF
(
"getAltitudeRel"
,
0
,
js_mavsdk_getAltitudeRel
),
JS_CFUNC_DEF
(
"getInitialAltitude"
,
0
,
js_mavsdk_getInitialAltitude
),
JS_CFUNC_DEF
(
"getInitialAltitude"
,
0
,
js_mavsdk_getInitialAltitude
),
...
@@ -645,7 +615,6 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
...
@@ -645,7 +615,6 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
JS_CFUNC_DEF
(
"getYaw"
,
0
,
js_mavsdk_getYaw
),
JS_CFUNC_DEF
(
"getYaw"
,
0
,
js_mavsdk_getYaw
),
JS_CFUNC_DEF
(
"getAirspeed"
,
0
,
js_mavsdk_getSpeed
),
JS_CFUNC_DEF
(
"getAirspeed"
,
0
,
js_mavsdk_getSpeed
),
JS_CFUNC_DEF
(
"getClimbRate"
,
0
,
js_mavsdk_getClimbRate
),
JS_CFUNC_DEF
(
"getClimbRate"
,
0
,
js_mavsdk_getClimbRate
),
JS_CFUNC_DEF
(
"isInManualMode"
,
0
,
js_mavsdk_isInManualMode
),
JS_CFUNC_DEF
(
"healthAllOk"
,
0
,
js_mavsdk_healthAllOk
),
JS_CFUNC_DEF
(
"healthAllOk"
,
0
,
js_mavsdk_healthAllOk
),
JS_CFUNC_DEF
(
"landed"
,
0
,
js_mavsdk_landed
),
JS_CFUNC_DEF
(
"landed"
,
0
,
js_mavsdk_landed
),
JS_CFUNC_DEF
(
"initPubsub"
,
1
,
js_init_pubsub
),
JS_CFUNC_DEF
(
"initPubsub"
,
1
,
js_init_pubsub
),
...
...
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