Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Stuck stuck stuck :(

Hitec robotics including ROBONOVA humanoid, HSR-8498HB servos, MR C-3024 Controllers and RoboBasic
9 postsPage 1 of 1
9 postsPage 1 of 1

Stuck stuck stuck :(

Post by roboTT » Sun Mar 30, 2008 12:45 am

Post by roboTT
Sun Mar 30, 2008 12:45 am

Guys,

i am trying to do the following thing with the Robonova:

- Set servo.3 position to 140, Sleep(1ms)
- Constantly check the actual position, to be aware when the servo reached requested value of 140.

But i see that there is no chance to do above, as continous reading from AD(5) kills the servo movement..


Anyone here who does the Robonova control using his own code rather than Basic ?



[pseudocode]

SerialPutc(hCom,0xE6);//move servo
SerialPutc(hCom,3);//ktore serwo
SerialPutc(hCom,140);//position

while(SERVO3!=140){

//retrieve servo pos
SerialPutc(hCom,0xD2);//get servo
SerialPutc(hCom,3);//which serwo
SerialPutc(hCom,0x00);//NULL
}

printf("Work done!\n");



.... somewhere in separate thread...

//receive data from the com port
//analyze the received byte, and switch:
case 0xffffffd2: //servo position

SERVO3=byte2;

break;

[/pseudocode]


Seems like MR-C3024 cannot work this way, anyone knows any timings for this CPU ? Or any additional helpful specifications?

i want to code the RN-1 with C, almost made it - but this is a hard thing to approach, as i won't be able to continously monitor the servo positions during controlled/stabilized walk/standup poses...


Thanks v.much for any info!
Guys,

i am trying to do the following thing with the Robonova:

- Set servo.3 position to 140, Sleep(1ms)
- Constantly check the actual position, to be aware when the servo reached requested value of 140.

But i see that there is no chance to do above, as continous reading from AD(5) kills the servo movement..


Anyone here who does the Robonova control using his own code rather than Basic ?



[pseudocode]

SerialPutc(hCom,0xE6);//move servo
SerialPutc(hCom,3);//ktore serwo
SerialPutc(hCom,140);//position

while(SERVO3!=140){

//retrieve servo pos
SerialPutc(hCom,0xD2);//get servo
SerialPutc(hCom,3);//which serwo
SerialPutc(hCom,0x00);//NULL
}

printf("Work done!\n");



.... somewhere in separate thread...

//receive data from the com port
//analyze the received byte, and switch:
case 0xffffffd2: //servo position

SERVO3=byte2;

break;

[/pseudocode]


Seems like MR-C3024 cannot work this way, anyone knows any timings for this CPU ? Or any additional helpful specifications?

i want to code the RN-1 with C, almost made it - but this is a hard thing to approach, as i won't be able to continously monitor the servo positions during controlled/stabilized walk/standup poses...


Thanks v.much for any info!
roboTT
Savvy Roboteer
Savvy Roboteer
Posts: 62
Joined: Mon Mar 10, 2008 10:06 am

Post by i-Bot » Sun Mar 30, 2008 10:25 am

Post by i-Bot
Sun Mar 30, 2008 10:25 am

Reading the actual position of a servo is disruptive to the servo, and to all the other servos.
Unless the servo is under heavy load, and is moving at a controlled speed, then you can usually assume the position is where the controller has put it. This means you just need to check the C3024, not the servo. By controlled speed, I mean a speed where the C3024 is controlling the speed, and the speed is not limited by the physical servo. This is any normal speed, but if you use high speed, then does not apply above about speed 6.
You do not say if you use MOVE or SERVO. Using WAIT after MOVE will wait for the move to be complete.

You can PEEK locations in the memory to determine if any servo is still moving, also you can PEEK the current position of the SERVO sent from the C3024. The current position will be seen to change as the servo moves, since the controller moves it in a sequence of steps to control the speed. There are discussions on this in other threads here. I also posted some information here:
http://www.lynxmotion.net/viewtopic.php?t=3414

For the serial control it is possible, but fairly slow. Look at the posts here from PeterQ, who has it working from MATLAB.

The serial interface works in the exchange of bytes, so you should really wait for a character back before sending the next one. There are only 3 characters of buffer in the C3024. This make long commands slow, especially when using USB and windows.

Again you would not use command D2, but read the C3024 memory.
Reading the actual position of a servo is disruptive to the servo, and to all the other servos.
Unless the servo is under heavy load, and is moving at a controlled speed, then you can usually assume the position is where the controller has put it. This means you just need to check the C3024, not the servo. By controlled speed, I mean a speed where the C3024 is controlling the speed, and the speed is not limited by the physical servo. This is any normal speed, but if you use high speed, then does not apply above about speed 6.
You do not say if you use MOVE or SERVO. Using WAIT after MOVE will wait for the move to be complete.

You can PEEK locations in the memory to determine if any servo is still moving, also you can PEEK the current position of the SERVO sent from the C3024. The current position will be seen to change as the servo moves, since the controller moves it in a sequence of steps to control the speed. There are discussions on this in other threads here. I also posted some information here:
http://www.lynxmotion.net/viewtopic.php?t=3414

For the serial control it is possible, but fairly slow. Look at the posts here from PeterQ, who has it working from MATLAB.

The serial interface works in the exchange of bytes, so you should really wait for a character back before sending the next one. There are only 3 characters of buffer in the C3024. This make long commands slow, especially when using USB and windows.

Again you would not use command D2, but read the C3024 memory.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by roboTT » Sun Mar 30, 2008 2:40 pm

Post by roboTT
Sun Mar 30, 2008 2:40 pm

Massive thanks for the update,
i'll look into this deeper tonight and come back with some pseudocode for the others who would like to perform readings without disrupting the servos.

Thanks again!
Massive thanks for the update,
i'll look into this deeper tonight and come back with some pseudocode for the others who would like to perform readings without disrupting the servos.

Thanks again!
roboTT
Savvy Roboteer
Savvy Roboteer
Posts: 62
Joined: Mon Mar 10, 2008 10:06 am

Post by roboTT » Sun Mar 30, 2008 3:19 pm

Post by roboTT
Sun Mar 30, 2008 3:19 pm

Ah i did that faster than i thoud.
So here are my results and some piece of code.

A separate thread in my application is responsible for receiving continously the data from the RN Board.

It goes this way:

Code: Select all
THREAD{

while(1){
op=0;

switch(SerialGetc(hCom)){


//0x0F7 - READ_DATA memory
case 0xfffffff7:
 printf("Data read: %x %x value %x\n",SerialGetc(hCom),SerialGetc(hCom),SerialGetc(hCom));
break;

}


//PEEK the memory location at 0x320 every 100mseconds
//The current positions are stored in 24 memory locations from &H320

if(mseconds>100){
SerialPutc(hCom,0xF7);
SerialPutc(hCom,320);
SerialPutc(hCom,1);
SerialPutc(hCom,0x00);
}

}



So the function retrieves the data from COM port all the time, when it gets a byte, it checks the value. If it is a 0xF7 type - it means (according to the PDF file called: Hitec MR-C3024 to PC protocol for robonova ) - that we have a Read memory bounceback.



I enable the servo number 0, set the speed to 0, and perform a move from location 0x0A to 140.

During that time, i PEEK the memory location every 100mseconds.


Now, what i receive is:


Byte1=0xfffffff7 //which is good, we have a memory read
Byte2=a
Byte3=1
Byte4=20


Now the thing varies, often i receive Byte2 and Byte3 as 0 .



Do get it right ? I perform the 0xf7 command as the following:

Byte1=0xf7
Byte2=0x320 //servo 0 position
Byte3=1 //1 byte to read
Byte4=0x00 //null

Am i doing something wrong ?
Ah i did that faster than i thoud.
So here are my results and some piece of code.

A separate thread in my application is responsible for receiving continously the data from the RN Board.

It goes this way:

Code: Select all
THREAD{

while(1){
op=0;

switch(SerialGetc(hCom)){


//0x0F7 - READ_DATA memory
case 0xfffffff7:
 printf("Data read: %x %x value %x\n",SerialGetc(hCom),SerialGetc(hCom),SerialGetc(hCom));
break;

}


//PEEK the memory location at 0x320 every 100mseconds
//The current positions are stored in 24 memory locations from &H320

if(mseconds>100){
SerialPutc(hCom,0xF7);
SerialPutc(hCom,320);
SerialPutc(hCom,1);
SerialPutc(hCom,0x00);
}

}



So the function retrieves the data from COM port all the time, when it gets a byte, it checks the value. If it is a 0xF7 type - it means (according to the PDF file called: Hitec MR-C3024 to PC protocol for robonova ) - that we have a Read memory bounceback.



I enable the servo number 0, set the speed to 0, and perform a move from location 0x0A to 140.

During that time, i PEEK the memory location every 100mseconds.


Now, what i receive is:


Byte1=0xfffffff7 //which is good, we have a memory read
Byte2=a
Byte3=1
Byte4=20


Now the thing varies, often i receive Byte2 and Byte3 as 0 .



Do get it right ? I perform the 0xf7 command as the following:

Byte1=0xf7
Byte2=0x320 //servo 0 position
Byte3=1 //1 byte to read
Byte4=0x00 //null

Am i doing something wrong ?
roboTT
Savvy Roboteer
Savvy Roboteer
Posts: 62
Joined: Mon Mar 10, 2008 10:06 am

Post by i-Bot » Sun Mar 30, 2008 3:49 pm

Post by i-Bot
Sun Mar 30, 2008 3:49 pm

The correct format of the F& command is:
TX Byte 1 = 0xF7
RX Byte 1 = 0xF7
TX Byte 2 = Low address byte
RX Byte 2 = Low address byte
TX Byte 3 = high address byte
RX Byte 3 = high address byte
TX Byte 4 = 0x00
RX Byte4 = contents of address

The code in the C3024 is actually getting a char at a time and echoing. This is how the C3024 stops too much data coming in. You are meant to wait for the RX response byte before sending the next TX byte. The serial port is not on interrupt, and there are some slow things going on which are on interrupt. The UART receiver on the AtMega does have some buffer (2 bytes + the RX register), so you can use this if you are clever and careful. In your example the four putc in a row could overrun the buffers.
The correct format of the F& command is:
TX Byte 1 = 0xF7
RX Byte 1 = 0xF7
TX Byte 2 = Low address byte
RX Byte 2 = Low address byte
TX Byte 3 = high address byte
RX Byte 3 = high address byte
TX Byte 4 = 0x00
RX Byte4 = contents of address

The code in the C3024 is actually getting a char at a time and echoing. This is how the C3024 stops too much data coming in. You are meant to wait for the RX response byte before sending the next TX byte. The serial port is not on interrupt, and there are some slow things going on which are on interrupt. The UART receiver on the AtMega does have some buffer (2 bytes + the RX register), so you can use this if you are clever and careful. In your example the four putc in a row could overrun the buffers.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by roboTT » Mon Mar 31, 2008 1:47 am

Post by roboTT
Mon Mar 31, 2008 1:47 am

Thank you very much for the replies..

Now i need to rewrite that all..
Thank you very much for the replies..

Now i need to rewrite that all..
roboTT
Savvy Roboteer
Savvy Roboteer
Posts: 62
Joined: Mon Mar 10, 2008 10:06 am

Post by roboTT » Mon Mar 31, 2008 5:02 am

Post by roboTT
Mon Mar 31, 2008 5:02 am

i-Bot, what are those:

- low address byte
- high address byte

?
i-Bot, what are those:

- low address byte
- high address byte

?
roboTT
Savvy Roboteer
Savvy Roboteer
Posts: 62
Joined: Mon Mar 10, 2008 10:06 am

Post by i-Bot » Mon Mar 31, 2008 8:42 am

Post by i-Bot
Mon Mar 31, 2008 8:42 am

The F7 command is the read RAM memory command.

The address you want to read is split into two bytes low and high.

In the example you gave, you sent the byte 0x320, but obviously the number won't fit into a single byte. 0x20 is sent first, then 0x03.
The F7 command is the read RAM memory command.

The address you want to read is split into two bytes low and high.

In the example you gave, you sent the byte 0x320, but obviously the number won't fit into a single byte. 0x20 is sent first, then 0x03.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by roboTT » Mon Mar 31, 2008 7:50 pm

Post by roboTT
Mon Mar 31, 2008 7:50 pm

Great,
thank you for the help i-Bot.

..


I have it working now, perfect!

Thanks for your help!
Great,
thank you for the help i-Bot.

..


I have it working now, perfect!

Thanks for your help!
roboTT
Savvy Roboteer
Savvy Roboteer
Posts: 62
Joined: Mon Mar 10, 2008 10:06 am


9 postsPage 1 of 1
9 postsPage 1 of 1