Cmd: Constants Settings
updated on 06-11-2009

dsNav communication

Detailed commands description
Navigation read group commands

Commands (Cmd field) are one single character long and case sensitive.           

In following list:

- r        this is a command that request parameters reading from dsNav to the master

- w       this is a command that writes parameters to dsNav from the master

- TX    these are the parameters sent from supervisor and received by dsNav

- RX    these are the data sent back by dsNav after a correct decoding of the command and received by external board or PC.

The TxData and RxData procedures will be used as example. The code examples are written in Processing language on the PC side.

A

- r

All mean parameters request:

Data

0 – 1  Vmean: mean speed. The speed of the robot obtained averaging the speed of the two wheels

2 – 3  Ctotal: the sum of the current used by both motors

4 – 5  PosX,

6 – 7  PosY: the position of the robot as the X, Y coordinates estimated by dsNav by odometry

8 – 9 Theta: orientation angle of the robot in its own reference system

10     IdlePerc: idle time of the MCU on dsNav in percentage: work load of the processor

            - TX:

                        CmdLen = 1 Params 0

Example:

TxData(0, ÔAÕ, 0, 3);

            - RX:

                        CmdLen = 12  Params 11       (5 int = 10 byte. Most Significant First + 1 byte)

Example:

if (RxData(ÔAÕ,13))

{

 MesSpeed = ((RxBuff[HeadLen] << 8(RxBuff[HeadLen+1]));

 Current = (float)((RxBuff[HeadLen+2] << 8) + (RxBuff[HeadLen+3]));

 Xpos = ((RxBuff[HeadLen+4] << 8) + (RxBuff[HeadLen+5]));

 Ypos = ((RxBuff[HeadLen+6] << 8) + (RxBuff[HeadLen+7]));

 MesAngle = ((RxBuff[HeadLen+8] << 8) + (RxBuff[HeadLen+9]));

 CompassAngle = ((RxBuff[HeadLen+10] << 8) + (RxBuff[HeadLen+11])) / 10;

 IdlePerc = RxBuff[HeadLen+10];

}  

 

a

- r

All detailed parameters request:

Data

0 – 1    Vr: the speed of the right wheel

2 – 3    Vl: the speed of the left wheel

4 – 5    Cr: the current used by right motor

6 – 7    Cl: the current used by the left motor

8 – 9    PulseR: the encoder pulses counted by right encoder since last measure

10 – 11 PulseL: the encoder pulses counted by left encoder since last measure

            - TX:

                        CmdLen = 1 Params 0

Example:

TxData(0, ÔaÕ, 0, 3);

            - RX:

                        CmdLen = 13  Params 12       (6 int Most Significant First)

Example:

if (RxData(ÔaÕ,12))

{

 SpeedR = (((RxBuff[HeadLen] << 8) + (RxBuff[HeadLen+1])));

 SpeedL = (((RxBuff[HeadLen+2] << 8) + (RxBuff[HeadLen+3])));

 CurrentR = (float)((RxBuff[HeadLen+4] << 8) + (RxBuff[HeadLen+5]));    

 CurrentL = (float)((RxBuff[HeadLen+6] << 8) + (RxBuff[HeadLen+7]));

 PulseR = (((RxBuff[HeadLen+8] << 8) + (RxBuff[HeadLen+9])));

 PulseL = (((RxBuff[HeadLen+10] << 8) + (RxBuff[HeadLen+11])));

}