Skip to main content
Firmware Version 0.1.1

API Reference

Firmware Version:

C/C++ API Reference

NCoder.NCoder()

NCoder::NCoder(uint32_t device_id, Interface *interface)
Description

Construct a new NCoder object.

Parameters
DatatypeVariableDescription
uint32_tdevice_idDevice Id for the NCoder device
Interface *interfaceCAN / 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
DatatypeVariableDescription
Interface *interfaceUSB Interface object for the interface to which the NCoder is connected

NCoder.configureEncoder()

ret_status_t NCoder::configureEncoder(uint8_t encoder_type, int32_t resolution_param)
Description

Configure the encoder parameters.

encoder_type valueEncoder TypeDescription
0TYPE_NONEUsing no encoder
4TYPE_SPI_ABS_MA732Using MA732 absolute encoder from Monolith Power Systems
9TYPE_SPI_ABS_MA600Using MA600 absolute encoder from Monolith Power Systems
Parameters
DatatypeVariableDescription
uint8_tencoder_typeSet the encoder type
int32_tresolution_paramSet the encoder resolution [in bits]
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.enterDFUMode()

ret_status_t NCoder::enterDFUMode()
Description

Enter the Device Firmware Update (DFU) mode.

Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.eraseConfigurations()

ret_status_t NCoder::eraseConfigurations()
Description

Erase the saved configurations from non-volatile memory.

Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getAbsoluteAngle()

ret_status_t NCoder::getAbsoluteAngle(float *abs_angle)
Description

Get the current absolute angle measurement from the encoder (in degrees)

Parameters
DatatypeVariableDescription
float *abs_anglePointer to the variable where the absolute angle value is to be saved
Returns
DatatypeDescription
ret_status_tReturn 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 valueEncoder TypeDescription
0TYPE_NONEUsing no encoder
4TYPE_SPI_ABS_MA732Using MA732 absolute encoder from Monolith Power Systems
9TYPE_SPI_ABS_MA600Using MA600 absolute encoder from Monolith Power Systems
Parameters
DatatypeVariableDescription
uint8_t *encoder_typePointer to the variable where the encoder type value is to be saved
int32_t *resolution_paramPointer to the variable where the encoder resolution [in bits] is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getEncoderCount()

ret_status_t NCoder::getEncoderCount(int32_t *encoder_count)
Description

Get the current encoder count (angular Increment)

Parameters
DatatypeVariableDescription
int32_t *encoder_countPointer to the variable where the encoder count value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getEncoderDirection()

ret_status_t NCoder::getEncoderDirection(uint8_t *direction)
Description

Get the encoder direction.

Parameters
DatatypeVariableDescription
uint8_t *directionPointer to the variable where the encoder direction is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getEncoderRawData()

ret_status_t NCoder::getEncoderRawData(uint32_t *abs_position)
Description

Get the raw absolute position data directly from encoder hardware.

Parameters
DatatypeVariableDescription
uint32_t *abs_positionPointer to the variable where the raw data value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getFilterWindowLength()

ret_status_t NCoder::getFilterWindowLength(uint32_t *filter_window_length)
Description

Get the filter window length for the encoder.

Parameters
DatatypeVariableDescription
uint32_t *filter_window_lengthPointer to the variable where the filter window length value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getFilteredAcceleration()

ret_status_t NCoder::getFilteredAcceleration(float *acceleration_filtered)
Description

Get the filtered acceleration value.

Parameters
DatatypeVariableDescription
float *acceleration_filteredPointer to the variable where the filtered acceleration value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getFilteredVelocity()

ret_status_t NCoder::getFilteredVelocity(float *velocity_filtered)
Description

Get the filtered velocity value.

Parameters
DatatypeVariableDescription
float *velocity_filteredPointer to the variable where the filtered velocity value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getFirmwareCommit()

ret_status_t NCoder::getFirmwareCommit(std::string *commit)
Description

Get the firmware commit hash of the NCoder device.

Parameters
DatatypeVariableDescription
std::string *commitPointer to the string where the commit hash is to be saved
Returns
DatatypeDescription
ret_status_tReturn 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
DatatypeVariableDescription
uint8_t *majorPointer to the variable where the major version is to be saved
uint8_t *minorPointer to the variable where the minor version is to be saved
uint16_t *revisionPointer to the variable where the revision number is to be saved
Returns
DatatypeDescription
ret_status_tReturn 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
DatatypeVariableDescription
uint8_t *tagPointer to the variable where the hardware tag is to be saved
uint8_t *majorPointer to the variable where the major version is to be saved
uint8_t *minorPointer to the variable where the minor version is to be saved
uint8_t *variantPointer to the variable where the variant is to be saved
Returns
DatatypeDescription
ret_status_tReturn 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
DatatypeVariableDescription
uint8_tregister_addressAddress of the register to be read
uint8_t *dataPointer to the variable where the register data is to be saved
bool *statusPointer to the variable where the status of the operation is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getMultiturnAngle()

ret_status_t NCoder::getMultiturnAngle(float *multiturn_angle)
Description

Get the multiturn angle of the encoder.

Parameters
DatatypeVariableDescription
float *multiturn_anglePointer to the variable where the multiturn angle is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getNodeId()

ret_status_t NCoder::getNodeId(uint32_t *node_id)
Description

Get current CAN Node ID of the NCoder device.

Parameters
DatatypeVariableDescription
uint32_t *node_idPointer to the variable to which the current CAN Node ID of the NCoder device is to be saved.
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getRawAcceleration()

ret_status_t NCoder::getRawAcceleration(float *acceleration_raw)
Description

Get the raw acceleration value.

Parameters
DatatypeVariableDescription
float *acceleration_rawPointer to the variable where the raw acceleration value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getRawVelocity()

ret_status_t NCoder::getRawVelocity(float *velocity_raw)
Description

Get the raw velocity value.

Parameters
DatatypeVariableDescription
float *velocity_rawPointer to the variable where the raw velocity value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getScaledAcceleration()

ret_status_t NCoder::getScaledAcceleration(float *acceleration_scaled)
Description

Get the scaled acceleration value.

Parameters
DatatypeVariableDescription
float *acceleration_scaledPointer to the variable where the scaled acceleration value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getScaledFilteredAcceleration()

ret_status_t NCoder::getScaledFilteredAcceleration(float *acceleration_scaled_filtered)
Description

Get the scaled and filtered acceleration value.

Parameters
DatatypeVariableDescription
float *acceleration_scaled_filteredPointer to the variable where the scaled and filtered acceleration value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getScaledFilteredVelocity()

ret_status_t NCoder::getScaledFilteredVelocity(float *velocity_scaled_filtered)
Description

Get the scaled and filtered velocity value.

Parameters
DatatypeVariableDescription
float *velocity_scaled_filteredPointer to the variable where the scaled and filtered velocity value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getScaledVelocity()

ret_status_t NCoder::getScaledVelocity(float *velocity_scaled)
Description

Get the scaled velocity value.

Parameters
DatatypeVariableDescription
float *velocity_scaledPointer to the variable where the scaled velocity value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getScalingFactor()

ret_status_t NCoder::getScalingFactor(float *scaling_factor)
Description

Get the scaling factor for the encoder.

Parameters
DatatypeVariableDescription
float *scaling_factorPointer to the variable where the scaling factor is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.getZeroPosition()

ret_status_t NCoder::getZeroPosition(float *zero_position)
Description

Get the zero position of the encoder.

Parameters
DatatypeVariableDescription
float *zero_positionPointer to the variable where the zero position value is to be saved
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.isConnected()

bool NCoder::isConnected()
Description

Check if the device is still connected or not.

Returns
DatatypeDescription
booltrue

NCoder.rebootNCoder()

ret_status_t NCoder::rebootNCoder()
Description

Reboot the NCoder device.

Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.saveConfigurations()

ret_status_t NCoder::saveConfigurations()
Description

Save the current configurations to non-volatile memory.

Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.setCurrentPositionToZero()

ret_status_t NCoder::setCurrentPositionToZero()
Description

Set the current position of the encoder to zero.

Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.setEncoderDirection()

ret_status_t NCoder::setEncoderDirection(uint8_t direction)
Description

Set the encoder direction.

Parameters
DatatypeVariableDescription
uint8_tdirectionEncoder direction to be set
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.setFilterWindowLength()

ret_status_t NCoder::setFilterWindowLength(uint32_t filter_window_length)
Description

Set the filter window length for the encoder.

Parameters
DatatypeVariableDescription
uint32_tfilter_window_lengthFilter window length value to be set
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.setLinearCount()

ret_status_t NCoder::setLinearCount(uint32_t count)
Description

Set the linear count for the encoder.

Parameters
DatatypeVariableDescription
uint32_tcountLinear count value to be set
Returns
DatatypeDescription
ret_status_tReturn 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
DatatypeVariableDescription
uint8_tregister_addressAddress of the register to be set
uint8_tdataData to be written to the register
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.setNodeId()

ret_status_t NCoder::setNodeId(uint32_t id)
Description

Set the node id for the NCoder device.

Parameters
DatatypeVariableDescription
uint32_tidCAN Node ID of the NCoder device
Returns
DatatypeDescription
ret_status_tReturn Status

NCoder.setScalingFactor()

ret_status_t NCoder::setScalingFactor(float scaling_factor)
Description

Set the scaling factor for the encoder.

Parameters
DatatypeVariableDescription
floatscaling_factorScaling factor to be set
Returns
DatatypeDescription
ret_status_tReturn Status

Python API Reference

NCoder.__init__()

__init__(id: int = -1, interface: USBInterface = None) 
Description

NCoder class constructor.

Parameters
DatatypeVariableDescription
intidCAN Node ID of the NCoder device
USBInterfaceinterfaceInitialised CANInterface or USBInterface object

NCoder.configureEncoder()

configureEncoder(encoder_type: int, resolution_param: int = 4096) -> int
Description

Configure the encoder parameters.

encoder_type valueEncoder TypeDescription
0TYPE_NONEUsing no encoder
4TYPE_SPI_ABS_MA732Using MA732 absolute encoder from Monolith Power Systems
9TYPE_SPI_ABS_MA600Using MA600 absolute encoder from Monolith Power Systems
Parameters
DatatypeVariableDescription
intencoder_typeType of encoder used
intresolution_paramEncoder resolution (in bit)
Returns
DatatypeDescription
intReturn status

NCoder.enterDFUMode()

enterDFUMode() -> int
Description

Enter Device Firmware Update Mode.

Returns
DatatypeDescription
intReturn Status.

NCoder.eraseConfigurations()

eraseConfigurations() -> int
Description

Erase the saved configurations from the non-volatile memory.

Returns
DatatypeDescription
intReturn Status.

NCoder.getAbsoluteAngle()

getAbsoluteAngle() ->  'tuple[int, float]'
Description

Get the current absolute angle measurement from the encoder (in degrees)

Returns
DatatypeDescription
'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 valueEncoder TypeDescription
0TYPE_NONEUsing no encoder
4TYPE_SPI_ABS_MA732Using MA732 absolute encoder from Monolith Power Systems
9TYPE_SPI_ABS_MA600Using MA600 absolute encoder from Monolith Power Systems
Returns
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeVariableDescription
intregister_addressregister address from which the data needs to be read
Returns
DatatypeDescription
'tuple[int,int,bool]'-

NCoder.getMultiturnAngle()

getMultiturnAngle() ->  'tuple[int, float]'
Description

Get the current multiturn angle of the NCoder.

Returns
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'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
DatatypeDescription
'tuple[int,float]'Tuple containing return status and the zero position value

NCoder.rebootNCoder()

rebootNCoder() -> int
Description

Reboot the NCoder device.

Returns
DatatypeDescription
intReturn status

NCoder.saveConfigurations()

saveConfigurations() -> int
Description

Save the current configurations to non-volatile memory.

Returns
DatatypeDescription
intReturn Status .

NCoder.setCurrentPositionToZero()

setCurrentPositionToZero() -> int
Description

Set the current position of the NCoder to zero.

Returns
DatatypeDescription
intReturn status

NCoder.setEncoderDirection()

setEncoderDirection(direction: int) -> int
Description

Set the encoder direction for the NCoder.

Parameters
DatatypeVariableDescription
intdirectionEncoder direction to be set (0 for normal, 1 for inverted)
Returns
DatatypeDescription
intReturn status

NCoder.setFilterWindowLength()

setFilterWindowLength(filter_window_length: int) -> int
Description

Set the filter window length for the NCoder.

Parameters
DatatypeVariableDescription
intfilter_window_lengthFilter window length value to be set
Returns
DatatypeDescription
intReturn status

NCoder.setLinearCount()

setLinearCount(count: int) -> int
Description

Set the linear count for the NCoder.

Parameters
DatatypeVariableDescription
intcountLinear count value to be set
Returns
DatatypeDescription
intReturn status

NCoder.setMAxxxSPIRegister()

setMAxxxSPIRegister(register_address: int, data: int) -> int
Description

Set the maxxx encoder spi register.

Parameters
DatatypeVariableDescription
intregister_addressregister_addres value to be which needs to be modified
intdata-
Returns
DatatypeDescription
intTuple 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
DatatypeVariableDescription
intidDevice ID of the NCoder
Returns
DatatypeDescription
intReturn Status

NCoder.setScalingFactor()

setScalingFactor(scaling_factor: float) -> int
Description

Set the scaling factor for the NCoder.

Parameters
DatatypeVariableDescription
floatscaling_factorScaling factor value to be set
Returns
DatatypeDescription
intReturn status
  NMotionTM  is a sub-brand of Nawe Robotics
Copyright © 2025 Nawe Robotics Private Limited