Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add device specific config docs #14

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
3 changes: 1 addition & 2 deletions source/docs/api-reference/api-usage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Devices support persistent settings through the use of "configs".
Configuration Objects
---------------------

There are device-specific ``Configuration`` classes that group configuration data of devices in a meaningful way.
These classes are `Passive Data Structures <https://en.wikipedia.org/wiki/Passive_data_structure>`__.
There are device-specific ``Configuration`` classes that group configuration data of devices in a meaningful way. These classes are `Passive Data Structures <https://en.wikipedia.org/wiki/Passive_data_structure>`__.
One example is ``TalonFXConfiguration``, which has subgroups of configs such as ``MotorOutputConfigs``.
The configs can be modified through public member variables of the ``Configuration`` object.
The complete list of configuration objects can be found in the API documentation (`Java <https://api.ctr-electronics.com/phoenixpro/release/java/com/ctre/phoenixpro/configs/package-summary.html>`__, `C++ <https://api.ctr-electronics.com/phoenixpro/release/cpp/namespacectre_1_1phoenixpro_1_1configs.html>`__).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CANcoder Configs
================

This article highlights the CANcoder specific configs and how they are intended to be used.

.. note:: Unlike Phoenix 5, CANcoder will always initialize to the absolute position measurement.

Magnet Configs
--------------

These are configs related to the CANcoder magnet placement and interpretation.

Magnet Offset
^^^^^^^^^^^^^

An offset can be applied to the CANcoder position measurements that is relative, in rotations, to the magnet position. For example, the below picture indicates that the current absolute rotation is ``.75`` rotations. If you rotate the magnet CCW (from the perspective of the back of the CANcoder) by ``.25`` rotations, then the reported absolute position is ``1`` rotations. When an offset of ``.25`` is applied, the CANcoder will report the current position as ``1`` rotations. Magnet Offset must be in a range of ``-1`` to ``1``.

.. note:: For mechanisms with fixed range of motion, the offset should be set so that the discontinuity of the absolute measurement (ie, the rollover from ``1`` to ``0``) does not occur within the mechanism's range of motion.

.. image:: images/cancoder-orientation.png
:width: 550
:alt: Orientation of the cancoder magnet from the back of the cancoder

Magnet Range
^^^^^^^^^^^^

The range for a rotation can be modified. This can be useful if the CANcoder is not directly placed on the output shaft. For example, if the gear ratio between the CANcoder and the output shaft is 8:1, then the output shaft rotates 8 times for 1 CANcoder magnet rotation. If a Magnet Range config of ``8`` is applied, then this will be reported as ``1`` rotation instead of ``8`` rotations.
daltzctr marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the range should be included in this section, but for reference if/when we move these descriptions to examples, it should read:

This config changes how to view the absolute position. It is either as a range from [-0.5, 0.5) or a range from [0, 1). As an example, if the CANcoder is at -0.25 rotations, a range of Unsigned will report an absolute position of 0.75, while a range of Signed will report an absolute position of -0.25.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Device Configs
==============

This section intends to explain device specific config groups and how they are useful.

Custom Params
-------------

All supported CTR-Electronics devices have a ``CustomParams`` config group which contains 2 configs. These configs are not used by anything and can be used by the user to store data on the motor controller directly.

Device Specific Configs
-----------------------

.. toctree::
:maxdepth: 1

cancoder-configs
pigeon-configs
talonfx-configs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Pigeon 2.0 Configs
==================

This article highlights the configs specific to the Pigeon 2.0 and how they are intended to be used.

The Pigeon 2.0 has 3 config groups exclusive to this device

- Feature Enable/Disable

- Enable and disable various Pigeon 2 features

- Mounting Orientation

- Mounting orientation configurations

- Gyro Sensitivities

- Scaling the Gyro for enhanced sensitivity

Feature Enable/Disable
----------------------

The following configs are exposed:

- Disable No Motion Calibration
- Disable Temperature Compensation
- Enable Compass
daltzctr marked this conversation as resolved.
Show resolved Hide resolved

Mounting Orientation
--------------------

Mounting Orientation config group contains the configs used to manually set offsets to Pitch, Roll or Yaw. If the user has performed calibration, then the values should be non-zero and not be modified, unless a manual offset is preferred.

The following configs are exposed:

- Pitch Pose
- Roll Pose
- Yaw Pose

Gyro Sensitivity
----------------

The following configs are exposed:

- Yaw Error About X
- Yaw Error About Y
- Yaw Error About Z
daltzctr marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
TalonFX Configs
===============

This article highlights the configs exclusive to the TalonFX and how they are intended to be used.

The TalonFX has the following exclusive config groups:

- Slot 0 Configs

- Contains configs for closed loop gains. This is the default slot.

- Slot 1 Configs

- Contains configs for closed loop gains.

- Motor Output

- Configs related to motor output regardless of control.

- Voltage

- Configs that impact voltage features.

Slots
-----

The TalonFX can save up to different sets of gains (slots) that can be swapped at runtime by the user.

Motor Output
------------

This config group contains the :guilabel:`Inverted` toggle, which can be used to set whether this motor should be inverted.

Voltage
-------

This config group contains the :guilabel:`Supply Voltage Lowpass Time Constant`.
daltzctr marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions source/docs/api-reference/api-usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ There are three major components to the Phoenix Pro API:

api-overview
configuration
device-specific-configs/index
control-requests
status-signals
faults
Expand Down