Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
1a445c9c
Commit
1a445c9c
authored
7 years ago
by
Julien Lecoeur
Committed by
Nuno Marques
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add debug_value and debug_vect to example px4_mavlink_debug
parent
0e6e0f4c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/examples/px4_mavlink_debug/px4_mavlink_debug.c
+33
-6
33 additions, 6 deletions
src/examples/px4_mavlink_debug/px4_mavlink_debug.c
with
33 additions
and
6 deletions
src/examples/px4_mavlink_debug/px4_mavlink_debug.c
+
33
−
6
View file @
1a445c9c
...
...
@@ -44,9 +44,12 @@
#include
<poll.h>
#include
<systemlib/err.h>
#include
<drivers/drv_hrt.h>
#include
<uORB/uORB.h>
#include
<uORB/topics/debug_key_value.h>
#include
<uORB/topics/debug_value.h>
#include
<uORB/topics/debug_vect.h>
__EXPORT
int
px4_mavlink_debug_main
(
int
argc
,
char
*
argv
[]);
...
...
@@ -54,16 +57,40 @@ int px4_mavlink_debug_main(int argc, char *argv[])
{
printf
(
"Hello Debug!
\n
"
);
/* advertise debug value */
struct
debug_key_value_s
dbg
=
{
.
key
=
"velx"
,
.
value
=
0
.
0
f
};
orb_advert_t
pub_dbg
=
orb_advertise
(
ORB_ID
(
debug_key_value
),
&
dbg
);
/* advertise named debug value */
struct
debug_key_value_s
dbg_key
=
{
.
key
=
"velx"
,
.
value
=
0
.
0
f
};
orb_advert_t
pub_dbg_key
=
orb_advertise
(
ORB_ID
(
debug_key_value
),
&
dbg_key
);
/* advertise indexed debug value */
struct
debug_value_s
dbg_ind
=
{
.
ind
=
42
,
.
value
=
0
.
5
f
};
orb_advert_t
pub_dbg_ind
=
orb_advertise
(
ORB_ID
(
debug_value
),
&
dbg_ind
);
/* advertise debug vect */
struct
debug_vect_s
dbg_vect
=
{
.
name
=
"vel3D"
,
.
x
=
1
.
0
f
,
.
y
=
2
.
0
f
,
.
z
=
3
.
0
f
};
orb_advert_t
pub_dbg_vect
=
orb_advertise
(
ORB_ID
(
debug_vect
),
&
dbg_vect
);
int
value_counter
=
0
;
while
(
value_counter
<
100
)
{
/* send one value */
dbg
.
value
=
value_counter
;
orb_publish
(
ORB_ID
(
debug_key_value
),
pub_dbg
,
&
dbg
);
uint64_t
timestamp_us
=
hrt_absolute_time
();
uint32_t
timestamp_ms
=
timestamp_us
/
1000
;
/* send one named value */
dbg_key
.
value
=
value_counter
;
dbg_key
.
timestamp_ms
=
timestamp_ms
;
orb_publish
(
ORB_ID
(
debug_key_value
),
pub_dbg_key
,
&
dbg_key
);
/* send one indexed value */
dbg_ind
.
value
=
0
.
5
f
*
value_counter
;
dbg_ind
.
timestamp_ms
=
timestamp_ms
;
orb_publish
(
ORB_ID
(
debug_value
),
pub_dbg_ind
,
&
dbg_ind
);
/* send one vector */
dbg_vect
.
x
=
1
.
0
f
*
value_counter
;
dbg_vect
.
y
=
2
.
0
f
*
value_counter
;
dbg_vect
.
z
=
3
.
0
f
*
value_counter
;
dbg_vect
.
timestamp_us
=
timestamp_us
;
orb_publish
(
ORB_ID
(
debug_vect
),
pub_dbg_vect
,
&
dbg_vect
);
warnx
(
"sent one more value.."
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment