|
Re: Black Jaguar RS232->CAN - anyone?
Guys,
I'm attempting to add all the commands for speed and position using woodk's code below and ran into something interesting. If you look at Get() in CANJaguar.cpp:
float CANJaguar::Get()
{
UINT32 messageID;
UINT8 dataBuffer[8];
UINT8 dataSize;
INT32 replyValue32;
switch(m_controlMode)
{
case kPercentVoltage:
messageID = LM_API_VOLT_SET | m_deviceNumber;
// Sending set with no data is a request for the last set
...
The Get() method uses the LM_API_VOLT_SET API definition, but the Set() method uses the LM_API_VOLT_T_SET which is the FIRST trusted message version (I think). Does anyone know why this might be? Or does anyone know if this returns a correct value? I only just set up the CAN stuff yesterday and haven't gotten knee deep into debugging yet...
In can_proto.h:
//************************************************** ***************************
//
// The Luminary Micro Motor Class Control Voltage API definitions.
//
//************************************************** ***************************
#define LM_API_VOLT (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
CAN_API_MC_VOLTAGE)
#define LM_API_VOLT_EN (LM_API_VOLT | (0 << CAN_MSGID_API_S))
#define LM_API_VOLT_DIS (LM_API_VOLT | (1 << CAN_MSGID_API_S))
#define LM_API_VOLT_SET (LM_API_VOLT | (2 << CAN_MSGID_API_S))
#define LM_API_VOLT_SET_RAMP (LM_API_VOLT | (3 << CAN_MSGID_API_S))
//##### FIRST BEGIN #####
#ifdef FIRST_FIRMWARE_VERSION
#define LM_API_VOLT_T_EN (LM_API_VOLT | (4 << CAN_MSGID_API_S))
#define LM_API_VOLT_T_SET (LM_API_VOLT | (5 << CAN_MSGID_API_S))
#endif // FIRST_FIRMWARE_VERSION
//##### FIRST END #####
- Bryce
P.S. Any thoughts on value used in the Position mode for Set() / Get()? In the GetPosition() declaration it states the return value as a float. Does this suggest that position is limited to only one revolution? Also, what data type would one pass to set the encoders?
__________________
The opulence of the front office decor varies inversely with the fundamental solvency of the firm.
Last edited by Bryscus : 22-01-2010 at 11:40.
|