Canandgyro Settings
The CanandgyroSettings object is used to reconfigure the Canandgyro.
Creation
Section titled “Creation”// Create with no values// Only values that are changed will be updated on the deviceCanandgyroSettings settings = new CanandgyroSettings();
// Make a copy of an existing CanandgyroSettings object.CanandgyroSettings copiedSettings = new CanandgyroSettings(settings);// Create with no values// Only values that are changed will be updated on the deviceCanandgyroSettings settings{};
// Make a copy of an existing CanandgyroSettings object.CanandgyroSettings copiedSettings{settings};Values are fetched and updated using the getters and setters of the object.
Writing Settings To The Canandgyro
Section titled “Writing Settings To The Canandgyro”When you are ready to send and save the settings to the device, you can use Canandgyro.setSettings to transmit the contents of a CanandgyroSettings object to the Canandgyro.
// A Canandgyro object with CAN ID 0Canandgyro canandgyro = new Canandgyro(0);
// Create a new settings object and add a value to setCanandgyroSettings settings = new CanandgyroSettings();
// set frame period to 20mssettings.setAngularPositionFramePeriod(0.02);
// Write the settings to the Canandcolor with a timeout of 50 milliseconds per setting.// By default the settings will be written to flash -- they will persist on reboots.// If this is not desired, one can use//// settings.setEphemeral(true);//// to flag the settings as ephemeral (and not persist in flash on reboot).canandgyro.setSettings(settings, 0.050);// A Canandgyro object with CAN ID 0Canandgyro canandgyro{0};
// Create a new settings object and add a value to setCanandgyroSettings settings{};
// set frame period to 20mssettings.SetAngularPositionFramePeriod(0.02_s);
// Write the settings to the Canandcolor with a timeout of 50 milliseconds per setting.// By default the settings will be written to flash -- they will persist on reboots.// If this is not desired, one can use//// settings.setEphemeral(true);//// to flag the settings as ephemeral (and not persist in flash on reboot).canandgyro.SetSettings(settings, 0.050_s);Fetching Settings From Device
Section titled “Fetching Settings From Device”Settings can be fetched from the end device in both a synchronous and asynchronous manner. Due to the synchronous method blocking for 0.15-0.25 seconds, it is recommended to use it only in initialization routines for an autonomous or teleop program.
getSettings will return an empty Optional (in Java) or std::nullopt (in C++) if the fetch times out before the device responds.
The method allSettingsReceived in the CanandgyroSettings object can be used to determine if all settings have been fetched when working with async settings fetch.
In addition, if getSettingsAsync is called after updating a Canandgyro’s settings, it will be populated with the fields that have been echoed by the device in its settings confirmation messages. For example, if the status frame is changed from 1 second to 2 seconds, repeated calls to getSettingsAsync will first return either -1 in Java or nullopt in C++ for the status frame time, until confirmation that the status frame time has been updated, at which point the field will change to 2 seconds (the value set before).
Yaw Frame Period
Section titled “Yaw Frame Period”The yaw frame period is the time between yaw packets being sent by the Boron Canandgyro over the CAN Bus. By default, this value is 0.010 seconds, meaning a yaw packet is sent every 10 milliseconds (for a total of 100 times a second). Lower values will mean packets get sent more frequently, but will correspondingly increase CAN bus utilization. This value can be set to 0, which disables the yaw output. The maximum value of this value is 65.535 seconds (65535 milliseconds). This value is set with a resolution of 0.001 seconds (1 millisecond).
Default value: 0.010 seconds
Minimum value: 0 seconds (disables yaw output)
Maximum value: 65.535 seconds
Angular Position Frame Period
Section titled “Angular Position Frame Period”The angular frame period is the time between angular packets being sent by the Boron Canandgyro over the CAN Bus. This contains the quaternion of its orientation. By default, this value is 0.020 seconds, meaning a angular position packet is sent every 20 milliseconds (for a total of 50 times a second). Lower values will mean packets get sent more frequently, but will correspondingly increase CAN bus utilization. This value can be set to 0, which disables this frame. The maximum value of this value is 65.535 seconds (65535 milliseconds). This value is set with a resolution of 0.001 seconds (1 millisecond).
Default value: 0.020 seconds
Minimum value: 0 seconds (disables the frame)
Maximum value: 65.535 seconds
Angular Velocity Frame Period
Section titled “Angular Velocity Frame Period”The angular frame period is the time between angular velocity frames being sent by the Boron Canandgyro over the CAN Bus. By default, this value is 0.10 seconds, meaning a angular velocity packet is sent every 100 milliseconds (for a total of 10 times a second). Lower values will mean packets get sent more frequently, but will correspondingly increase CAN bus utilization. This value can be set to 0, which disables this frame. The maximum value of this value is 65.535 seconds (65535 milliseconds). This value is set with a resolution of 0.001 seconds (1 millisecond).
Default value: 0.10 seconds
Minimum value: 0 seconds (disables the frame)
Maximum value: 65.535 seconds
Acceleration Frame Period
Section titled “Acceleration Frame Period”The angular frame period is the time between acceleration frames being sent by the Boron Canandgyro over the CAN Bus. By default, this value is 0.10 seconds, meaning a acceleration packet is sent every 100 milliseconds (for a total of 10 times a second). Lower values will mean packets get sent more frequently, but will correspondingly increase CAN bus utilization. This value can be set to 0, which disables this frame. The maximum value of this value is 65.535 seconds (65535 milliseconds). This value is set with a resolution of 0.001 seconds (1 millisecond).
Default value: 0.10 seconds
Minimum value: 0 seconds (disables the frame)
Maximum value: 65.535 seconds
Status Frame Period
Section titled “Status Frame Period”The status frame period is the time between status packets being sent by the Boron Canandgyro over the CAN Bus. By default, this value is 0.1 seconds, meaning a status packet is sent every 100 milliseconds. Lower values will mean packets get sent more frequently, but will correspondingly increase CAN bus utilization. This value cannot be set to zero or disabled. The maximum value of this value is 16.383 seconds (16383 milliseconds). This value is set with a resolution of 0.001 seconds (1 millisecond).
Default value: 0.1 seconds
Minimum value: 0.001 seconds
Maximum value: 16.383 seconds