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
44cd6579
Commit
44cd6579
authored
7 years ago
by
ChristophTobler
Committed by
ChristophTobler
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
update sitl_gazebo to use the vision position estimate
parent
dc8caeae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Tools/sitl_gazebo
+1
-1
1 addition, 1 deletion
Tools/sitl_gazebo
src/modules/simulator/simulator.h
+5
-0
5 additions, 0 deletions
src/modules/simulator/simulator.h
src/modules/simulator/simulator_mavlink.cpp
+34
-0
34 additions, 0 deletions
src/modules/simulator/simulator_mavlink.cpp
with
40 additions
and
1 deletion
sitl_gazebo
@
3b3bc0b4
Compare
354c7a23
...
3b3bc0b4
Subproject commit 3
54c7a23200ddfe388a468165efea48fe81d2623
Subproject commit 3
b3bc0b44fadbd76aa64ef64fe6ac96126142b1f
This diff is collapsed.
Click to expand it.
src/modules/simulator/simulator.h
+
5
−
0
View file @
44cd6579
...
...
@@ -242,6 +242,8 @@ private:
_gyro_pub
(
nullptr
),
_mag_pub
(
nullptr
),
_flow_pub
(
nullptr
),
_vision_position_pub
(
nullptr
),
_vision_attitude_pub
(
nullptr
),
_dist_pub
(
nullptr
),
_battery_pub
(
nullptr
),
_initialized
(
false
),
...
...
@@ -320,6 +322,8 @@ private:
orb_advert_t
_gyro_pub
;
orb_advert_t
_mag_pub
;
orb_advert_t
_flow_pub
;
orb_advert_t
_vision_position_pub
;
orb_advert_t
_vision_attitude_pub
;
orb_advert_t
_dist_pub
;
orb_advert_t
_battery_pub
;
...
...
@@ -334,6 +338,7 @@ private:
// class methods
int
publish_sensor_topics
(
mavlink_hil_sensor_t
*
imu
);
int
publish_flow_topic
(
mavlink_hil_optical_flow_t
*
flow
);
int
publish_ev_topic
(
mavlink_vision_position_estimate_t
*
ev_mavlink
);
int
publish_distance_topic
(
mavlink_distance_sensor_t
*
dist
);
#ifndef __PX4_QURT
...
...
This diff is collapsed.
Click to expand it.
src/modules/simulator/simulator_mavlink.cpp
+
34
−
0
View file @
44cd6579
...
...
@@ -345,6 +345,12 @@ void Simulator::handle_message(mavlink_message_t *msg, bool publish)
publish_flow_topic
(
&
flow
);
break
;
case
MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
:
mavlink_vision_position_estimate_t
ev
;
mavlink_msg_vision_position_estimate_decode
(
msg
,
&
ev
);
publish_ev_topic
(
&
ev
);
break
;
case
MAVLINK_MSG_ID_DISTANCE_SENSOR
:
mavlink_distance_sensor_t
dist
;
mavlink_msg_distance_sensor_decode
(
msg
,
&
dist
);
...
...
@@ -1059,6 +1065,34 @@ int Simulator::publish_flow_topic(mavlink_hil_optical_flow_t *flow_mavlink)
return
OK
;
}
int
Simulator
::
publish_ev_topic
(
mavlink_vision_position_estimate_t
*
ev_mavlink
)
{
uint64_t
timestamp
=
hrt_absolute_time
();
struct
vehicle_local_position_s
vision_position
=
{};
// Use the estimator type to identify the simple vision estimate
vision_position
.
estimator_type
=
MAV_ESTIMATOR_TYPE_VISION
;
vision_position
.
timestamp
=
timestamp
;
vision_position
.
x
=
ev_mavlink
->
x
;
vision_position
.
y
=
ev_mavlink
->
y
;
vision_position
.
z
=
ev_mavlink
->
z
;
struct
vehicle_attitude_s
vision_attitude
=
{};
vision_attitude
.
timestamp
=
timestamp
;
matrix
::
Quatf
q
(
matrix
::
Eulerf
(
ev_mavlink
->
roll
,
ev_mavlink
->
pitch
,
ev_mavlink
->
yaw
));
q
.
copyTo
(
vision_attitude
.
q
);
int
inst
=
0
;
orb_publish_auto
(
ORB_ID
(
vehicle_vision_position
),
&
_vision_position_pub
,
&
vision_position
,
&
inst
,
ORB_PRIO_HIGH
);
orb_publish_auto
(
ORB_ID
(
vehicle_vision_attitude
),
&
_vision_attitude_pub
,
&
vision_attitude
,
&
inst
,
ORB_PRIO_HIGH
);
return
OK
;
}
int
Simulator
::
publish_distance_topic
(
mavlink_distance_sensor_t
*
dist_mavlink
)
{
uint64_t
timestamp
=
hrt_absolute_time
();
...
...
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