Skip to content

Commit

Permalink
Merge pull request #88 from robotpy/notimpl
Browse files Browse the repository at this point in the history
Add shortcut for generating simulation not implemented errors
  • Loading branch information
virtuald committed Jan 14, 2019
2 parents 448ff77 + 0db2e7d commit 4e278cd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 154 deletions.
18 changes: 0 additions & 18 deletions gen/CANifier_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ c_CANifier_EnablePWMOutput:
c_CANifier_GetGeneralInputs:
internal: true
ignore: true # TODO
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_CANifier_GetGeneralInput:
code: |
retval = bool(self.hal_data['general_pin_inputs'] & (1 << inputPin))
Expand Down Expand Up @@ -181,8 +179,6 @@ c_CANifier_GetQuadratureVelocity:
:returns: Velocity of encoder
c_CANifier_GetQuadratureSensor:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_CANifier_ConfigVelocityMeasurementPeriod:
code: pass
doc: |
Expand Down Expand Up @@ -218,8 +214,6 @@ c_CANifier_SetLastError:
code: |
self.hal_data['last_error'] = ErrorCode(error)
c_CANifier_ConfigSetParameter:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Sets a parameter. Generally this is not used.
Expand All @@ -243,8 +237,6 @@ c_CANifier_ConfigSetParameter:
blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_CANifier_ConfigGetParameter:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Gets a parameter. Generally this is not used.
Expand All @@ -264,8 +256,6 @@ c_CANifier_ConfigGetParameter:
blocking or checking is performed.
:returns: Value of parameter.
c_CANifier_ConfigSetCustomParam:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Sets the value of a custom parameter. This is for arbitrary use.
Expand All @@ -283,8 +273,6 @@ c_CANifier_ConfigSetCustomParam:
blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_CANifier_ConfigGetCustomParam:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Gets the value of a custom parameter. This is for arbitrary use.
Expand All @@ -301,15 +289,9 @@ c_CANifier_ConfigGetCustomParam:
:returns: Value of the custom param.
c_CANifier_GetFaults:
internal: true
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_CANifier_GetStickyFaults:
internal: true
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_CANifier_ClearStickyFaults:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Clears the Sticky Faults
Expand Down
46 changes: 0 additions & 46 deletions gen/MotController_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ c_MotController_GetDeviceNumber:
retval = self._deviceId
c_MotController_GetDescription:
ignore: true # TODO`
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_MotController_SetDemand:
code: |
if self.hal_data['control_mode'] == ControlMode.Follower and mode != ControlMode.Follower:
Expand Down Expand Up @@ -447,8 +445,6 @@ c_MotController_ConfigSelectedFeedbackCoefficient:
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigRemoteFeedbackFilter:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Select what remote device and signal to assign to Remote Sensor 0 or Remote Sensor 1.
After binding a remote device and signal to Remote Sensor X, you may select Remote Sensor X
Expand Down Expand Up @@ -569,8 +565,6 @@ c_MotController_SetStatusFramePeriod:
blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_GetStatusFramePeriod:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Gets the period of the given status frame.
Expand Down Expand Up @@ -923,32 +917,24 @@ c_MotController_SelectProfileSlot:
:param pidIdx:
0 for Primary closed-loop. 1 for auxiliary closed-loop.
c_MotController_GetActiveTrajectoryPosition:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Gets the active trajectory target position using
MotionMagic/MotionProfile control modes.
:returns: The Active Trajectory Position in sensor units.
c_MotController_GetActiveTrajectoryVelocity:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Gets the active trajectory target velocity using
MotionMagic/MotionProfile control modes.
:returns: The Active Trajectory Velocity in sensor units per 100ms.
c_MotController_GetActiveTrajectoryHeading:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Gets the active trajectory target heading using
MotionMagicArc/MotionProfileArc control modes.
:returns: The Active Trajectory Heading in degreees.
c_MotController_GetActiveTrajectoryAll:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_MotController_ConfigMotionCruiseVelocity:
set: motionmagic_cruise_velocity
doc: |
Expand Down Expand Up @@ -977,14 +963,10 @@ c_MotController_ConfigMotionAcceleration:
blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ClearMotionProfileTrajectories:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Clear the buffered motion profile in both controller's RAM (bottom), and in the
API (top).
c_MotController_GetMotionProfileTopLevelBufferCount:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Retrieve just the buffer count for the api-level (top) buffer. This
routine performs no CAN or data structure lookups, so its fast and ideal
Expand All @@ -994,8 +976,6 @@ c_MotController_GetMotionProfileTopLevelBufferCount:
:returns: number of trajectory points in the top buffer.
c_MotController_PushMotionProfileTrajectory:
internal: true
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Push another trajectory point into the top level buffer (which is emptied
into the motor controller's bottom buffer as room allows).
Expand Down Expand Up @@ -1027,13 +1007,9 @@ c_MotController_PushMotionProfileTrajectory:
full due to kMotionProfileTopBufferCapacity.
c_MotController_PushMotionProfileTrajectory_2:
internal: true
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_MotController_StartMotionProfile:
ignore: true # TODO
c_MotController_IsMotionProfileTopLevelBufferFull:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Retrieve just the buffer full for the api-level (top) buffer. This
routine performs no CAN or data structure lookups, so its fast and ideal
Expand All @@ -1042,8 +1018,6 @@ c_MotController_IsMotionProfileTopLevelBufferFull:
:returns: number of trajectory points in the top buffer.
c_MotController_ProcessMotionProfileBuffer:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
This must be called periodically to funnel the trajectory points from the
API's top level buffer to the controller's bottom level buffer. Recommendation
Expand All @@ -1054,8 +1028,6 @@ c_MotController_ProcessMotionProfileBuffer:
utilize threading.
c_MotController_GetMotionProfileStatus:
internal: true
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Retrieve all status information.
For best performance, Caller can snapshot all status information regarding the
Expand Down Expand Up @@ -1101,11 +1073,7 @@ c_MotController_GetMotionProfileStatus:
confirm the change takes effect before interacting with the top buffer.
c_MotController_GetMotionProfileStatus_2:
internal: true
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_MotController_ClearMotionProfileHasUnderrun:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Clear the "Has Underrun" flag. Typically this is called after application
has confirmed an underrun had occured.
Expand All @@ -1116,8 +1084,6 @@ c_MotController_ClearMotionProfileHasUnderrun:
blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ChangeMotionControlFramePeriod:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Calling application can opt to speed up the handshaking between the robot
API and the controller to increase the download rate of the controller's Motion
Expand All @@ -1128,8 +1094,6 @@ c_MotController_ChangeMotionControlFramePeriod:
The transmit period in ms.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigMotionProfileTrajectoryPeriod:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
When trajectory points are processed in the motion profile executer, the MPE determines
how long to apply the active trajectory point by summing baseTrajDurationMs with the
Expand Down Expand Up @@ -1165,8 +1129,6 @@ c_MotController_HasResetOccurred:
doc: |
:returns: Returns true if the device has reset since last call
c_MotController_ConfigSetCustomParam:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Sets the value of a custom parameter. This is for arbitrary use.
Expand All @@ -1184,8 +1146,6 @@ c_MotController_ConfigSetCustomParam:
If zero, no blocking or checking is performed.
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigGetCustomParam:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
doc: |
Gets the value of a custom parameter.
Expand Down Expand Up @@ -1518,12 +1478,8 @@ c_MotController_IsRevLimitSwitchClosed:
retval = 1 if data['limit_switch_closed_rev'] else 0
c_MotController_GetFaults:
internal: true
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_MotController_GetStickyFaults:
internal: true
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_MotController_ClearStickyFaults:
code: pass
doc: |
Expand All @@ -1542,8 +1498,6 @@ c_MotController_SelectDemandType:
:param value:
c_MotController_SetMPEOutput:
code: |
raise NotImplementedError("Not implemented in simulation (file a bug on github if you need it)")
c_MotController_EnableHeadingHold:
code: pass
doc: |
Expand Down

0 comments on commit 4e278cd

Please sign in to comment.