From 598727dfc3c19e7db48e4a78e7a9b574d561de96 Mon Sep 17 00:00:00 2001 From: Adam Shapiro Date: Tue, 25 Jun 2024 15:15:04 -0400 Subject: [PATCH] Added Python descriptions for using set/get config messages. --- python/examples/send_command.py | 4 +- .../messages/configuration.py | 64 ++++++++++++++++--- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/python/examples/send_command.py b/python/examples/send_command.py index e31fff79..37505105 100755 --- a/python/examples/send_command.py +++ b/python/examples/send_command.py @@ -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)) diff --git a/python/fusion_engine_client/messages/configuration.py b/python/fusion_engine_client/messages/configuration.py index a7407b8b..0171a359 100644 --- a/python/fusion_engine_client/messages/configuration.py +++ b/python/fusion_engine_client/messages/configuration.py @@ -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): """! @@ -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): """! @@ -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