Skip to content

Commit

Permalink
Merge pull request #90 from robotpy/add-apis
Browse files Browse the repository at this point in the history
Add various new APIs
  • Loading branch information
virtuald committed Jan 14, 2019
2 parents e8fae5a + 58393c1 commit ab7bfb4
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 0 deletions.
36 changes: 36 additions & 0 deletions gen/CANifier_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,42 @@ c_CANifier_ConfigVelocityMeasurementWindow:
config success and report an error if it times out.
If zero, no blockinxxg xxor checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_CANifier_ConfigClearPositionOnLimitF:
doc: |
Enables clearing the position of the feedback sensor when the forward
limit switch is triggered
:param clearPositionOnLimitF: Whether clearing is enabled, defaults false
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_CANifier_ConfigClearPositionOnLimitR:
doc: |
Enables clearing the position of the feedback sensor when the reverse
limit switch is triggered
:param clearPositionOnLimitR: Whether clearing is enabled, defaults false
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_CANifier_ConfigClearPositionOnQuadIdx:
doc: |
Enables clearing the position of the feedback sensor when the quadrature index signal
is detected
:param clearPositionOnQuadIdx: Whether clearing is enabled, defaults false
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_CANifier_SetLastError:
code: |
Expand Down
145 changes: 145 additions & 0 deletions gen/MotController_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,16 @@ c_MotController_Create1:
'pulse_width_velocity': 0,
'pulse_width_rise_to_rise': 0,
'pulse_width_rise_to_fall': 0,
'pulse_width_period_edges_per_rot': 0,
'pulse_width_period_filter_window_sz': 0,
# Soft limits
'soft_limit_usable': True,
'soft_limit_for': 0,
'soft_limit_for_enable': False,
'soft_limit_rev': 0,
'soft_limit_rev_enable': False,
'soft_limit_disable_neutral_on_los': False,
# Hard limits
'limit_switch_usable': True,
Expand All @@ -95,6 +98,7 @@ c_MotController_Create1:
'limit_switch_source_rev': LimitSwitchSource.Deactivated,
'limit_switch_follow_for': deviceId,
'limit_switch_follow_rev': deviceId,
'limit_switch_disable_neutral_on_los': False,
'clear_pos_on_limit_fwd': 0,
'clear_pos_on_limit_rev': 0,
Expand Down Expand Up @@ -1034,6 +1038,16 @@ c_MotController_PushMotionProfileTrajectory_2:
internal: true
c_MotController_StartMotionProfile:
ignore: true # TODO
c_MotController_IsMotionProfileFinished:
doc: |
Determine if running MP is complete.
This requires using the StartMotionProfile routine to start the MP.
That is because managing the trajectory points is now done in a background thread (if StartMotionProfile is called).
If calling application uses the legacy API (more-complex buffering API) from previous years, than this API will
not return true.
:returns: true if MP was started using StartMotionProfile, and it has completed execution (MPE is now in "hold").
c_MotController_IsMotionProfileTopLevelBufferFull:
doc: |
Retrieve just the buffer full for the api-level (top) buffer. This
Expand Down Expand Up @@ -1134,6 +1148,137 @@ c_MotController_ConfigMotionProfileTrajectoryPeriod:
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigMotionProfileTrajectoryInterpolationEnable:
doc: |
When trajectory points are processed in the buffer, the motor controller can
linearly interpolate additional trajectory points between the buffered
points. The time delta between these interpolated points is 1 ms.
By default this feature is enabled.
:param enable: Whether to enable the trajectory point interpolation feature.
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigFeedbackNotContinuous:
doc: |
Disables continuous tracking of the position for analog and pulse-width.
If the signal goes from 4095 to 0 (pulse-width) a motor controller will continue to read 4096 by default.
If overflow tracking is disabled, it will wrap to 0 (not continuous)
If using pulse-width on CTRE Mag Encoder (within one rotation) or absolute analog sensor (within one rotation),
setting feedbackNotContinuous to true is recommended, to prevent intermittent
connections from causing sensor "jumps" of 4096 (or 1024 for analog) units.
:param feedbackNotContinuous: True to disable the overflow tracking.
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigRemoteSensorClosedLoopDisableNeutralOnLOS:
doc: |
Disables going to neutral (brake/coast) when a remote sensor is no longer detected.
:param remoteSensorClosedLoopDisableNeutralOnLOS: disable going to neutral
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigClearPositionOnLimitF:
set: clear_pos_on_limit_fwd
doc: |
Enables clearing the position of the feedback sensor when the forward
limit switch is triggered.
:param clearPositionOnLimitF: Whether clearing is enabled, defaults false
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigClearPositionOnLimitR:
set: clear_pos_on_limit_rev
doc: |
Enables clearing the position of the feedback sensor when the reverse
limit switch is triggered
:param clearPositionOnLimitR: Whether clearing is enabled, defaults false
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigClearPositionOnQuadIdx:
doc: |
Enables clearing the position of the feedback sensor when the quadrature index signal
is detected
:param clearPositionOnQuadIdx: Whether clearing is enabled, defaults false
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigLimitSwitchDisableNeutralOnLOS:
set: limit_switch_disable_neutral_on_los
doc: |
Disables limit switches triggering (if enabled) when the sensor is no longer detected.
:param limitSwitchDisableNeutralOnLOS: disable triggering
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigSoftLimitDisableNeutralOnLOS:
set: soft_limit_disable_neutral_on_los
doc: |
Disables soft limits triggering (if enabled) when the sensor is no longer detected.
:param softLimitDisableNeutralOnLOS: disable triggering
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigPulseWidthPeriod_EdgesPerRot:
set: pulse_width_period_edges_per_rot
doc: |
Sets the edges per rotation of a pulse width sensor. (This should be set for
tachometer use).
:param pulseWidthPeriod_EdgesPerRot: edges per rotation
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigPulseWidthPeriod_FilterWindowSz:
set: pulse_width_period_filter_window_sz
doc: |
Sets the number of samples to use in smoothing a pulse width sensor with a rolling
average. Default is 1 (no smoothing).
:param pulseWidthPeriod_FilterWindowSz: samples for rolling avg
:param timeoutMs: Timeout value in ms. If nonzero, function will wait for
config success and report an error if it times out.
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_GetLastError:
get: last_error
doc: |
Expand Down

0 comments on commit ab7bfb4

Please sign in to comment.