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 |
2 | TYPE_INCREMENTAL | Using incremental Encoder (Tested) |
3 | TYPE_SPI_ABS_AMS | Using AS5047P absolute encoder from AMS (Tested) |
4 | TYPE_SPI_ABS_MAXXX | Using MAXXX series absolute encoders from Monolith Power Systems (Tested with MA732, MA702) |
5 | TYPE_SPI_ABS_MUXXX | Using MU series absolute encoders from iC-Haus (Tested with MU150, MU200) |
6 | TYPE_SPI_ABS_CUI | Using AMT 203 absolute encoder from CUI |
7 | TYPE_SPI_ABS_AEAT | Using AEAT absolute encoders from Broadcomm |
8 | TYPE_SPI_ABS_RLS | Using RLS absolute encoders from Renishaw |
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()