Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
012e8345
Commit
012e8345
authored
Sep 04, 2011
by
lm
Browse files
Fixed Google Earth bug
parent
d4f8f5b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
images/earth.html
View file @
012e8345
...
...
@@ -16,6 +16,7 @@ var ge = null;
var
initialized
=
false
;
var
currAircraft
=
0
;
var
followEnabled
=
false
;
var
lineAltitudeOffset
=
0.5
;
///
<
0.5
m
higher
than
waypoint
,
prevents
the
line
from
entering
the
ground
var
lastLat
=
0
;
var
lastLon
=
0
;
...
...
@@ -211,23 +212,24 @@ google.earth.addEventListener(ge.getGlobe(), 'mousemove', function(event)
{
if
(
draggingAllowed
&&
(
clickMode
==
0
))
{
if
(
dragInfo
)
{
event
.
preventDefault
();
var
point
=
dragInfo
.
placemark
.
getGeometry
();
point
.
setLatitude
(
event
.
getLatitude
());
point
.
setLongitude
(
event
.
getLongitude
());
dragInfo
.
dragged
=
true
;
dragWaypointIndex
=
dragInfo
.
placemark
.
getDescription
();
document
.
getElementById
(
'
JScript_dragWaypointIndex
'
).
setAttribute
(
'
value
'
,
dragWaypointIndex
);
dragWaypointLatitude
=
event
.
getLatitude
();
dragWaypointLongitude
=
event
.
getLongitude
();
dragWaypointAltitude
=
point
.
getAltitude
();
dragWaypointPending
=
true
;
document
.
getElementById
(
'
JScript_dragWaypointLatitude
'
).
setAttribute
(
'
value
'
,
dragWaypointLatitude
);
document
.
getElementById
(
'
JScript_dragWaypointLongitude
'
).
setAttribute
(
'
value
'
,
dragWaypointLongitude
);
document
.
getElementById
(
'
JScript_dragWaypointAltitude
'
).
setAttribute
(
'
value
'
,
dragWaypointAltitude
);
document
.
getElementById
(
'
JScript_dragWaypointPending
'
).
setAttribute
(
'
value
'
,
true
);
}
if
(
dragInfo
)
{
event
.
preventDefault
();
var
point
=
dragInfo
.
placemark
.
getGeometry
();
point
.
setLatitude
(
event
.
getLatitude
());
point
.
setLongitude
(
event
.
getLongitude
());
dragInfo
.
dragged
=
true
;
dragWaypointIndex
=
dragInfo
.
placemark
.
getDescription
();
document
.
getElementById
(
'
JScript_dragWaypointIndex
'
).
setAttribute
(
'
value
'
,
dragWaypointIndex
);
dragWaypointLatitude
=
event
.
getLatitude
();
dragWaypointLongitude
=
event
.
getLongitude
();
dragWaypointAltitude
=
point
.
getAltitude
();
dragWaypointPending
=
true
;
document
.
getElementById
(
'
JScript_dragWaypointLatitude
'
).
setAttribute
(
'
value
'
,
dragWaypointLatitude
);
document
.
getElementById
(
'
JScript_dragWaypointLongitude
'
).
setAttribute
(
'
value
'
,
dragWaypointLongitude
);
document
.
getElementById
(
'
JScript_dragWaypointAltitude
'
).
setAttribute
(
'
value
'
,
dragWaypointAltitude
);
document
.
getElementById
(
'
JScript_dragWaypointPending
'
).
setAttribute
(
'
value
'
,
true
);
}
}
});
...
...
@@ -298,7 +300,7 @@ function setGCSHome(lat, lon, alt)
if
(
homePlacemark
==
null
)
{
var
placemark
=
ge
.
createPlacemark
(
''
);
var
placemark
=
ge
.
createPlacemark
(
''
);
var
icon
=
ge
.
createIcon
(
''
);
icon
.
setHref
(
'
http://google-maps-icons.googlecode.com/files/blackH.png
'
);
var
style
=
ge
.
createStyle
(
''
);
...
...
@@ -349,6 +351,8 @@ function updateWaypointListLength(id, len)
{
var
placemark
=
waypoints
.
pop
();
ge
.
getFeatures
().
removeChild
(
placemark
);
var
line
=
waypointLines
[
id
].
pop
();
ge
.
getFeatures
().
removeChild
(
line
);
}
}
}
...
...
@@ -367,7 +371,8 @@ function updateWaypoint(id, index, lat, lon, alt, action)
waypoints
[
index
].
setGeometry
(
location
);
waypoints
[
index
].
setDescription
(
index
+
""
);
// Set the WP line location
waypointLines
[
id
].
getCoordinates
().
setLatLngAlt
(
index
,
lat
,
lon
,
alt
);
}
else
{
...
...
@@ -388,122 +393,108 @@ function updateWaypoint(id, index, lat, lon, alt, action)
var
location
=
ge
.
createPoint
(
''
);
location
.
setLatitude
(
lat
);
location
.
setLongitude
(
lon
);
location
.
setAltitude
(
alt
);
location
.
setAltitude
(
alt
+
lineAltitudeOffset
);
placemark
.
setGeometry
(
location
);
// Add the placemark to Earth.
ge
.
getFeatures
().
appendChild
(
placemark
);
waypoints
[
index
]
=
placemark
;
}
// Add waypoint line
waypointLines
[
id
].
setExtrude
(
false
);
waypointLines
[
id
].
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
// Add LineString points
waypointLines
[
id
].
getCoordinates
().
pushLatLngAlt
(
lat
,
lon
,
alt
);
// Create a style and set width and color of line
waypointLinePlacemarks
[
id
].
setStyleSelector
(
ge
.
createStyle
(
''
));
lineStyle
=
waypointLinePlacemarks
[
id
].
getStyleSelector
().
getLineStyle
();
lineStyle
.
setWidth
(
5
);
lineStyle
.
getColor
().
set
(
waypointLineColors
[
id
]);
// aabbggrr format
//lineStyle.getColor().set(color); // aabbggrr format
// Add the feature to Earth
//if (waypointLinesVisible[id] == true)
ge
.
getFeatures
().
replaceChild
(
waypointLinePlacemarks
[
id
],
waypointLinePlacemarks
[
id
]);
// Add connecting line
}
}
function
createAircraft
(
id
,
type
,
color
)
{
planePlacemark
=
ge
.
createPlacemark
(
''
);
planePlacemark
.
setName
(
'
aircraft
'
);
planeModel
=
ge
.
createModel
(
''
);
ge
.
getFeatures
().
appendChild
(
planePlacemark
);
planeLoc
=
ge
.
createLocation
(
''
);
planeModel
.
setLocation
(
planeLoc
);
planeLink
=
ge
.
createLink
(
''
);
planeOrient
=
ge
.
createOrientation
(
''
);
planeModel
.
setOrientation
(
planeOrient
);
planeLink
.
setHref
(
'
http://qgroundcontrol.org/_media/users/models/
multiplex-twinsta
r.dae
'
);
planeModel
.
setLink
(
planeLink
);
planeModel
.
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
planeLoc
.
setLatitude
(
currLat
);
planeLoc
.
setLongitude
(
currLon
);
planeLoc
.
setAltitude
(
currAlt
);
planePlacemark
.
setGeometry
(
planeModel
);
planePlacemark
=
ge
.
createPlacemark
(
''
);
planePlacemark
.
setName
(
'
aircraft
'
);
planeModel
=
ge
.
createModel
(
''
);
ge
.
getFeatures
().
appendChild
(
planePlacemark
);
planeLoc
=
ge
.
createLocation
(
''
);
planeModel
.
setLocation
(
planeLoc
);
planeLink
=
ge
.
createLink
(
''
);
planeOrient
=
ge
.
createOrientation
(
''
);
planeModel
.
setOrientation
(
planeOrient
);
planeLink
.
setHref
(
'
http://qgroundcontrol.org/_media/users/models/
ascent-park-glide
r.dae
'
);
planeModel
.
setLink
(
planeLink
);
planeModel
.
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
planeLoc
.
setLatitude
(
currLat
);
planeLoc
.
setLongitude
(
currLon
);
planeLoc
.
setAltitude
(
currAlt
);
planePlacemark
.
setGeometry
(
planeModel
);
// Write into global structure
aircraft
[
id
]
=
planePlacemark
;
attitudes
[
id
]
=
planeOrient
;
aircraftLocations
[
id
]
=
planeLoc
;
aircraftLastLocations
[
id
]
=
ge
.
createLocation
(
''
);
//planeColor = color;
// Write into global structure
aircraft
[
id
]
=
planePlacemark
;
attitudes
[
id
]
=
planeOrient
;
aircraftLocations
[
id
]
=
planeLoc
;
aircraftLastLocations
[
id
]
=
ge
.
createLocation
(
''
);
createTrail
(
id
,
color
);
createWaypointLine
(
id
,
color
);
//console.log(color);
createTrail
(
id
,
color
);
createWaypointLine
(
id
,
color
);
}
function
createTrail
(
id
,
color
)
{
trailPlacemarks
[
id
]
=
ge
.
createPlacemark
(
''
);
// Create the placemark
// Create the LineString; set it to extend down to the ground
// and set the altitude mode
trails
[
id
]
=
ge
.
createLineString
(
''
);
trailPlacemarks
[
id
].
setGeometry
(
trails
[
id
]);
trails
[
id
].
setExtrude
(
false
);
trails
[
id
].
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
// Add LineString points
//lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700);
// Create a style and set width and color of line
trailPlacemarks
[
id
].
setStyleSelector
(
ge
.
createStyle
(
''
));
lineStyle
=
trailPlacemarks
[
id
].
getStyleSelector
().
getLineStyle
();
lineStyle
.
setWidth
(
5
);
trailColors
[
id
]
=
color
;
lineStyle
.
getColor
().
set
(
'
00000000
'
);
// aabbggrr format
trailsVisible
[
id
]
=
false
;
trailPlacemarks
[
id
]
=
ge
.
createPlacemark
(
''
);
// Create the placemark
// Create the LineString; set it to extend down to the ground
// and set the altitude mode
trails
[
id
]
=
ge
.
createLineString
(
''
);
trailPlacemarks
[
id
].
setGeometry
(
trails
[
id
]);
trails
[
id
].
setExtrude
(
false
);
trails
[
id
].
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
// Add the feature to Earth
//ge.getFeatures().appendChild(trailPlacemarks[id]);
// Create a style and set width and color of line
trailPlacemarks
[
id
].
setStyleSelector
(
ge
.
createStyle
(
''
));
lineStyle
=
trailPlacemarks
[
id
].
getStyleSelector
().
getLineStyle
();
lineStyle
.
setWidth
(
5
);
trailColors
[
id
]
=
color
;
lineStyle
.
getColor
().
set
(
'
00000000
'
);
// aabbggrr format
trailsVisible
[
id
]
=
false
;
}
function
createWaypointLine
(
id
,
color
)
{
waypointLinePlacemarks
[
id
]
=
ge
.
createPlacemark
(
''
);
// Create the placemark
// Create the LineString; set it to extend down to the ground
// and set the altitude mode
waypointLines
[
id
]
=
ge
.
createLineString
(
''
);
waypointLinePlacemarks
[
id
].
setGeometry
(
waypointLines
[
id
]);
waypointLines
[
id
].
setExtrude
(
false
);
waypointLines
[
id
].
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
// Add LineString points
//lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700);
// Create the placemark
waypointLinePlacemarks
[
id
]
=
ge
.
createPlacemark
(
''
);
// Create the LineString; set it to extend down to the ground
// and set the altitude mode
waypointLines
[
id
]
=
ge
.
createLineString
(
''
);
waypointLinePlacemarks
[
id
].
setGeometry
(
waypointLines
[
id
]);
waypointLines
[
id
].
setExtrude
(
false
);
waypointLines
[
id
].
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
// Add LineString points
//lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700);
// Create a style and set width and color of line
waypointLinePlacemarks
[
id
].
setStyleSelector
(
ge
.
createStyle
(
''
));
lineStyle
=
waypointLinePlacemarks
[
id
].
getStyleSelector
().
getLineStyle
();
lineStyle
.
setWidth
(
15
);
waypointLineColors
[
id
]
=
color
;
lineStyle
.
getColor
().
set
(
color
);
// aabbggrr format
// Add waypoint line
//waypointLines[id].setExtrude(false);
//waypointLines[id].setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
// Create a style and set width and color of line
waypointLinePlacemarks
[
id
].
setStyleSelector
(
ge
.
createStyle
(
''
));
lineStyle
=
waypointLinePlacemarks
[
id
].
getStyleSelector
().
getLineStyle
();
lineStyle
.
setWidth
(
10
);
waypointLineColors
[
id
]
=
color
;
lineStyle
.
getColor
().
set
(
'
00000000
'
);
// aabbggrr format
// Add the feature to Earth
//ge.getFeatures().appendChild(trailPlacemarks[id]);
// Create a style and set width and color of line
//waypointLinePlacemarks[id].setStyleSelector(ge.createStyle(''));
//lineStyle = waypointLinePlacemarks[id].getStyleSelector().getLineStyle();
//lineStyle.setWidth(15);
//lineStyle.getColor().set(waypointLineColors[id]); // aabbggrr format
//lineStyle.getColor().set(color); // aabbggrr format
// Add the feature to Earth
ge
.
getFeatures
().
appendChild
(
waypointLinePlacemarks
[
id
]);
}
function
clearTrail
(
id
)
...
...
@@ -537,8 +528,8 @@ function setViewRange(dist)
function
addTrailPosition
(
id
,
lat
,
lon
,
alt
)
{
trails
[
id
].
setExtrude
(
false
);
trails
[
id
].
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
//
trails[id].setExtrude(false);
//
trails[id].setAltitudeMode(ge.ALTITUDE_ABSOLUTE);
// Add LineString points
trails
[
id
].
getCoordinates
().
pushLatLngAlt
(
lat
,
lon
,
alt
);
...
...
@@ -548,10 +539,6 @@ function addTrailPosition(id, lat, lon, alt)
lineStyle
=
trailPlacemarks
[
id
].
getStyleSelector
().
getLineStyle
();
lineStyle
.
setWidth
(
5
);
lineStyle
.
getColor
().
set
(
trailColors
[
id
]);
// aabbggrr format
//lineStyle.getColor().set(color); // aabbggrr format
// Add the feature to Earth
if
(
trailsVisible
[
id
]
==
true
)
ge
.
getFeatures
().
replaceChild
(
trailPlacemarks
[
id
],
trailPlacemarks
[
id
]);
}
function
initCallback
(
object
)
...
...
@@ -583,6 +570,7 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
lastLat
=
currLat
;
lastLon
=
currLon
;
}
currLat
=
lat
;
currLon
=
lon
;
var
trueGroundAlt
=
ge
.
getGlobe
().
getGroundAltitude
(
lat
,
lon
);
...
...
@@ -601,19 +589,19 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
//currFollowHeading = ((yaw/M_PI)+1.0)*360.0;
// FIXME Currently invalid conversion from right-handed z-down to z-up frame
planeOrient
.
setRoll
(((
roll
/
M_PI
))
*
180.0
+
180.0
);
planeOrient
.
setTilt
(((
pitch
/
M_PI
))
*
180.0
+
180.0
);
planeOrient
.
setHeading
(((
yaw
/
M_PI
))
*
180.0
-
90.0
);
// FIXME Currently invalid conversion from right-handed z-down to z-up frame
planeOrient
.
setRoll
(((
roll
/
M_PI
))
*
180.0
+
180.0
);
planeOrient
.
setTilt
(((
pitch
/
M_PI
))
*
180.0
+
180.0
);
planeOrient
.
setHeading
(((
yaw
/
M_PI
))
*
180.0
-
90.0
);
currFollowHeading
=
((
yaw
/
M_PI
))
*
180.0
;
currFollowHeading
=
((
yaw
/
M_PI
))
*
180.0
;
planeLoc
.
setLatitude
(
lastLat
);
planeLoc
.
setLongitude
(
lastLon
);
planeLoc
.
setAltitude
(
lastAlt
);
planeModel
.
setLocation
(
planeLoc
);
planeLoc
.
setLatitude
(
lastLat
);
planeLoc
.
setLongitude
(
lastLon
);
planeLoc
.
setAltitude
(
lastAlt
);
planeModel
.
setLocation
(
planeLoc
);
if
(
followEnabled
)
updateFollowAircraft
();
if
(
followEnabled
)
updateFollowAircraft
();
}
}
...
...
@@ -663,6 +651,7 @@ function setViewMode(mode)
currView
.
setTilt
(
lastTilt
);
currView
.
setHeading
(
lastHeading
);
}
if
(
mode
==
1
&&
viewMode
!=
mode
)
{
lastTilt
=
currView
.
getTilt
();
...
...
thirdParty/mavlink/include/common/mavlink_msg_attitude_controller_output.h
deleted
100644 → 0
View file @
d4f8f5b3
// MESSAGE ATTITUDE_CONTROLLER_OUTPUT PACKING
#define MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT 60
typedef
struct
__mavlink_attitude_controller_output_t
{
uint8_t
enabled
;
///< 1: enabled, 0: disabled
int8_t
roll
;
///< Attitude roll: -128: -100%, 127: +100%
int8_t
pitch
;
///< Attitude pitch: -128: -100%, 127: +100%
int8_t
yaw
;
///< Attitude yaw: -128: -100%, 127: +100%
int8_t
thrust
;
///< Attitude thrust: -128: -100%, 127: +100%
}
mavlink_attitude_controller_output_t
;
/**
* @brief Pack a attitude_controller_output message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param enabled 1: enabled, 0: disabled
* @param roll Attitude roll: -128: -100%, 127: +100%
* @param pitch Attitude pitch: -128: -100%, 127: +100%
* @param yaw Attitude yaw: -128: -100%, 127: +100%
* @param thrust Attitude thrust: -128: -100%, 127: +100%
* @return length of the message in bytes (excluding serial stream start sign)
*/
static
inline
uint16_t
mavlink_msg_attitude_controller_output_pack
(
uint8_t
system_id
,
uint8_t
component_id
,
mavlink_message_t
*
msg
,
uint8_t
enabled
,
int8_t
roll
,
int8_t
pitch
,
int8_t
yaw
,
int8_t
thrust
)
{
uint16_t
i
=
0
;
msg
->
msgid
=
MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT
;
i
+=
put_uint8_t_by_index
(
enabled
,
i
,
msg
->
payload
);
// 1: enabled, 0: disabled
i
+=
put_int8_t_by_index
(
roll
,
i
,
msg
->
payload
);
// Attitude roll: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
pitch
,
i
,
msg
->
payload
);
// Attitude pitch: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
yaw
,
i
,
msg
->
payload
);
// Attitude yaw: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
thrust
,
i
,
msg
->
payload
);
// Attitude thrust: -128: -100%, 127: +100%
return
mavlink_finalize_message
(
msg
,
system_id
,
component_id
,
i
);
}
/**
* @brief Pack a attitude_controller_output message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param enabled 1: enabled, 0: disabled
* @param roll Attitude roll: -128: -100%, 127: +100%
* @param pitch Attitude pitch: -128: -100%, 127: +100%
* @param yaw Attitude yaw: -128: -100%, 127: +100%
* @param thrust Attitude thrust: -128: -100%, 127: +100%
* @return length of the message in bytes (excluding serial stream start sign)
*/
static
inline
uint16_t
mavlink_msg_attitude_controller_output_pack_chan
(
uint8_t
system_id
,
uint8_t
component_id
,
uint8_t
chan
,
mavlink_message_t
*
msg
,
uint8_t
enabled
,
int8_t
roll
,
int8_t
pitch
,
int8_t
yaw
,
int8_t
thrust
)
{
uint16_t
i
=
0
;
msg
->
msgid
=
MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT
;
i
+=
put_uint8_t_by_index
(
enabled
,
i
,
msg
->
payload
);
// 1: enabled, 0: disabled
i
+=
put_int8_t_by_index
(
roll
,
i
,
msg
->
payload
);
// Attitude roll: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
pitch
,
i
,
msg
->
payload
);
// Attitude pitch: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
yaw
,
i
,
msg
->
payload
);
// Attitude yaw: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
thrust
,
i
,
msg
->
payload
);
// Attitude thrust: -128: -100%, 127: +100%
return
mavlink_finalize_message_chan
(
msg
,
system_id
,
component_id
,
chan
,
i
);
}
/**
* @brief Encode a attitude_controller_output struct into a message
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param attitude_controller_output C-struct to read the message contents from
*/
static
inline
uint16_t
mavlink_msg_attitude_controller_output_encode
(
uint8_t
system_id
,
uint8_t
component_id
,
mavlink_message_t
*
msg
,
const
mavlink_attitude_controller_output_t
*
attitude_controller_output
)
{
return
mavlink_msg_attitude_controller_output_pack
(
system_id
,
component_id
,
msg
,
attitude_controller_output
->
enabled
,
attitude_controller_output
->
roll
,
attitude_controller_output
->
pitch
,
attitude_controller_output
->
yaw
,
attitude_controller_output
->
thrust
);
}
/**
* @brief Send a attitude_controller_output message
* @param chan MAVLink channel to send the message
*
* @param enabled 1: enabled, 0: disabled
* @param roll Attitude roll: -128: -100%, 127: +100%
* @param pitch Attitude pitch: -128: -100%, 127: +100%
* @param yaw Attitude yaw: -128: -100%, 127: +100%
* @param thrust Attitude thrust: -128: -100%, 127: +100%
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static
inline
void
mavlink_msg_attitude_controller_output_send
(
mavlink_channel_t
chan
,
uint8_t
enabled
,
int8_t
roll
,
int8_t
pitch
,
int8_t
yaw
,
int8_t
thrust
)
{
mavlink_message_t
msg
;
mavlink_msg_attitude_controller_output_pack_chan
(
mavlink_system
.
sysid
,
mavlink_system
.
compid
,
chan
,
&
msg
,
enabled
,
roll
,
pitch
,
yaw
,
thrust
);
mavlink_send_uart
(
chan
,
&
msg
);
}
#endif
// MESSAGE ATTITUDE_CONTROLLER_OUTPUT UNPACKING
/**
* @brief Get field enabled from attitude_controller_output message
*
* @return 1: enabled, 0: disabled
*/
static
inline
uint8_t
mavlink_msg_attitude_controller_output_get_enabled
(
const
mavlink_message_t
*
msg
)
{
return
(
uint8_t
)(
msg
->
payload
)[
0
];
}
/**
* @brief Get field roll from attitude_controller_output message
*
* @return Attitude roll: -128: -100%, 127: +100%
*/
static
inline
int8_t
mavlink_msg_attitude_controller_output_get_roll
(
const
mavlink_message_t
*
msg
)
{
return
(
int8_t
)(
msg
->
payload
+
sizeof
(
uint8_t
))[
0
];
}
/**
* @brief Get field pitch from attitude_controller_output message
*
* @return Attitude pitch: -128: -100%, 127: +100%
*/
static
inline
int8_t
mavlink_msg_attitude_controller_output_get_pitch
(
const
mavlink_message_t
*
msg
)
{
return
(
int8_t
)(
msg
->
payload
+
sizeof
(
uint8_t
)
+
sizeof
(
int8_t
))[
0
];
}
/**
* @brief Get field yaw from attitude_controller_output message
*
* @return Attitude yaw: -128: -100%, 127: +100%
*/
static
inline
int8_t
mavlink_msg_attitude_controller_output_get_yaw
(
const
mavlink_message_t
*
msg
)
{
return
(
int8_t
)(
msg
->
payload
+
sizeof
(
uint8_t
)
+
sizeof
(
int8_t
)
+
sizeof
(
int8_t
))[
0
];
}
/**
* @brief Get field thrust from attitude_controller_output message
*
* @return Attitude thrust: -128: -100%, 127: +100%
*/
static
inline
int8_t
mavlink_msg_attitude_controller_output_get_thrust
(
const
mavlink_message_t
*
msg
)
{
return
(
int8_t
)(
msg
->
payload
+
sizeof
(
uint8_t
)
+
sizeof
(
int8_t
)
+
sizeof
(
int8_t
)
+
sizeof
(
int8_t
))[
0
];
}
/**
* @brief Decode a attitude_controller_output message into a struct
*
* @param msg The message to decode
* @param attitude_controller_output C-struct to decode the message contents into
*/
static
inline
void
mavlink_msg_attitude_controller_output_decode
(
const
mavlink_message_t
*
msg
,
mavlink_attitude_controller_output_t
*
attitude_controller_output
)
{
attitude_controller_output
->
enabled
=
mavlink_msg_attitude_controller_output_get_enabled
(
msg
);
attitude_controller_output
->
roll
=
mavlink_msg_attitude_controller_output_get_roll
(
msg
);
attitude_controller_output
->
pitch
=
mavlink_msg_attitude_controller_output_get_pitch
(
msg
);
attitude_controller_output
->
yaw
=
mavlink_msg_attitude_controller_output_get_yaw
(
msg
);
attitude_controller_output
->
thrust
=
mavlink_msg_attitude_controller_output_get_thrust
(
msg
);
}
thirdParty/mavlink/include/common/mavlink_msg_position_controller_output.h
deleted
100644 → 0
View file @
d4f8f5b3
// MESSAGE POSITION_CONTROLLER_OUTPUT PACKING
#define MAVLINK_MSG_ID_POSITION_CONTROLLER_OUTPUT 61
typedef
struct
__mavlink_position_controller_output_t
{
uint8_t
enabled
;
///< 1: enabled, 0: disabled
int8_t
x
;
///< Position x: -128: -100%, 127: +100%
int8_t
y
;
///< Position y: -128: -100%, 127: +100%
int8_t
z
;
///< Position z: -128: -100%, 127: +100%
int8_t
yaw
;
///< Position yaw: -128: -100%, 127: +100%
}
mavlink_position_controller_output_t
;
/**
* @brief Pack a position_controller_output message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param enabled 1: enabled, 0: disabled
* @param x Position x: -128: -100%, 127: +100%
* @param y Position y: -128: -100%, 127: +100%
* @param z Position z: -128: -100%, 127: +100%
* @param yaw Position yaw: -128: -100%, 127: +100%
* @return length of the message in bytes (excluding serial stream start sign)
*/
static
inline
uint16_t
mavlink_msg_position_controller_output_pack
(
uint8_t
system_id
,
uint8_t
component_id
,
mavlink_message_t
*
msg
,
uint8_t
enabled
,
int8_t
x
,
int8_t
y
,
int8_t
z
,
int8_t
yaw
)
{
uint16_t
i
=
0
;
msg
->
msgid
=
MAVLINK_MSG_ID_POSITION_CONTROLLER_OUTPUT
;
i
+=
put_uint8_t_by_index
(
enabled
,
i
,
msg
->
payload
);
// 1: enabled, 0: disabled
i
+=
put_int8_t_by_index
(
x
,
i
,
msg
->
payload
);
// Position x: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
y
,
i
,
msg
->
payload
);
// Position y: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
z
,
i
,
msg
->
payload
);
// Position z: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
yaw
,
i
,
msg
->
payload
);
// Position yaw: -128: -100%, 127: +100%
return
mavlink_finalize_message
(
msg
,
system_id
,
component_id
,
i
);
}
/**
* @brief Pack a position_controller_output message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param enabled 1: enabled, 0: disabled
* @param x Position x: -128: -100%, 127: +100%
* @param y Position y: -128: -100%, 127: +100%
* @param z Position z: -128: -100%, 127: +100%
* @param yaw Position yaw: -128: -100%, 127: +100%
* @return length of the message in bytes (excluding serial stream start sign)
*/
static
inline
uint16_t
mavlink_msg_position_controller_output_pack_chan
(
uint8_t
system_id
,
uint8_t
component_id
,
uint8_t
chan
,
mavlink_message_t
*
msg
,
uint8_t
enabled
,
int8_t
x
,
int8_t
y
,
int8_t
z
,
int8_t
yaw
)
{
uint16_t
i
=
0
;
msg
->
msgid
=
MAVLINK_MSG_ID_POSITION_CONTROLLER_OUTPUT
;
i
+=
put_uint8_t_by_index
(
enabled
,
i
,
msg
->
payload
);
// 1: enabled, 0: disabled
i
+=
put_int8_t_by_index
(
x
,
i
,
msg
->
payload
);
// Position x: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
y
,
i
,
msg
->
payload
);
// Position y: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
z
,
i
,
msg
->
payload
);
// Position z: -128: -100%, 127: +100%
i
+=
put_int8_t_by_index
(
yaw
,
i
,
msg
->
payload
);
// Position yaw: -128: -100%, 127: +100%
return
mavlink_finalize_message_chan
(
msg
,
system_id
,
component_id
,
chan
,
i
);
}
/**
* @brief Encode a position_controller_output struct into a message
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param position_controller_output C-struct to read the message contents from
*/
static
inline
uint16_t
mavlink_msg_position_controller_output_encode
(
uint8_t
system_id
,
uint8_t
component_id
,
mavlink_message_t
*
msg
,
const
mavlink_position_controller_output_t
*
position_controller_output
)
{
return
mavlink_msg_position_controller_output_pack
(
system_id
,
component_id
,
msg
,
position_controller_output
->
enabled
,
position_controller_output
->
x
,
position_controller_output
->
y
,
position_controller_output
->
z
,
position_controller_output
->
yaw
);
}
/**
* @brief Send a position_controller_output message
* @param chan MAVLink channel to send the message
*
* @param enabled 1: enabled, 0: disabled
* @param x Position x: -128: -100%, 127: +100%
* @param y Position y: -128: -100%, 127: +100%
* @param z Position z: -128: -100%, 127: +100%
* @param yaw Position yaw: -128: -100%, 127: +100%
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static
inline
void
mavlink_msg_position_controller_output_send
(
mavlink_channel_t
chan
,
uint8_t
enabled
,
int8_t
x
,
int8_t
y
,
int8_t
z
,
int8_t
yaw
)
{
mavlink_message_t
msg
;
mavlink_msg_position_controller_output_pack_chan
(
mavlink_system
.
sysid
,
mavlink_system
.
compid
,
chan
,
&
msg
,
enabled
,
x
,
y
,
z
,
yaw
);
mavlink_send_uart
(
chan
,
&
msg
);
}
#endif
// MESSAGE POSITION_CONTROLLER_OUTPUT UNPACKING
/**
* @brief Get field enabled from position_controller_output message
*
* @return 1: enabled, 0: disabled
*/
static
inline
uint8_t
mavlink_msg_position_controller_output_get_enabled
(
const
mavlink_message_t
*
msg
)
{
return
(
uint8_t
)(
msg
->
payload
)[
0
];
}
/**
* @brief Get field x from position_controller_output message
*
* @return Position x: -128: -100%, 127: +100%
*/
static
inline
int8_t
mavlink_msg_position_controller_output_get_x
(
const
mavlink_message_t
*
msg
)
{
return
(
int8_t
)(
msg
->
payload
+
sizeof
(
uint8_t
))[
0
];
}
/**
* @brief Get field y from position_controller_output message
*
* @return Position y: -128: -100%, 127: +100%
*/
static
inline
int8_t
mavlink_msg_position_controller_output_get_y
(
const
mavlink_message_t
*
msg
)
{
return
(
int8_t
)(
msg
->
payload
+
sizeof
(
uint8_t
)
+
sizeof
(
int8_t
))[
0
];
}
/**
* @brief Get field z from position_controller_output message
*
* @return Position z: -128: -100%, 127: +100%
*/
static
inline
int8_t
mavlink_msg_position_controller_output_get_z
(
const
mavlink_message_t
*
msg
)
{
return
(
int8_t
)(
msg
->
payload
+
sizeof
(
uint8_t
)
+
sizeof
(
int8_t
)
+
sizeof
(
int8_t
))[
0
];
}
/**
* @brief Get field yaw from position_controller_output message
*
* @return Position yaw: -128: -100%, 127: +100%
*/
static
inline
int8_t
mavlink_msg_position_controller_output_get_yaw
(
const
mavlink_message_t
*
msg
)
{
return
(
int8_t
)(
msg
->
payload
+
sizeof
(
uint8_t
)
+
sizeof
(
int8_t
)
+
sizeof
(
int8_t
)
+
sizeof
(
int8_t
))[
0
];
}
/**
* @brief Decode a position_controller_output message into a struct
*
* @param msg The message to decode
* @param position_controller_output C-struct to decode the message contents into
*/
static
inline
void
mavlink_msg_position_controller_output_decode
(
const
mavlink_message_t
*
msg
,
mavlink_position_controller_output_t
*
position_controller_output
)
{
position_controller_output
->
enabled
=
mavlink_msg_position_controller_output_get_enabled
(
msg
);
position_controller_output
->
x
=
mavlink_msg_position_controller_output_get_x
(
msg
);
position_controller_output
->
y
=
mavlink_msg_position_controller_output_get_y
(
msg
);
position_controller_output
->
z
=
mavlink_msg_position_controller_output_get_z
(
msg
);
position_controller_output
->
yaw
=
mavlink_msg_position_controller_output_get_yaw
(
msg
);
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment