I cannot post ??
Ok, i spent more than 20minutes writing a post here and then received an error when uploading the post to the board - that there is link posting not allowed for the ‘begginers’…
I cannot post ??
Ok, i spent more than 20minutes writing a post here and then received an error when uploading the post to the board - that there is link posting not allowed for the ‘begginers’…
I bought my RN-1 about a month-ago, from the beggining i have decided not to go with ROBOBASIC due to the fact that i want my RN1 to be controlled from PC ( transfering the brain / decisions / analysis to a laptop ).
RN1 then is to be used mainly for movement purposes, head rotation, and continous walking but also spawned from PC.
For that, i have coded an OpenGL application, that partially has controller board protocol implemented. This protocol can be obtained from robosavvy’s WIKI page. ( cannot post - board doe snot allow )
It describes byte per byte every (?) command that can be sent to RN-1 in order to wake this bot and let him live.
So for example - sending 0xF7 with parameters, lets you read the memory location in the mainboard of RN1, 0xE9 sets the speed of certain servo and 0xE2 reads a value from specified AD port - i am sure you guys are aware of this document. No need to speak of it too much, it is massive piece of good work.
So, as i wrote -
application renders robonova with current tilt/pan and is able to read continously the servo values, AD port values and perform SINGLE servo move - using 0xE6 command, that does move a single servo to desired position. It really works great!
But… as usual, problems appear when i am ready to code the full move sets like: “initial_position” or “forward_walk”, which in Robobasic are ready and copy/paste to use.
In general, initial_position is obtained by spawning MOVE24 or MOVEgroup
of servos - that immediately informs the servos to start moving at the same time, to requested position.
Above cannot be obtained by using the 0xE6 ( single servo move ) one by one, due to the fact that soone or later in 20 lines of moves, your servoes will be desynchronized and the move will be completed but with the overall delay.
To achieve that, i need to implement an instruction called SYNC MOVE - 0xEB which is described as:
The protocol PDF description says, that after sending this to RN Main Board, requestes servos will start to move at the same time to desired positions with PTP on.
Good, so i reached for Visual C++, and implemented above instruction as:
SerialPutc(hCom,0xeb);SerialGetc(hCom); //sync move
SerialPutc(hCom,0x01);SerialGetc(hCom); //ptp
SerialPutc(hCom,0x06);SerialGetc(hCom); //servo1
SerialPutc(hCom,0x01);SerialGetc(hCom); //to servo2
SerialPutc(hCom,0x64);SerialGetc(hCom); //to servo1 value
SerialPutc(hCom,0x64);SerialGetc(hCom); //to servo2 value
Ok:
SerialPutc - this function in my application sends 1 byte to opened Com port handle
SerialGetc - this function waits untill 1 byte is received.
The code is compiled with no errors, and i’ve sent 0xEB with above arguments to the board.
And here is the trouble, robonova does the move but to random positions and using random servoes… I have clearly stated in this command that i will move 0x06 servo and 0x07 servos to 0x64 position…
Spent two days on that with no result - i have installed serial port sniffer to checkout if i really transfer the data as required:
Snippet from serial port analysis:
All okay, all commands echoed back…
The standard thing i am having uploaded to RN-1 is the RBASIC code below:
PTP SETON
PTP ALLON
'== motor diretion setting ======================
DIR G6A,1,0,0,1,0,0
DIR G6B,1,1,1,1,1,1
DIR G6C,0,0,0,0,0,0
DIR G6D,0,1,1,0,1,0
'== motor start position read ===================
GETMOTORSET G6A,1,1,1,1,1,0
GETMOTORSET G6B,1,1,1,0,0,0
GETMOTORSET G6C,1,1,1,0,0,0
GETMOTORSET G6D,1,1,1,1,1,0
SPEED 5
MOTOR G24
If there is anyone that could help me out, or coded RN-1 using something different that RBASIC - i would really appreaciate any suggestion as now i am totally stuck with this bot ;((
Thank you very much for help.
Fixed.
Correct serial flow:
SerialPutc(hCom,0xEB);SerialGetc(hCom);//sync move
SerialPutc(hCom,0x06);SerialGetc(hCom);// start from servo no
SerialPutc(hCom,0x02);SerialGetc(hCom);// how many servoes ?
SerialPutc(hCom,0x64);SerialGetc(hCom);// servo1 pos
SerialPutc(hCom,0x64);SerialGetc(hCom);// servox pos
Seems like there is no PTP information at byte2.