src/libYARP_dev/esdcan/linux/yarp/YARPEsdCanDeviceDriver.cpp
int YARPEsdCanDeviceDriver::setPid (void *cmd)
{
	SingleAxisParameters *tmp = (SingleAxisParameters *) cmd;
	const int axis = tmp->axis;
	ACE_ASSERT (axis >= 0 && axis <= (ESD_MAX_CARDS-1)*2);
	LowLevelPID *pid = (LowLevelPID *) tmp->parameters;

	_writeWord16 (CAN_SET_P_GAIN, axis, S_16(pid->KP));
	_writeWord16 (CAN_SET_D_GAIN, axis, S_16(pid->KD));
	_writeWord16 (CAN_SET_I_GAIN, axis, S_16(pid->KI));
	_writeWord16 (CAN_SET_ILIM_GAIN, axis, S_16(pid->I_LIMIT));
	_writeWord16 (CAN_SET_OFFSET, axis, S_16(pid->OFFSET));
	_writeWord16 (CAN_SET_SCALE, axis, S_16(pid->SHIFT));
	_writeWord16 (CAN_SET_TLIM, axis, S_16(pid->T_LIMIT));

	return YARP_OK;
}
/// cmd is a SingleAxis pointer with a LowLevelPID argument pointer
/// LATER: can be optimized.
cmd is a SingleAxis pointer with a LowLevelPID argument pointer
LATER: can be optimized.
cmd is a SingleAxis pointer with a LowLevelPID argument pointer LATER : can be optimized .
int YARPEsdCanDeviceDriver::setPid (void *cmd)
{
	SingleAxisParameters *tmp = (SingleAxisParameters *) cmd;
	const int axis = tmp->axis;
	ACE_ASSERT (axis >= 0 && axis <= (ESD_MAX_CARDS-1)*2);
	LowLevelPID *pid = (LowLevelPID *) tmp->parameters;
	_writeWord16 (CAN_SET_P_GAIN, axis, S_16(pid->KP));
	_writeWord16 (CAN_SET_D_GAIN, axis, S_16(pid->KD));
	_writeWord16 (CAN_SET_I_GAIN, axis, S_16(pid->KI));
	_writeWord16 (CAN_SET_ILIM_GAIN, axis, S_16(pid->I_LIMIT));
	_writeWord16 (CAN_SET_OFFSET, axis, S_16(pid->OFFSET));
	_writeWord16 (CAN_SET_SCALE, axis, S_16(pid->SHIFT));
	_writeWord16 (CAN_SET_TLIM, axis, S_16(pid->T_LIMIT));
	return YARP_OK;
}
int YARPEsdCanDeviceDriver :: setPid ( void * cmd ) { SingleAxisParameters * tmp = ( SingleAxisParameters * ) cmd ; const int axis = tmp -> axis ; ACE_ASSERT ( axis >= 0 && axis <= ( ESD_MAX_CARDS - 1 ) * 2 ) ; LowLevelPID * pid = ( LowLevelPID * ) tmp -> parameters ; _writeWord16 ( CAN_SET_P_GAIN , axis , S_16 ( pid -> KP ) ) ; _writeWord16 ( CAN_SET_D_GAIN , axis , S_16 ( pid -> KD ) ) ; _writeWord16 ( CAN_SET_I_GAIN , axis , S_16 ( pid -> KI ) ) ; _writeWord16 ( CAN_SET_ILIM_GAIN , axis , S_16 ( pid -> I_LIMIT ) ) ; _writeWord16 ( CAN_SET_OFFSET , axis , S_16 ( pid -> OFFSET ) ) ; _writeWord16 ( CAN_SET_SCALE , axis , S_16 ( pid -> SHIFT ) ) ; _writeWord16 ( CAN_SET_TLIM , axis , S_16 ( pid -> T_LIMIT ) ) ; return YARP_OK ; }
cmd is a SingleAxis pointer with a LowLevelPID argument pointer
LATER: can be optimized.
cmd is a SingleAxis pointer with a LowLevelPID argument pointer LATER : can be optimized .