Skip to content

Commit

Permalink
Added Python descriptions for using set/get config messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamshapiro0 committed Jul 3, 2024
1 parent a48c2d5 commit a475b05
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 9 deletions.
4 changes: 3 additions & 1 deletion python/examples/send_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
# protocol=ProtocolType.FUSION_ENGINE,
# message_id=MessageType.POSE,
# rate=MessageRate.ON_CHANGE)
# message = SetConfigMessage(InterfaceDirectionConfig(TransportDirection.SERVER),
# message = SetConfigMessage(InterfaceDiagnosticMessagesEnabled(True),
# interface=InterfaceID(TransportType.TCP, 0))
# message = GetConfigMessage(InterfaceDiagnosticMessagesEnabled,
# interface=InterfaceID(TransportType.TCP, 0))
# message = FaultControlMessage(payload=FaultControlMessage.EnableGNSS(False))

Expand Down
64 changes: 56 additions & 8 deletions python/fusion_engine_client/messages/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,35 @@ class Empty(NamedTuple):
_conf_gen = _ConfigClassGenerator()


########################################################################################################################
# Device configuration settings (lever arms, orientation, wheel speed settings, etc.).
#
# The classes below may be passed to a SetConfigMessage or returned by a ConfigResponseMessage using the `config_object`
# field. For example:
# ```
# SetConfigMessage(GNSSLeverArmConfig(0.4, 0.0, 1.2))
# SetConfigMessage(EnabledGNSSSystemsConfig(SatelliteType.GPS, SatelliteType.GALILEO))
#
# GetConfigMessage(GNSSLeverArmConfig)
# config_response.config_object.x == 0.4
# ```
#
# Note that many of these configuration classes share common parameters, and their fields are defined by their specified
# base classes. For example, `GNSSLeverArmConfig` inherits from `Point3F` and contains `x`, `y`, and `z` fields as
# follows:
# ```
# class Point3F(NamedTuple):
# """!
# @brief 3D coordinate specifier, stored as 32-bit float values.
# """
# x: float = math.nan
# y: float = math.nan
# z: float = math.nan
# class GNSSLeverArmConfig(_conf_gen.Point3F): ...
# ```
########################################################################################################################


@_conf_gen.create_config_class(ConfigType.DEVICE_LEVER_ARM, _conf_gen.Point3FConstruct)
class DeviceLeverArmConfig(_conf_gen.Point3F):
"""!
Expand Down Expand Up @@ -957,6 +986,33 @@ class HeadingBias(_conf_gen.HeadingBias):
pass


@_conf_gen.create_config_class(ConfigType.INVALID, _conf_gen.EmptyConstruct)
class InvalidConfig(_conf_gen.Empty):
"""!
@brief Placeholder for empty invalid configuration messages.
"""
pass


########################################################################################################################
# Input/output interface controls.
#
# When configuring I/O interfaces, you must specify the desired interface:
#
# Examples:
# ```
# SetConfigMessage(
# InterfaceDiagnosticMessagesEnabled(True),
# interface=InterfaceID(TransportType.TCP, 0))
#
# GetConfigMessage(
# InterfaceDiagnosticMessagesEnabled,
# interface=InterfaceID(TransportType.TCP, 0))
# config_response.config_object.value == True
# ```
########################################################################################################################


@_conf_gen.create_interface_config_class(InterfaceConfigType.BAUD_RATE, _conf_gen.UInt32Construct)
class InterfaceBaudRateConfig(_conf_gen.IntegerVal):
"""!
Expand Down Expand Up @@ -1013,14 +1069,6 @@ class InterfaceDiagnosticMessagesEnabled(_conf_gen.BoolVal):
pass


@_conf_gen.create_config_class(ConfigType.INVALID, _conf_gen.EmptyConstruct)
class InvalidConfig(_conf_gen.Empty):
"""!
@brief Placeholder for empty invalid configuration messages.
"""
pass


class InterfaceConfigSubmessage(NamedTuple):
interface: InterfaceID = InterfaceID()
subtype: InterfaceConfigType = InterfaceConfigType.INVALID
Expand Down

0 comments on commit a475b05

Please sign in to comment.