MIP_SDK
v3.0.0-736-g212583cf
MicroStrain Communications Library for embedded systems
|
Example setup program for the 3DM-CV7-AR, and 3DM-GV7-AR using C. More...
Functions | |
static void | log_callback (void *_user, const microstrain_log_level _level, const char *_format, va_list _args) |
Custom logging callback for MIP SDK message formatting and output. More... | |
static void | capture_gyro_bias (mip_interface *_device) |
Captures and configures device gyro bias. More... | |
static void | configure_filter_message_format (mip_interface *_device) |
Configures message format for filter data streaming. More... | |
static void | configure_event_triggers (mip_interface *_device) |
Configures threshold event triggers for roll and pitch angles. More... | |
static void | configure_event_actions (mip_interface *_device) |
Configures event actions to occur when triggers are activated. More... | |
static void | enable_events (mip_interface *_device) |
Enables the configured event triggers. More... | |
static void | handle_event_triggers (void *_user, const mip_field_view *_field, mip_timestamp _timestamp) |
Event handler for filter data source triggers. More... | |
static void | initialize_filter (mip_interface *_device) |
Initializes and resets the navigation filter. More... | |
static void | display_filter_state (const mip_filter_mode _filter_state) |
Displays the current filter state when changes occur. More... | |
static mip_timestamp | get_current_timestamp () |
Gets the current system timestamp in milliseconds. More... | |
static bool | mip_interface_user_send_to_device (mip_interface *_device, const uint8_t *_data, size_t _length) |
Handles sending packets to the device. More... | |
static bool | mip_interface_user_recv_from_device (mip_interface *_device, uint8_t *_buffer, size_t _max_length, mip_timeout _wait_time, bool _from_cmd, size_t *_length_out, mip_timestamp *_timestamp_out) |
Handles receiving packets from the device. More... | |
static void | initialize_device (mip_interface *_device, serial_port *_device_port, const uint32_t _baudrate) |
Initializes and configures a MIP device interface. More... | |
static void | terminate (serial_port *_device_port, const char *_message, const bool _successful) |
Handles graceful program termination and cleanup. More... | |
static void | exit_from_command (const mip_interface *_device, const mip_cmd_result _cmd_result, const char *_format,...) |
Handles graceful program termination and command failure cleanup. More... | |
Variables | |
static const char * | PORT_NAME = "/dev/ttyACM0" |
Set the port name for the connection (Serial/USB) More... | |
static const uint32_t | BAUDRATE = 115200 |
Set the baudrate for the connection (Serial/USB) More... | |
static const uint16_t | SAMPLE_RATE_HZ = 1 |
Streaming rate in Hz. More... | |
static const uint32_t | RUN_TIME_SECONDS = 30 |
Example run time. More... | |
This example shows a basic setup to configure the attitude filter to stream filter data for the 3DM-CV7-AR, and 3DM-GV7-AR using C. This is not an exhaustive example of all settings for those devices. If this example does not meet your specific setup needs, please consult the MIP SDK API documentation for the proper commands.
|
static |
Processes and formats log messages from the MIP SDK based on severity level. Routes messages to appropriate output streams - errors and fatal messages go to stderr while other levels go to stdout. Each message is prefixed with its severity level name.
_user | Pointer to user data (unused in this implementation) |
_level | Log message severity level from microstrain_log_level enum |
_format | Printf-style format string for the message |
_args | Variable argument list containing message parameters |
|
static |
_device | Pointer to the initialized MIP device interface |
|
static |
Sets up filter data output by:
_device | Pointer to the initialized MIP device interface |
|
static |
Sets up two event triggers for monitoring Euler angles:
_device | Pointer to the initialized MIP device interface |
|
static |
Sets up message actions for each event trigger:
_device | Pointer to the initialized MIP device interface |
|
static |
Activates both event triggers:
_device | Pointer to the initialized MIP device interface |
|
static |
Processes event trigger notifications for:
_user | User data pointer (unused) |
_field | Pointer to the MIP field containing event data |
_timestamp | Timestamp of when the event occurred (unused) |
|
static |
Configures the filter by resetting it.
_device | Pointer to the initialized MIP device interface |
|
static |
Outputs readable messages for filter state transitions:
_filter_state | Current filter mode from the MIP device interface |
|
static |
Provides basic timestamping using system time:
|
static |
Implements the MIP device interface send callback:
_device | MIP device interface containing the connection |
_data | Buffer containing packet data to send |
_length | Number of bytes to send |
|
static |
Implements the MIP device interface receive callback:
_device | MIP device interface containing the connection |
_buffer | Buffer to store received data |
_max_length | Maximum number of bytes to read |
_wait_time | How long to wait for data in milliseconds |
_from_cmd | Whether this read is from a command response (unused) |
_length_out | Number of bytes actually read |
_timestamp_out | Timestamp when data was received |
|
static |
Performs a complete device initialization sequence:
_device | Pointer to a MIP device interface to initialize |
_device_port | Pointer to an initialized serial port for device communication |
_baudrate | Serial communication baudrate for the device |
|
static |
Handles graceful shutdown when errors occur:
_device_port | Serial port connection to close |
_message | Error message to display |
_successful | Whether termination is due to success or failure |
|
static |
Handles command failure scenarios:
_device | MIP device interface for the command that failed |
_cmd_result | Result code from a failed command |
_format | Printf-style format string for error message |
... | Variable arguments for format string |
|
static |
|
static |
|
static |
|
static |