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
4fecb6fe
Commit
4fecb6fe
authored
7 years ago
by
Nicolas de Palezieux
Committed by
Lorenz Meier
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
irlock : add support for precision landing
parent
155c5581
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/drivers/irlock/irlock.cpp
+32
-1
32 additions, 1 deletion
src/drivers/irlock/irlock.cpp
with
32 additions
and
1 deletion
src/drivers/irlock/irlock.cpp
+
32
−
1
View file @
4fecb6fe
...
...
@@ -58,6 +58,9 @@
#include
<nuttx/wqueue.h>
#include
<systemlib/err.h>
#include
<uORB/uORB.h>
#include
<uORB/topics/irlock_report.h>
/** Configuration Constants **/
#define IRLOCK_I2C_BUS PX4_I2C_BUS_EXPANSION
#define IRLOCK_I2C_ADDRESS 0x54
/** 7-bit address (non shifted) **/
...
...
@@ -124,6 +127,9 @@ private:
bool
_sensor_ok
;
work_s
_work
;
uint32_t
_read_failures
;
int
_orb_class_instance
;
orb_advert_t
_irlock_report_topic
;
};
/** global pointer for single IRLOCK sensor **/
...
...
@@ -141,7 +147,9 @@ IRLOCK::IRLOCK(int bus, int address) :
I2C
(
"irlock"
,
IRLOCK0_DEVICE_PATH
,
bus
,
address
,
400000
),
_reports
(
nullptr
),
_sensor_ok
(
false
),
_read_failures
(
0
)
_read_failures
(
0
),
_orb_class_instance
(
-
1
),
_irlock_report_topic
(
nullptr
)
{
memset
(
&
_work
,
0
,
sizeof
(
_work
));
}
...
...
@@ -363,6 +371,29 @@ int IRLOCK::read_device()
_reports
->
force
(
&
report
);
// publish over uORB
if
(
report
.
num_targets
>
0
)
{
struct
irlock_report_s
orb_report
;
orb_report
.
timestamp
=
report
.
timestamp
;
orb_report
.
signature
=
report
.
targets
[
0
].
signature
;
orb_report
.
pos_x
=
report
.
targets
[
0
].
pos_x
;
orb_report
.
pos_y
=
report
.
targets
[
0
].
pos_y
;
orb_report
.
size_x
=
report
.
targets
[
0
].
size_x
;
orb_report
.
size_y
=
report
.
targets
[
0
].
size_y
;
if
(
_irlock_report_topic
!=
nullptr
)
{
orb_publish
(
ORB_ID
(
irlock_report
),
_irlock_report_topic
,
&
orb_report
);
}
else
{
_irlock_report_topic
=
orb_advertise_multi
(
ORB_ID
(
irlock_report
),
&
orb_report
,
&
_orb_class_instance
,
ORB_PRIO_LOW
);
if
(
_irlock_report_topic
==
nullptr
)
{
DEVICE_LOG
(
"failed to create irlock_report object. Did you start uOrb?"
);
}
}
}
return
OK
;
}
...
...
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