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,9 @@
Device Configs
==============

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

.. toctree::
:maxdepth: 1

cancoder-configs
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