C/C++ API Reference
NCoder.NCoder()
NCoder::NCoder(uint32_t device_id, Interface *interface)
Description
Construct a new NCoder object.
Parameters
Datatype | Variable | Description |
---|
uint32_t | device_id | Device Id for the NCoder device |
Interface * | interface | CAN / USB Interface object for the interface to which the NCoder is connected |
NCoder.NCoder()
NCoder::NCoder(Interface *interface)
Description
Construct a new NCoder object.
Parameters
Datatype | Variable | Description |
---|
Interface * | interface | USB Interface object for the interface to which the NCoder is connected |
ret_status_t NCoder::configureEncoder(uint8_t encoder_type, int32_t resolution_param)
Description
Configure the encoder parameters.
encoder_type value | Encoder Type | Description |
---|
0 | TYPE_NONE | Using no encoder |
4 | TYPE_SPI_ABS_MA732 | Using MA732 absolute encoder from Monolith Power Systems |
9 | TYPE_SPI_ABS_MA600 | Using MA600 absolute encoder from Monolith Power Systems |
Parameters
Datatype | Variable | Description |
---|
uint8_t | encoder_type | Set the encoder type |
int32_t | resolution_param | Set the encoder resolution [in bits] |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.enterDFUMode()
ret_status_t NCoder::enterDFUMode()
Description
Enter the Device Firmware Update (DFU) mode.
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.eraseConfigurations()
ret_status_t NCoder::eraseConfigurations()
Description
Erase the saved configurations from non-volatile memory.
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getAbsoluteAngle()
ret_status_t NCoder::getAbsoluteAngle(float *abs_angle)
Description
Get the current absolute angle measurement from the encoder (in degrees)
Parameters
Datatype | Variable | Description |
---|
float * | abs_angle | Pointer to the variable where the absolute angle value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getEncoderConfiguration()
ret_status_t NCoder::getEncoderConfiguration(uint8_t *encoder_type, int32_t *resolution_param)
Description
Retrieve the current encoder configuration parameters.
encoder_type value | Encoder Type | Description |
---|
0 | TYPE_NONE | Using no encoder |
4 | TYPE_SPI_ABS_MA732 | Using MA732 absolute encoder from Monolith Power Systems |
9 | TYPE_SPI_ABS_MA600 | Using MA600 absolute encoder from Monolith Power Systems |
Parameters
Datatype | Variable | Description |
---|
uint8_t * | encoder_type | Pointer to the variable where the encoder type value is to be saved |
int32_t * | resolution_param | Pointer to the variable where the encoder resolution [in bits] is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getEncoderCount()
ret_status_t NCoder::getEncoderCount(int32_t *encoder_count)
Description
Get the current encoder count (angular Increment)
Parameters
Datatype | Variable | Description |
---|
int32_t * | encoder_count | Pointer to the variable where the encoder count value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getEncoderDirection()
ret_status_t NCoder::getEncoderDirection(uint8_t *direction)
Description
Get the encoder direction.
Parameters
Datatype | Variable | Description |
---|
uint8_t * | direction | Pointer to the variable where the encoder direction is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getEncoderRawData()
ret_status_t NCoder::getEncoderRawData(uint32_t *abs_position)
Description
Get the raw absolute position data directly from encoder hardware.
Parameters
Datatype | Variable | Description |
---|
uint32_t * | abs_position | Pointer to the variable where the raw data value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getFilterWindowLength()
ret_status_t NCoder::getFilterWindowLength(uint32_t *filter_window_length)
Description
Get the filter window length for the encoder.
Parameters
Datatype | Variable | Description |
---|
uint32_t * | filter_window_length | Pointer to the variable where the filter window length value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getFilteredAcceleration()
ret_status_t NCoder::getFilteredAcceleration(float *acceleration_filtered)
Description
Get the filtered acceleration value.
Parameters
Datatype | Variable | Description |
---|
float * | acceleration_filtered | Pointer to the variable where the filtered acceleration value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getFilteredVelocity()
ret_status_t NCoder::getFilteredVelocity(float *velocity_filtered)
Description
Get the filtered velocity value.
Parameters
Datatype | Variable | Description |
---|
float * | velocity_filtered | Pointer to the variable where the filtered velocity value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getFirmwareCommit()
ret_status_t NCoder::getFirmwareCommit(std::string *commit)
Description
Get the firmware commit hash of the NCoder device.
Parameters
Datatype | Variable | Description |
---|
std::string * | commit | Pointer to the string where the commit hash is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getFirmwareVersion()
ret_status_t NCoder::getFirmwareVersion(uint8_t *major, uint8_t *minor, uint16_t *revision)
Description
Get the firmware version of the NCoder device.
Parameters
Datatype | Variable | Description |
---|
uint8_t * | major | Pointer to the variable where the major version is to be saved |
uint8_t * | minor | Pointer to the variable where the minor version is to be saved |
uint16_t * | revision | Pointer to the variable where the revision number is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getHardwareVersion()
ret_status_t NCoder::getHardwareVersion(uint8_t *tag, uint8_t *major, uint8_t *minor, uint8_t *variant)
Description
Get the hardware version of the NCoder device.
Parameters
Datatype | Variable | Description |
---|
uint8_t * | tag | Pointer to the variable where the hardware tag is to be saved |
uint8_t * | major | Pointer to the variable where the major version is to be saved |
uint8_t * | minor | Pointer to the variable where the minor version is to be saved |
uint8_t * | variant | Pointer to the variable where the variant is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getMAxxxSPIRegister()
ret_status_t NCoder::getMAxxxSPIRegister(uint8_t register_address, uint8_t *data, bool *status)
Description
Get a value from the MAxxx SPI register.
Parameters
Datatype | Variable | Description |
---|
uint8_t | register_address | Address of the register to be read |
uint8_t * | data | Pointer to the variable where the register data is to be saved |
bool * | status | Pointer to the variable where the status of the operation is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getMultiturnAngle()
ret_status_t NCoder::getMultiturnAngle(float *multiturn_angle)
Description
Get the multiturn angle of the encoder.
Parameters
Datatype | Variable | Description |
---|
float * | multiturn_angle | Pointer to the variable where the multiturn angle is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getNodeId()
ret_status_t NCoder::getNodeId(uint32_t *node_id)
Description
Get current CAN Node ID of the NCoder device.
Parameters
Datatype | Variable | Description |
---|
uint32_t * | node_id | Pointer to the variable to which the current CAN Node ID of the NCoder device is to be saved. |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getRawAcceleration()
ret_status_t NCoder::getRawAcceleration(float *acceleration_raw)
Description
Get the raw acceleration value.
Parameters
Datatype | Variable | Description |
---|
float * | acceleration_raw | Pointer to the variable where the raw acceleration value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getRawVelocity()
ret_status_t NCoder::getRawVelocity(float *velocity_raw)
Description
Get the raw velocity value.
Parameters
Datatype | Variable | Description |
---|
float * | velocity_raw | Pointer to the variable where the raw velocity value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getScaledAcceleration()
ret_status_t NCoder::getScaledAcceleration(float *acceleration_scaled)
Description
Get the scaled acceleration value.
Parameters
Datatype | Variable | Description |
---|
float * | acceleration_scaled | Pointer to the variable where the scaled acceleration value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getScaledFilteredAcceleration()
ret_status_t NCoder::getScaledFilteredAcceleration(float *acceleration_scaled_filtered)
Description
Get the scaled and filtered acceleration value.
Parameters
Datatype | Variable | Description |
---|
float * | acceleration_scaled_filtered | Pointer to the variable where the scaled and filtered acceleration value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getScaledFilteredVelocity()
ret_status_t NCoder::getScaledFilteredVelocity(float *velocity_scaled_filtered)
Description
Get the scaled and filtered velocity value.
Parameters
Datatype | Variable | Description |
---|
float * | velocity_scaled_filtered | Pointer to the variable where the scaled and filtered velocity value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getScaledVelocity()
ret_status_t NCoder::getScaledVelocity(float *velocity_scaled)
Description
Get the scaled velocity value.
Parameters
Datatype | Variable | Description |
---|
float * | velocity_scaled | Pointer to the variable where the scaled velocity value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getScalingFactor()
ret_status_t NCoder::getScalingFactor(float *scaling_factor)
Description
Get the scaling factor for the encoder.
Parameters
Datatype | Variable | Description |
---|
float * | scaling_factor | Pointer to the variable where the scaling factor is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.getZeroPosition()
ret_status_t NCoder::getZeroPosition(float *zero_position)
Description
Get the zero position of the encoder.
Parameters
Datatype | Variable | Description |
---|
float * | zero_position | Pointer to the variable where the zero position value is to be saved |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.isConnected()
bool NCoder::isConnected()
Description
Check if the device is still connected or not.
Returns
Datatype | Description |
---|
bool | true |
NCoder.rebootNCoder()
ret_status_t NCoder::rebootNCoder()
Description
Reboot the NCoder device.
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.saveConfigurations()
ret_status_t NCoder::saveConfigurations()
Description
Save the current configurations to non-volatile memory.
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.setCurrentPositionToZero()
ret_status_t NCoder::setCurrentPositionToZero()
Description
Set the current position of the encoder to zero.
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.setEncoderDirection()
ret_status_t NCoder::setEncoderDirection(uint8_t direction)
Description
Set the encoder direction.
Parameters
Datatype | Variable | Description |
---|
uint8_t | direction | Encoder direction to be set |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.setFilterWindowLength()
ret_status_t NCoder::setFilterWindowLength(uint32_t filter_window_length)
Description
Set the filter window length for the encoder.
Parameters
Datatype | Variable | Description |
---|
uint32_t | filter_window_length | Filter window length value to be set |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.setLinearCount()
ret_status_t NCoder::setLinearCount(uint32_t count)
Description
Set the linear count for the encoder.
Parameters
Datatype | Variable | Description |
---|
uint32_t | count | Linear count value to be set |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.setMAxxxSPIRegister()
ret_status_t NCoder::setMAxxxSPIRegister(uint8_t register_address, uint8_t data)
Description
Set a value in the MAxxx SPI register.
Parameters
Datatype | Variable | Description |
---|
uint8_t | register_address | Address of the register to be set |
uint8_t | data | Data to be written to the register |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.setNodeId()
ret_status_t NCoder::setNodeId(uint32_t id)
Description
Set the node id for the NCoder device.
Parameters
Datatype | Variable | Description |
---|
uint32_t | id | CAN Node ID of the NCoder device |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
NCoder.setScalingFactor()
ret_status_t NCoder::setScalingFactor(float scaling_factor)
Description
Set the scaling factor for the encoder.
Parameters
Datatype | Variable | Description |
---|
float | scaling_factor | Scaling factor to be set |
Returns
Datatype | Description |
---|
ret_status_t | Return Status |
Python API Reference
NCoder.__init__()
__init__(id: int = -1, interface: USBInterface = None)
Description
NCoder class constructor.
Parameters
Datatype | Variable | Description |
---|
int | id | CAN Node ID of the NCoder device |
USBInterface | interface | Initialised CANInterface or USBInterface object |
configureEncoder(encoder_type: int, resolution_param: int = 4096) -> int
Description
Configure the encoder parameters.
encoder_type value | Encoder Type | Description |
---|
0 | TYPE_NONE | Using no encoder |
4 | TYPE_SPI_ABS_MA732 | Using MA732 absolute encoder from Monolith Power Systems |
9 | TYPE_SPI_ABS_MA600 | Using MA600 absolute encoder from Monolith Power Systems |
Parameters
Datatype | Variable | Description |
---|
int | encoder_type | Type of encoder used |
int | resolution_param | Encoder resolution (in bit) |
Returns
Datatype | Description |
---|
int | Return status |
NCoder.enterDFUMode()
Description
Enter Device Firmware Update Mode.
Returns
Datatype | Description |
---|
int | Return Status. |
NCoder.eraseConfigurations()
eraseConfigurations() -> int
Description
Erase the saved configurations from the non-volatile memory.
Returns
Datatype | Description |
---|
int | Return Status. |
NCoder.getAbsoluteAngle()
getAbsoluteAngle() -> 'tuple[int, float]'
Description
Get the current absolute angle measurement from the encoder (in degrees)
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the absolute angle value |
NCoder.getEncoderConfiguration()
getEncoderConfiguration() -> 'tuple[int, int, int]'
Description
Retrieve the current encoder configuration parameters.
encoder_type value | Encoder Type | Description |
---|
0 | TYPE_NONE | Using no encoder |
4 | TYPE_SPI_ABS_MA732 | Using MA732 absolute encoder from Monolith Power Systems |
9 | TYPE_SPI_ABS_MA600 | Using MA600 absolute encoder from Monolith Power Systems |
Returns
Datatype | Description |
---|
'tuple[int,int,int]' | Tuple containing return status, encoder type and resolution parameter (bits) |
NCoder.getEncoderCount()
getEncoderCount() -> 'tuple[int, int]'
Description
Get the current encoder count (angular Increment)
Returns
Datatype | Description |
---|
'tuple[int,int]' | Tuple containing return status and the encoder count value |
NCoder.getEncoderDirection()
getEncoderDirection() -> 'tuple[int, int]'
Description
Get the current encoder direction.
Returns
Datatype | Description |
---|
'tuple[int,int]' | Tuple containing return status and the current encoder direction (0 for normal, 1 for inverted) |
NCoder.getEncoderRawData()
getEncoderRawData() -> 'tuple[int, int]'
Description
Get the raw absolute position data directly from encoder hardware.
Returns
Datatype | Description |
---|
'tuple[int,int]' | Tuple containing return status and the raw data value from the encoder |
NCoder.getFilterWindowLength()
getFilterWindowLength() -> 'tuple[int, int]'
Description
Get the filter window length of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,int]' | Tuple containing return status and the filter window length value |
NCoder.getFilteredAcceleration()
getFilteredAcceleration() -> 'tuple[int, float]'
Description
Get the filtered acceleration of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the filtered acceleration value (in degrees per second squared) |
NCoder.getFilteredVelocity()
getFilteredVelocity() -> 'tuple[int, float]'
Description
Get the filtered velocity of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the filtered velocity value (in degrees per second) |
NCoder.getFirmwareCommit()
getFirmwareCommit() -> 'tuple[int, str]'
Description
Get the NCoder firmware's commit hash.
Returns
Datatype | Description |
---|
'tuple[int,str]' | Tuple containing return status and the commit hash string. |
NCoder.getFirmwareVersion()
getFirmwareVersion() -> 'tuple[int, int, int, int]'
Description
Get the NCoder firmware's major, minor and revision information.
Returns
Datatype | Description |
---|
'tuple[int,int,int,int]' | Tuple containing return status, major, minor and revision information. |
NCoder.getHardwareVersion()
getHardwareVersion() -> 'tuple[int, int, int, int, int]'
Description
Get the NCoder hardware's current tag, major, minor and variant information.
Returns
Datatype | Description |
---|
'tuple[int,int,int,int,int]' | Tuple containing return status, tag, major, minor and variant information. |
NCoder.getMAxxxSPIRegister()
getMAxxxSPIRegister(register_address: int) -> 'tuple[int, int, bool]'
Description
Get the data from the maxxx encoder spi register.
Parameters
Datatype | Variable | Description |
---|
int | register_address | register address from which the data needs to be read |
Returns
Datatype | Description |
---|
'tuple[int,int,bool]' | - |
NCoder.getMultiturnAngle()
getMultiturnAngle() -> 'tuple[int, float]'
Description
Get the current multiturn angle of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the multiturn angle value (in degrees) |
NCoder.getNodeId()
getNodeId() -> 'tuple[int, int]'
Description
Get current Node ID of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,int]' | Tuple containing return status and the current Node ID. |
NCoder.getRawAcceleration()
getRawAcceleration() -> 'tuple[int, float]'
Description
Get the acceleration of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the acceleration value (in degrees per second squared) |
NCoder.getRawVelocity()
getRawVelocity() -> 'tuple[int, float]'
Description
Get the raw velocity of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the raw velocity value (in degrees per second) |
NCoder.getScaledAcceleration()
getScaledAcceleration() -> 'tuple[int, float]'
Description
Get the scaled acceleration of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the scaled acceleration value (in degrees per second squared) |
NCoder.getScaledFilteredAcceleration()
getScaledFilteredAcceleration() -> 'tuple[int, float]'
Description
Get the scaled filtered acceleration of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the scaled filtered acceleration value (in degrees per second squared) |
NCoder.getScaledFilteredVelocity()
getScaledFilteredVelocity() -> 'tuple[int, float]'
Description
Get the scaled filtered velocity of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the scaled filtered velocity value (in degrees per second) |
NCoder.getScaledVelocity()
getScaledVelocity() -> 'tuple[int, float]'
Description
Get the scaled velocity of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the scaled velocity value (in degrees per second) |
NCoder.getScalingFactor()
getScalingFactor() -> 'tuple[int, float]'
Description
Get the scaling factor of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the scaling factor value |
NCoder.getZeroPosition()
getZeroPosition() -> 'tuple[int, float]'
Description
Get the zero position of the NCoder.
Returns
Datatype | Description |
---|
'tuple[int,float]' | Tuple containing return status and the zero position value |
NCoder.rebootNCoder()
Description
Reboot the NCoder device.
Returns
Datatype | Description |
---|
int | Return status |
NCoder.saveConfigurations()
saveConfigurations() -> int
Description
Save the current configurations to non-volatile memory.
Returns
Datatype | Description |
---|
int | Return Status . |
NCoder.setCurrentPositionToZero()
setCurrentPositionToZero() -> int
Description
Set the current position of the NCoder to zero.
Returns
Datatype | Description |
---|
int | Return status |
NCoder.setEncoderDirection()
setEncoderDirection(direction: int) -> int
Description
Set the encoder direction for the NCoder.
Parameters
Datatype | Variable | Description |
---|
int | direction | Encoder direction to be set (0 for normal, 1 for inverted) |
Returns
Datatype | Description |
---|
int | Return status |
NCoder.setFilterWindowLength()
setFilterWindowLength(filter_window_length: int) -> int
Description
Set the filter window length for the NCoder.
Parameters
Datatype | Variable | Description |
---|
int | filter_window_length | Filter window length value to be set |
Returns
Datatype | Description |
---|
int | Return status |
NCoder.setLinearCount()
setLinearCount(count: int) -> int
Description
Set the linear count for the NCoder.
Parameters
Datatype | Variable | Description |
---|
int | count | Linear count value to be set |
Returns
Datatype | Description |
---|
int | Return status |
NCoder.setMAxxxSPIRegister()
setMAxxxSPIRegister(register_address: int, data: int) -> int
Description
Set the maxxx encoder spi register.
Parameters
Datatype | Variable | Description |
---|
int | register_address | register_addres value to be which needs to be modified |
int | data | - |
Returns
Datatype | Description |
---|
int | Tuple containing return status and the spi register data value value. |
NCoder.setNodeId()
setNodeId(id: int) -> int
Description
Set the node id for the NCoder.
Parameters
Datatype | Variable | Description |
---|
int | id | Device ID of the NCoder |
Returns
Datatype | Description |
---|
int | Return Status |
NCoder.setScalingFactor()
setScalingFactor(scaling_factor: float) -> int
Description
Set the scaling factor for the NCoder.
Parameters
Datatype | Variable | Description |
---|
float | scaling_factor | Scaling factor value to be set |
Returns
Datatype | Description |
---|
int | Return status |