PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <mavlink_stream.h>
Inherits ListNode< MavlinkStream *>.
Inherited by MavlinkStreamActuatorControlTarget< N >, MavlinkStreamADSBVehicle, MavlinkStreamAltitude, MavlinkStreamAttitude, MavlinkStreamAttitudeQuaternion, MavlinkStreamAttitudeTarget, MavlinkStreamAttPosMocap, MavlinkStreamBatteryStatus, MavlinkStreamCameraCapture, MavlinkStreamCameraImageCaptured, MavlinkStreamCameraTrigger, MavlinkStreamCollision, MavlinkStreamCommandLong, MavlinkStreamDebug, MavlinkStreamDebugFloatArray, MavlinkStreamDebugVect, MavlinkStreamDistanceSensor, MavlinkStreamEstimatorStatus, MavlinkStreamExtendedSysState, MavlinkStreamGlobalPositionInt, MavlinkStreamGPS2Raw, MavlinkStreamGPSRawInt, MavlinkStreamGroundTruth, MavlinkStreamHeartbeat, MavlinkStreamHighLatency2, MavlinkStreamHighresIMU, MavlinkStreamHILActuatorControls, MavlinkStreamHomePosition, MavlinkStreamLocalPositionNED, MavlinkStreamLocalPositionSetpoint, MavlinkStreamManualControl, MavlinkStreamMountOrientation, MavlinkStreamNamedValueFloat, MavlinkStreamNavControllerOutput, MavlinkStreamObstacleDistance, MavlinkStreamOdometry, MavlinkStreamOpticalFlowRad, MavlinkStreamOrbitStatus, MavlinkStreamPing, MavlinkStreamPositionTargetGlobalInt, MavlinkStreamRCChannels, MavlinkStreamScaledIMU, MavlinkStreamScaledIMU2, MavlinkStreamScaledIMU3, MavlinkStreamServoOutputRaw< N >, MavlinkStreamStatustext, MavlinkStreamSysStatus, MavlinkStreamSystemTime, MavlinkStreamTimesync, MavlinkStreamTrajectoryRepresentationWaypoints, MavlinkStreamUTMGlobalPosition, MavlinkStreamVFRHUD, and MavlinkStreamWind.
Public Member Functions | |
MavlinkStream (Mavlink *mavlink) | |
virtual | ~MavlinkStream ()=default |
MavlinkStream (const MavlinkStream &)=delete | |
MavlinkStream & | operator= (const MavlinkStream &)=delete |
MavlinkStream (MavlinkStream &&)=delete | |
MavlinkStream & | operator= (MavlinkStream &&)=delete |
void | set_interval (const int interval) |
Get the interval. More... | |
int | get_interval () |
Get the interval. More... | |
int | update (const hrt_abstime &t) |
Update subscriptions and send message if necessary. More... | |
virtual const char * | get_name () const =0 |
virtual uint16_t | get_id ()=0 |
virtual bool | const_rate () |
virtual unsigned | get_size ()=0 |
Get maximal total messages size on update. More... | |
virtual unsigned | get_size_avg () |
Get the average message size. More... | |
bool | first_message_sent () const |
void | reset_last_sent () |
Reset the time of last sent to 0. More... | |
Public Member Functions inherited from ListNode< MavlinkStream *> | |
void | setSibling (MavlinkStream * sibling) |
const MavlinkStream * | getSibling () const |
Protected Member Functions | |
virtual bool | send (const hrt_abstime t)=0 |
virtual void | update_data () |
Function to collect/update data for the streams at a high rate independant of actual stream rate. More... | |
Protected Attributes | |
Mavlink *const | _mavlink |
int | _interval {1000000} |
if set to negative value = unlimited rate More... | |
Protected Attributes inherited from ListNode< MavlinkStream *> | |
MavlinkStream * | _list_node_sibling |
Private Attributes | |
hrt_abstime | _last_sent {0} |
bool | _first_message_sent {false} |
Definition at line 50 of file mavlink_stream.h.
MavlinkStream::MavlinkStream | ( | Mavlink * | mavlink | ) |
Definition at line 47 of file mavlink_stream.cpp.
References _last_sent, and hrt_absolute_time().
|
virtualdefault |
|
delete |
|
delete |
|
inlinevirtual |
Reimplemented in MavlinkStreamPing, MavlinkStreamCameraImageCaptured, MavlinkStreamCameraTrigger, MavlinkStreamUTMGlobalPosition, MavlinkStreamADSBVehicle, MavlinkStreamHeartbeat, and MavlinkStreamHighLatency2.
Definition at line 88 of file mavlink_stream.h.
References get_size().
Referenced by update().
|
inline |
Definition at line 108 of file mavlink_stream.h.
References _first_message_sent.
|
pure virtual |
Implemented in MavlinkStreamObstacleDistance, MavlinkStreamOrbitStatus, MavlinkStreamPing, MavlinkStreamGroundTruth, MavlinkStreamMountOrientation, MavlinkStreamWind, MavlinkStreamAltitude, MavlinkStreamExtendedSysState, MavlinkStreamDistanceSensor, MavlinkStreamCameraCapture, MavlinkStreamNavControllerOutput, MavlinkStreamDebugFloatArray, MavlinkStreamDebugVect, MavlinkStreamDebug, MavlinkStreamNamedValueFloat, MavlinkStreamOpticalFlowRad, MavlinkStreamTrajectoryRepresentationWaypoints, MavlinkStreamManualControl, MavlinkStreamRCChannels, MavlinkStreamAttitudeTarget, MavlinkStreamLocalPositionSetpoint, MavlinkStreamPositionTargetGlobalInt, MavlinkStreamHILActuatorControls, MavlinkStreamActuatorControlTarget< N >, MavlinkStreamServoOutputRaw< N >, MavlinkStreamHomePosition, MavlinkStreamAttPosMocap, MavlinkStreamEstimatorStatus, MavlinkStreamLocalPositionNED, MavlinkStreamOdometry, MavlinkStreamGlobalPositionInt, MavlinkStreamCameraImageCaptured, MavlinkStreamCameraTrigger, MavlinkStreamCollision, MavlinkStreamUTMGlobalPosition, MavlinkStreamADSBVehicle, MavlinkStreamTimesync, MavlinkStreamSystemTime, MavlinkStreamGPS2Raw, MavlinkStreamGPSRawInt, MavlinkStreamVFRHUD, MavlinkStreamAttitudeQuaternion, MavlinkStreamAttitude, MavlinkStreamScaledIMU3, MavlinkStreamScaledIMU2, MavlinkStreamScaledIMU, MavlinkStreamHighresIMU, MavlinkStreamBatteryStatus, MavlinkStreamSysStatus, MavlinkStreamCommandLong, MavlinkStreamStatustext, MavlinkStreamHeartbeat, and MavlinkStreamHighLatency2.
Referenced by get_interval().
|
inline |
Get the interval.
Definition at line 76 of file mavlink_stream.h.
References _interval, get_id(), get_name(), hrt_abstime, and update().
|
pure virtual |
Implemented in MavlinkStreamObstacleDistance, MavlinkStreamOrbitStatus, MavlinkStreamPing, MavlinkStreamGroundTruth, MavlinkStreamMountOrientation, MavlinkStreamWind, MavlinkStreamAltitude, MavlinkStreamExtendedSysState, MavlinkStreamDistanceSensor, MavlinkStreamCameraCapture, MavlinkStreamNavControllerOutput, MavlinkStreamDebugFloatArray, MavlinkStreamDebugVect, MavlinkStreamDebug, MavlinkStreamNamedValueFloat, MavlinkStreamOpticalFlowRad, MavlinkStreamTrajectoryRepresentationWaypoints, MavlinkStreamManualControl, MavlinkStreamRCChannels, MavlinkStreamAttitudeTarget, MavlinkStreamLocalPositionSetpoint, MavlinkStreamPositionTargetGlobalInt, MavlinkStreamHILActuatorControls, MavlinkStreamActuatorControlTarget< N >, MavlinkStreamServoOutputRaw< N >, MavlinkStreamHomePosition, MavlinkStreamAttPosMocap, MavlinkStreamEstimatorStatus, MavlinkStreamLocalPositionNED, MavlinkStreamOdometry, MavlinkStreamGlobalPositionInt, MavlinkStreamCameraImageCaptured, MavlinkStreamCameraTrigger, MavlinkStreamCollision, MavlinkStreamUTMGlobalPosition, MavlinkStreamADSBVehicle, MavlinkStreamTimesync, MavlinkStreamSystemTime, MavlinkStreamGPS2Raw, MavlinkStreamGPSRawInt, MavlinkStreamVFRHUD, MavlinkStreamAttitudeQuaternion, MavlinkStreamAttitude, MavlinkStreamScaledIMU3, MavlinkStreamScaledIMU2, MavlinkStreamScaledIMU, MavlinkStreamHighresIMU, MavlinkStreamBatteryStatus, MavlinkStreamSysStatus, MavlinkStreamCommandLong, MavlinkStreamStatustext, MavlinkStreamHeartbeat, and MavlinkStreamHighLatency2.
Referenced by get_interval().
|
pure virtual |
Get maximal total messages size on update.
Implemented in MavlinkStreamObstacleDistance, MavlinkStreamOrbitStatus, MavlinkStreamPing, MavlinkStreamGroundTruth, MavlinkStreamMountOrientation, MavlinkStreamWind, MavlinkStreamAltitude, MavlinkStreamExtendedSysState, MavlinkStreamDistanceSensor, MavlinkStreamCameraCapture, MavlinkStreamNavControllerOutput, MavlinkStreamDebugFloatArray, MavlinkStreamDebugVect, MavlinkStreamDebug, MavlinkStreamNamedValueFloat, MavlinkStreamOpticalFlowRad, MavlinkStreamTrajectoryRepresentationWaypoints, MavlinkStreamManualControl, MavlinkStreamRCChannels, MavlinkStreamAttitudeTarget, MavlinkStreamLocalPositionSetpoint, MavlinkStreamPositionTargetGlobalInt, MavlinkStreamHILActuatorControls, MavlinkStreamActuatorControlTarget< N >, MavlinkStreamServoOutputRaw< N >, MavlinkStreamHomePosition, MavlinkStreamAttPosMocap, MavlinkStreamEstimatorStatus, MavlinkStreamLocalPositionNED, MavlinkStreamOdometry, MavlinkStreamGlobalPositionInt, MavlinkStreamCameraImageCaptured, MavlinkStreamCameraTrigger, MavlinkStreamCollision, MavlinkStreamUTMGlobalPosition, MavlinkStreamADSBVehicle, MavlinkStreamTimesync, MavlinkStreamSystemTime, MavlinkStreamGPS2Raw, MavlinkStreamGPSRawInt, MavlinkStreamVFRHUD, MavlinkStreamAttitudeQuaternion, MavlinkStreamAttitude, MavlinkStreamScaledIMU3, MavlinkStreamScaledIMU2, MavlinkStreamScaledIMU, MavlinkStreamHighresIMU, MavlinkStreamBatteryStatus, MavlinkStreamSysStatus, MavlinkStreamCommandLong, MavlinkStreamStatustext, MavlinkStreamHeartbeat, and MavlinkStreamHighLatency2.
Referenced by const_rate(), and get_size_avg().
|
inlinevirtual |
Get the average message size.
For a normal stream this equals the message size, for something like a parameter or mission message this equals usually zero, as no bandwidth needs to be reserved
Definition at line 103 of file mavlink_stream.h.
References get_size().
|
delete |
|
delete |
|
inline |
Reset the time of last sent to 0.
Can be used if a message over this stream needs to be sent immediately.
Definition at line 114 of file mavlink_stream.h.
References _last_sent.
Referenced by MavlinkStreamHighLatency2::MavlinkStreamHighLatency2().
|
protectedpure virtual |
Implemented in MavlinkStreamObstacleDistance, MavlinkStreamOrbitStatus, MavlinkStreamPing, MavlinkStreamGroundTruth, MavlinkStreamMountOrientation, MavlinkStreamWind, MavlinkStreamAltitude, MavlinkStreamExtendedSysState, MavlinkStreamDistanceSensor, MavlinkStreamCameraCapture, MavlinkStreamNavControllerOutput, MavlinkStreamDebugFloatArray, MavlinkStreamDebugVect, MavlinkStreamDebug, MavlinkStreamNamedValueFloat, MavlinkStreamOpticalFlowRad, MavlinkStreamTrajectoryRepresentationWaypoints, MavlinkStreamManualControl, MavlinkStreamRCChannels, MavlinkStreamAttitudeTarget, MavlinkStreamLocalPositionSetpoint, MavlinkStreamPositionTargetGlobalInt, MavlinkStreamHILActuatorControls, MavlinkStreamActuatorControlTarget< N >, MavlinkStreamServoOutputRaw< N >, MavlinkStreamHomePosition, MavlinkStreamAttPosMocap, MavlinkStreamEstimatorStatus, MavlinkStreamLocalPositionNED, MavlinkStreamOdometry, MavlinkStreamGlobalPositionInt, MavlinkStreamCameraImageCaptured, MavlinkStreamCameraTrigger, MavlinkStreamCollision, MavlinkStreamUTMGlobalPosition, MavlinkStreamADSBVehicle, MavlinkStreamTimesync, MavlinkStreamSystemTime, MavlinkStreamGPS2Raw, MavlinkStreamGPSRawInt, MavlinkStreamVFRHUD, MavlinkStreamAttitudeQuaternion, MavlinkStreamAttitude, MavlinkStreamScaledIMU3, MavlinkStreamScaledIMU2, MavlinkStreamScaledIMU, MavlinkStreamHighresIMU, MavlinkStreamBatteryStatus, MavlinkStreamSysStatus, MavlinkStreamCommandLong, MavlinkStreamStatustext, MavlinkStreamHeartbeat, and MavlinkStreamHighLatency2.
Referenced by update().
|
inline |
Get the interval.
interval | the interval in microseconds (us) between messages |
Definition at line 69 of file mavlink_stream.h.
References _interval.
Referenced by Mavlink::configure_stream().
int MavlinkStream::update | ( | const hrt_abstime & | t | ) |
Update subscriptions and send message if necessary.
Definition at line 57 of file mavlink_stream.cpp.
References _first_message_sent, _interval, _last_sent, _mavlink, const_rate(), dt, Mavlink::get_main_loop_delay(), Mavlink::get_rate_mult(), hrt_absolute_time(), send(), and update_data().
Referenced by get_interval(), MavlinkStreamSysStatus::send(), and MavlinkStreamBatteryStatus::send().
|
inlineprotectedvirtual |
Function to collect/update data for the streams at a high rate independant of actual stream rate.
This function is called at every iteration of the mavlink module.
Reimplemented in MavlinkStreamHighLatency2.
Definition at line 128 of file mavlink_stream.h.
Referenced by update().
|
private |
Definition at line 132 of file mavlink_stream.h.
Referenced by first_message_sent(), and update().
|
protected |
if set to negative value = unlimited rate
Definition at line 118 of file mavlink_stream.h.
Referenced by get_interval(), set_interval(), and update().
|
private |
Definition at line 131 of file mavlink_stream.h.
Referenced by MavlinkStream(), reset_last_sent(), and update().
|
protected |
Definition at line 117 of file mavlink_stream.h.
Referenced by MavlinkStreamStatustext::get_size(), MavlinkStreamActuatorControlTarget< N >::MavlinkStreamActuatorControlTarget(), MavlinkStreamBatteryStatus::MavlinkStreamBatteryStatus(), MavlinkStreamHighLatency2::MavlinkStreamHighLatency2(), MavlinkStreamSysStatus::MavlinkStreamSysStatus(), MavlinkStreamHighLatency2::send(), MavlinkStreamHeartbeat::send(), MavlinkStreamStatustext::send(), MavlinkStreamCommandLong::send(), MavlinkStreamSysStatus::send(), MavlinkStreamBatteryStatus::send(), MavlinkStreamHighresIMU::send(), MavlinkStreamScaledIMU::send(), MavlinkStreamScaledIMU2::send(), MavlinkStreamScaledIMU3::send(), MavlinkStreamAttitude::send(), MavlinkStreamAttitudeQuaternion::send(), MavlinkStreamVFRHUD::send(), MavlinkStreamGPSRawInt::send(), MavlinkStreamGPS2Raw::send(), MavlinkStreamSystemTime::send(), MavlinkStreamTimesync::send(), MavlinkStreamADSBVehicle::send(), MavlinkStreamUTMGlobalPosition::send(), MavlinkStreamCollision::send(), MavlinkStreamCameraTrigger::send(), MavlinkStreamCameraImageCaptured::send(), MavlinkStreamGlobalPositionInt::send(), MavlinkStreamOdometry::send(), MavlinkStreamLocalPositionNED::send(), MavlinkStreamEstimatorStatus::send(), MavlinkStreamAttPosMocap::send(), MavlinkStreamHomePosition::send(), MavlinkStreamServoOutputRaw< N >::send(), MavlinkStreamActuatorControlTarget< N >::send(), MavlinkStreamHILActuatorControls::send(), MavlinkStreamPositionTargetGlobalInt::send(), MavlinkStreamLocalPositionSetpoint::send(), MavlinkStreamAttitudeTarget::send(), MavlinkStreamRCChannels::send(), MavlinkStreamManualControl::send(), MavlinkStreamTrajectoryRepresentationWaypoints::send(), MavlinkStreamOpticalFlowRad::send(), MavlinkStreamNamedValueFloat::send(), MavlinkStreamDebug::send(), MavlinkStreamDebugVect::send(), MavlinkStreamDebugFloatArray::send(), MavlinkStreamNavControllerOutput::send(), MavlinkStreamCameraCapture::send(), MavlinkStreamDistanceSensor::send(), MavlinkStreamExtendedSysState::send(), MavlinkStreamAltitude::send(), MavlinkStreamWind::send(), MavlinkStreamMountOrientation::send(), MavlinkStreamGroundTruth::send(), MavlinkStreamPing::send(), MavlinkStreamOrbitStatus::send(), MavlinkStreamObstacleDistance::send(), and update().