22#ifndef ISOBUS_GUIDANCE_INTERFACE_HPP
23#define ISOBUS_GUIDANCE_INTERFACE_HPP
26#include "isobus/utility/event_dispatcher.hpp"
27#include "isobus/utility/processing_flags.hpp"
44 std::shared_ptr<ControlFunction> destination,
45 bool enableSendingSystemCommandPeriodically =
false,
46 bool enableSendingMachineInfoPeriodically =
false);
140 ResetNotRequired = 0,
149 DisabledOffPassive = 0,
152 NotAvailableTakeNoAction = 3
173 NoReasonAllClear = 0,
174 RequiredLevelOfOperatorPresenceAwarenessNotDetected = 1,
175 ImplementReleasedControlOfFunction = 2,
176 OperatorOverrideOfFunction = 3,
177 OperatorControlNotInValidPosition = 4,
178 RemoteCommandTimeout = 5,
179 RemoteCommandOutOfRangeInvalid = 6,
180 FunctionNotCalibrated = 7,
181 OperatorControlFault = 8,
183 HydraulicOilLevelTooLow = 20,
184 HydraulicOilTemperatureTooLow = 21,
186 VehicleSpeedTooLow = 23,
187 VehicleSpeedTooHigh = 24,
188 AlternateGuidanceSystemActive = 25,
189 ControlUnitInDiagnosticMode = 26,
374 static void process_flags(std::uint32_t flag,
void *parentPointer);
A representation of an ISOBUS ECU that we can send from. Use this class when defining your own contro...
An interface for sending and receiving the ISOBUS agricultural guidance machine message.
bool set_guidance_steering_system_readiness_state(GenericSAEbs02SlotValue state)
Sets the guidance system's readiness state to report.
bool set_guidance_system_command_exit_reason_code(std::uint8_t exitCode)
Sets the exit code for the guidance system.
std::shared_ptr< ControlFunction > get_sender_control_function() const
Returns a pointer to the sender of the message. If an ICF is the sender, returns the ICF being used t...
RequestResetCommandStatus get_request_reset_command_status() const
Returns the reported request reset command.
GenericSAEbs02SlotValue get_guidance_steering_system_readiness_state() const
Returns the guidance system's readiness state for steering.
GenericSAEbs02SlotValue get_guidance_system_remote_engage_switch_status() const
Returns the state for the steering engage switch.
GuidanceLimitStatus
This parameter is used to report the steering system's present limit status associated with guidance ...
@ NonRecoverableFault
Non-recoverable fault.
@ LimitedLow
Only higher command values result in a change.
@ NotAvailable
Parameter not supported.
@ OperatorLimitedControlled
Request cannot be implemented.
@ LimitedHigh
Only lower command values result in a change.
MechanicalSystemLockout mechanicalSystemLockoutState
The reported state of the mechanical system lockout switch (SPN 5243)
GenericSAEbs02SlotValue
A typical, generic 2 bit value in J1939 with no superseding definition in ISO 11783.
float estimatedCurvature
Curvature in km^-1 (inverse kilometers). Range is -8032 to 8031.75 km-1 (SPN 5238)
bool set_mechanical_system_lockout_state(MechanicalSystemLockout state)
Sets the mechanical system lockout state.
std::shared_ptr< ControlFunction > const controlFunction
The CF that is sending the message.
std::uint32_t get_timestamp_ms() const
Returns the timestamp for when the message was received, in milliseconds.
float get_estimated_curvature() const
Returns the estimated curvature that was previously set with set_estimated_curvature.
std::uint8_t guidanceSystemCommandExitReasonCode
The exit code for guidance, stored as a u8 to preserve manufacturer specific values (SPN 5725)
bool set_guidance_system_remote_engage_switch_status(GenericSAEbs02SlotValue switchStatus)
Sets the state for the steering engage switch.
bool set_request_reset_command_status(RequestResetCommandStatus state)
Sets the request reset command to report.
bool set_guidance_limit_status(GuidanceLimitStatus status)
Sets the reported guidance limit status.
GenericSAEbs02SlotValue guidanceSystemRemoteEngageSwitchStatus
The reported state of the remote engage switch (SPN 9726)
RequestResetCommandStatus requestResetCommandStatus
The reported state of the request reset command (SPN 5240)
GenericSAEbs02SlotValue get_guidance_steering_input_position_status() const
Returns the guidance steering input position state.
bool set_estimated_curvature(float curvature)
Sets the estimated course curvature over ground for the machine.
MechanicalSystemLockout get_mechanical_system_lockout() const
Returns the mechanical system lockout state.
GenericSAEbs02SlotValue guidanceSteeringSystemReadinessState
The reported state of the steering system's readiness to steer (SPN 5242)
MechanicalSystemLockout
State of a lockout switch that allows operators to disable automatic steering system functions.
void set_timestamp_ms(std::uint32_t timestamp)
Sets the timestamp for when the message was received or sent.
RequestResetCommandStatus
Machine steering system request to the automatic guidance system to change Curvature Command Status s...
GuidanceSystemCommandExitReasonCode
This parameter is used to indicate why the guidance system cannot currently accept remote commands or...
@ NotAvailable
Parameter not supported.
@ VehicleTransmissionGearDoesNotAllowRemoteCommands
park, etc.
GuidanceLimitStatus get_guidance_limit_status() const
Returns the reported guidance limit status.
std::uint8_t get_guidance_system_command_exit_reason_code() const
Returns the exit code for the guidance system.
GenericSAEbs02SlotValue guidanceSteeringInputPositionStatus
The reported state of the steering input position. (SPN 5241)
GuidanceMachineInfo(std::shared_ptr< ControlFunction > sender)
Constructor for a GuidanceMachineInfo.
GuidanceLimitStatus guidanceLimitStatus
The steering system's present limit status associated with guidance commands that are persistent (SPN...
bool set_guidance_steering_input_position_status(GenericSAEbs02SlotValue state)
Sets the guidance steering input position state.
std::uint32_t timestamp_ms
A timestamp for when the message was released in milliseconds.
An interface for sending the agricultural guidance system command message.
bool set_curvature(float curvature)
Desired course curvature over ground that a machine's steering system is required to achieve.
CurvatureCommandStatus get_status() const
Returns the curvature command status that is active in the guidance system.
std::uint32_t get_timestamp_ms() const
Returns the timestamp for when the message was received, in milliseconds.
float commandedCurvature
The commanded curvature in km^-1 (inverse kilometers)
bool set_status(CurvatureCommandStatus newStatus)
Sets the curvature command status that will be encoded into the CAN message. This parameter indicates...
std::shared_ptr< ControlFunction > const controlFunction
The CF that is sending the message.
float get_curvature() const
Returns the curvature value that is currently be trying to be achieved by the guidance system.
GuidanceSystemCommand(std::shared_ptr< ControlFunction > sender)
Constructor for a GuidanceSystemCommand.
CurvatureCommandStatus commandedStatus
The current status for the command.
void set_timestamp_ms(std::uint32_t timestamp)
Sets the timestamp for when the message was received or sent.
std::uint32_t timestamp_ms
A timestamp for when the message was released in milliseconds.
std::shared_ptr< ControlFunction > get_sender_control_function() const
Returns a pointer to the sender of the message. If an ICF is the sender, returns the ICF being used t...
CurvatureCommandStatus
This parameter indicates whether the guidance system is attempting to control steering with this comm...
@ IntendedToSteer
Steering Engaged.
@ NotIntendedToSteer
Steering Disengaged.
An interface for sending and receiving ISOBUS guidance messages.
GuidanceSystemCommand guidanceSystemCommandTransmitData
Use this to configure transmission the guidance system command message from your application....
EventDispatcher< const std::shared_ptr< GuidanceMachineInfo >, bool > & get_guidance_machine_info_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated guidance machine info...
void update()
Call this cyclically to update the interface. Transmits messages if needed and processes timeouts for...
ProcessingFlags txFlags
Tx flag for sending messages periodically.
void initialize()
Sets up the class and registers it to receive callbacks from the network manager for processing guida...
AgriculturalGuidanceInterface(std::shared_ptr< InternalControlFunction > source, std::shared_ptr< ControlFunction > destination, bool enableSendingSystemCommandPeriodically=false, bool enableSendingMachineInfoPeriodically=false)
Constructor for a AgriculturalGuidanceInterface.
EventDispatcher< const std::shared_ptr< GuidanceSystemCommand >, bool > & get_guidance_system_command_event_publisher()
Returns an event dispatcher which you can use to get callbacks when new/updated guidance system comma...
std::uint32_t guidanceSystemCommandTransmitTimestamp_ms
Timestamp used to know when to transmit the guidance system command message.
static constexpr float CURVATURE_COMMAND_MAX_INVERSE_KM
The maximum curvature that can be encoded once scaling is applied.
bool get_initialized() const
Returns if the interface has been initialized.
EventDispatcher< const std::shared_ptr< GuidanceSystemCommand >, bool > guidanceSystemCommandEventPublisher
An event publisher for notifying when new guidance system commands are received.
EventDispatcher< const std::shared_ptr< GuidanceMachineInfo >, bool > guidanceMachineInfoEventPublisher
An event publisher for notifying when new guidance machine info messages are received.
static constexpr float CURVATURE_COMMAND_OFFSET_INVERSE_KM
Constant offset for curvature being sent on the bus in km-1.
static void process_flags(std::uint32_t flag, void *parentPointer)
Processes one flag (which sends the associated message)
std::shared_ptr< GuidanceSystemCommand > get_received_guidance_system_command(std::size_t index)
Returns the content of the agricultural guidance curvature command message based on the index of the ...
static constexpr float CURVATURE_COMMAND_RESOLUTION_PER_BIT
The resolution of the message in km-1 per bit.
bool send_guidance_system_command() const
Sends the agricultural guidance system command message based on the configured content of guidanceSys...
std::vector< std::shared_ptr< GuidanceSystemCommand > > receivedGuidanceSystemCommandMessages
A list of all received curvature commands and statuses.
bool send_guidance_machine_info() const
Sends the agricultural guidance machine info message based on the configured content of guidanceMachi...
static void process_rx_message(const CANMessage &message, void *parentPointer)
Processes a CAN message.
std::uint32_t guidanceMachineInfoTransmitTimestamp_ms
Timestamp used to know when to transmit the guidance machine info message.
std::vector< std::shared_ptr< GuidanceMachineInfo > > receivedGuidanceMachineInfoMessages
A list of all received estimated curvatures.
TransmitFlags
Enumerates a set of flags to manage transmitting messages owned by this interface.
@ SendGuidanceSystemCommand
A flag to manage sending the guidance system command message.
@ SendGuidanceMachineInfo
A flag to manage sending the guidance machine info message.
@ NumberOfFlags
The number of flags in this enumeration.
std::size_t get_number_received_guidance_system_command_sources() const
Returns the number of received, unique guidance system command sources.
std::shared_ptr< ControlFunction > destinationControlFunction
The optional destination to which messages will be sent. If nullptr it will be broadcast instead.
bool initialized
Stores if the interface has been initialized.
std::size_t get_number_received_guidance_machine_info_message_sources() const
Returns the number of received, unique guidance machine info message sources.
static constexpr std::uint16_t ZERO_CURVATURE_INVERSE_KM
This is the value for zero km-1 for 0.25 km-1 per bit.
~AgriculturalGuidanceInterface()
Destructor for the AgriculturalGuidanceInterface.
static constexpr std::uint32_t GUIDANCE_MESSAGE_TIMEOUT_MS
Amount of time before a guidance message is stale. We currently tolerate 50ms of delay.
std::shared_ptr< GuidanceMachineInfo > get_received_guidance_machine_info(std::size_t index)
Returns the content of the agricultural guidance machine info message based on the index of the sende...
GuidanceMachineInfo guidanceMachineInfoTransmitData
Use this to configure the transmission of the guidance machine info message from your application....
static constexpr std::uint32_t GUIDANCE_MESSAGE_TX_INTERVAL_MS
How often guidance messages are sent, defined in ISO 11783-7.
A class that represents a generic CAN message of arbitrary length.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...