Skip to content

Indy Tools

IndySDK provides several tools to help users take advantage of filters, filtered derivative, and shared memory. This allows users to easily configure their own low-level robot controller.

Filters

Several types of filters can be used by adding libraries of Util/Filter.h. They are defined in the namespace called NRMKFoundation.

[::Filter]

  • Filter class is a parent class of LowPassFilter, FilteredDerivative, FilterLeadLag, and FilterMovingAverage classes.
  • Filter class includes "filter" and "setTransferFunction".

NRMKFoundation::Filter::filter (refine the signal)

1
void filter(Type const & raw, Type & filtered);

Parameters:

  • raw: Raw signal to be filtered.
  • filtered: Filtered signal.

NRMKFoundation::Filter::setTransferFunction (set the type of the filter)

1
void setTransferFunction(CoeffVec const & den, CoeffVec const & num)

Parameters:

  • den: Denominator polynomial coefficients (i.e., den[0] + den[1]*(1/z) + den[2]*(1/z^2)...).
  • num: Numerator polynominal coefficients (i.e., num[0] + num[1]*(1/z) + num[2]*(1/z^2)...).

[::LowPassFilter]

1
2
3
4
5
template<typename _Type = double>
class FilterLowPass : public Filter<1, _Type>
{
  ...
};

NRMKFoundation::LowpassFilter::setParam

  • Lowpass filter implementing \begin{align} \frac{w}{s+w}, \end{align} where w is the cutoff frequency of lowpass filter.
1
void setParam(double sampFreq, double cutOffFreq);

Parameters:

  • sampFreq: Sampling frequency of the control system.
  • cutOffFreq: Cutoff frequency of the lowpass filter.

[::FilteredDerivative]

1
2
3
4
5
template<typename _Type = double>
class FilterDerivative : public Filter<1, _Type>
{
  ...
};

NRMKFoundation::FilteredDerivative::setParam

  • Derivative filter implementing \begin{align} \frac{w s}{s+w}, \end{align} where w is the cutoff frequency of the filter.
1
void setParam(double sampFreq, double cutOffFreq);

Parameters:

  • sampFreq: Sampling frequency of the control system.
  • cutOffFreq: Cutoff frequency of the filter.

[::FilterLeadLag]

1
2
3
4
5
template<typename _Type = double>
class FilterLeadLag : public Filter<2, _Type>
{
  ...
};

NRMKFoundation::FilterLeadLag::setParam

  • lead-lag filter implementing \begin{align} \frac{(w_2 w_3/w_1)(s+w_1)}{(s+w_2)(s+w_3)}, \end{align} where \begin{align} w_1 = 2 \pi f_1, \quad w_2=2 \pi f_2, \quad\text{and}\quad w_3 = 2 \pi f_3. \end{align}
1
void setParam(double sampFreq, double f1, double f2, double f3);

Parameters:

  • sampFreq: Sampling frequency of control system.
  • f1, f2, f3: Filtering frequencies defined above.

[::FilterMovingAverage]

1
2
3
4
5
template<int _SIZE, typename _Type = double>
class FilterMovingAverage : public Filter<_SIZE - 1, _Type>
{
  ...
};

NRMKFoundation::FilterLeadLag::FilterMovingAverage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
FilterMovingAverage()
{
  _b[0] = 1.0/_SIZE;

  for (int i = 1; i <= _SIZE; i++)
  {
    _a[i] = 0;
    _b[i] = _b[0];
  }
}

Parameters:

  • _a, _b: Denominator and nominator polynominal coefficients, respectively.

Shared Memory

Users can access shared memories using NRMKFramework::ShmemManager class. Adding libraries and data structures defined in NRMKFramework/Indy/Sharedmemory/SharedData.h allows to handle robot data via shared memory. The data structures are defined in namespace called NRMKIndy::SharedData. For more details, refer to Shared Memory chapter.

[::ShmemManager]

NRMKFramework::ShmemManager::readMemory

  • Copy a certain size of shared memory (starting from a specific address) to the memory indicated by the pointer (ptrData).
1
bool readMemory(uint32_t address, uint32_t size, void * ptrData)

NRMKFramework::ShmemManager::writeMemory

  • Copy a certain size of memory indicated by the point (ptrData) to the shared memory (starting from a specific address).
1
bool writeMemory(uint32_t address, uint32_t size, void const * ptrData)

NRMKFramework::ShmemManager::getPtr

  • Return the void-type pointer which indicates the absolute address of the relative address defined for a certain data.
1
void * getPtr(uint32_t address)

NRMKFramework::ShmemManager::getPtrObjByAddr

  • Return T-type pointer which indicates the absolute address of the relative address defined for a certain data.
1
2
3
4
5
template <typename T>
T * getPtrObjByAddr(uint32_t address)

template <typename T>
inline T const * getPtrObjByAddr (uint32_t address) const

NRMKFramework::ShmemManager::getRefObjByAddr

  • Copy the value pointed to by the pointer to a variable defined by reference.
1
2
3
4
5
template <typename T>
inline T & getRefObjByAddr(uint32_t address)

template <typename T>
inline T const & getRefObjByAddr (uint32_t address) const

NRMKFramework::ShmemManager::resetMemory

  • Set all data stored in the shared memory to zero.
1
void resetMemory()

[::SharedData]

The data structures which can be processed through shared memory are given like follows. For mroe details, refer to Shared Memory chapter.

  • RobotRTSharedData: Real-time robot data and EtherCAT information.
  • RobotControlSharedData: Robot's state variable (e.g., position, velocity, and torque).
  • RobotStateSharedData: State information of robot software program.
  • RobotControlStatusSharedData: Robot's control status.
  • RobotConfigSharedData: Robot's setting value.
  • RobotEmergencySharedData: Recent robot error data.
  • SmartDIOSharedData: Digital I/O data of control box (CB).
  • SmartAIOSharedData: Analog I/O data of control box (CB).
  • EndToolDOSharedData: EndTool digital output data.
  • ExtraIOData: (Robotous) F/T sensor data provided from CAN port in control box (CB).

Data transmission and acquisition libraries are given as follows:

NRMKIndy::SharedData::getDataFunction

1
2
3
void getDataFunction(NRMKFramework::ShmemManager & indyShm, DataType & Data)

DataType getDataFunction(NRMKFramework::ShmemManager & indyShm)

Parameters:

  • getDataFunction: General expression of a certain function used for data acquisition (e.g., getControlData: get an object containing the data structure for robot state variables, getSmartAIO: get an object containing the data structure for analog I/O port in CB.
  • DataType: General expression of a certain data structure defined in "ShredData.h".

NRMKIndy::SharedData::getPtrDataFunction

1
2
void getPtrDataFunction(NRMKFramework::ShmemManager & indyShm,
                        DataType ** ptrEndtoolDo)

Parameters:

  • getPtrDataFunction: General expression of a certain function used for data acquisition (e.g., getPtrSmartAIO, getPtrSmartDIO).
  • DataType: General expression of a certain data structure defined in "SharedData.h"; a pointer variable of DataType is used as input, the function returns the address of the shared memory associated with the data.

NRMKIndy::SharedData::setSmartDO

1
2
3
void setSmartDO(NRMKFramework::ShmemManager & indyShm, int doNum, bool doVal)

void setSmartDO(NRMKFramework::ShmemManager & indyShm, const bool * smartDO)

Parameters:

  • doNum: Digital output port number.
  • doVal: Digital output value (true or false is set).
  • smartDO: Memory address representing the digital output values of 8 ports.

NRMKIndy::SharedData::setSmartAO

1
void setSmartAO(NRMKFramework::ShmemManager & indyShm, int aoNum, uint16_t aoVal)

Parameters:

  • aoNum: Analog output port number.
  • aoVal: Analog output value.