Iāve been working with Xan on the phoenix. We were trying to make the robot be able to play canned routines from the SSC-32ās EEPROM. The code works⦠on IDE v8.0.1.7. Using IDE v8.0.1.11 or Studio (tried with 1.0.0.11 and 1.0.0.15) caused the robot not to be able to read information from the SSC-32. So there seems to be a problem with the serin command. At least, thatās what it seems to be.
I was using the phoenix 2.0 code. Let me know if you need any additional information.
Little more info. Xanās code asks the SSC-32 for itās revision number before it will send the commands to start the GP player. For some reason in studio it does not read this reply properly. By removing the firmware version request it works.
Sort of. It runs into problems when trying to leave the GP mode. Since the BAP doesnāt get any feedback that the sequence is done, the bot canāt be stopped because certain controls are enabled during GP play.
I would have brought that up before, but I kind of⦠forgot.
However I extracted the code into a test program and think the timout is the problem:
Here is a simple test program that both displays the whole string, plus says if it is valid or not:
[code];[SERIAL CONNECTIONS]
cSSC_OUT con P11 ;Output pin for (SSC32 RX) on BotBoard (Yellow)
cSSC_IN con P10 ;Input pin for (SSC32 TX) on BotBoard (Blue)
cSSC_BAUD con i38400 ;SSC32 BAUD rate
szTemp var byte(20) ; temporary
GPVerData var byte(3) ;Received data to check the SSC Version
Index var byte ;Index universal used
; First lets try to print out the version
serout cSSC_OUT, cSSC_BAUD, "ver", 13]
serin cSSC_IN, cSSC_BAUD, 10000, TO_GET, [str szTemp\20\13]
serout s_out, i9600, "SSC Version: ", str szTemp\20\13, 13]
TO_GET:
; Like Xans code
index = 0
serout cSSC_OUT, cSSC_BAUD, "ver", 13]
GetSSCVersion:
serin cSSC_IN, cSSC_BAUD, 10000, timeout, [GPVerData(Index)]
Index = (Index+1)//3 ; shift last 3 chars in data
goto GetSSCVersion
timeout:
if (GPVerData(0) + GPVerData(1) + GPVerData(2)) = 164 then ; Check if the last 3 chars are G(71) P(80) cr(13)
serout s_out, i9600, āGP player validā, 13]
else
serout s_out, i9600, āGP player NOT validā, dec (GPVerData(0) + GPVerData(1) + GPVerData(2)), 13]
endif
pause 2000
goto main
end[/code]
For my old and crusty one I see:
SSC Version: SSC32-V2.04GP
GP player valid
SSC Version: SSC32-V2.04GP
GP player valid
For my new shiny one from the Free giveaway, I see:
SSC Version: SSC32-V2.03XE
GP player NOT valid170
SSC Version: SSC32-V2.03XE
GP player NOT valid170
SSC Version: SSC32-V2.03XE
GP player NOT valid170
P.S - I assume that you do have both TX and RX wires going to the SSC-32
I have not used this code much as I am not very good at creating these sequences
It looks to me that once you start a sequence, the code does not return to the main loop, until the sequence is completed. I will try to summarize this. If you look in phoenix_v20.bas a little after the label main: you will see the code:
;GP Player
IF GPEnable THEN
GOSUB GPPlayer
ENDIF
If you look at GPPlayer
[code];--------------------------------------------------------------------
;[GP PLAYER]
GPStatSeq var byte
GPStatFromStep var byte
GPStatToStep var byte
GPStatTime var byte
GPPlayer:
;Start sequence
IF (GPStart=1) THEN
serout cSSC_OUT, cSSC_BAUD, āPL0SQā, dec GPSeq, āONCEā, 13] ;Start sequence
IF (GPStatSeq<>255 | GPStatFromStep<>0 | GPStatToStep<>0 | GPStatTime<>0) THEN
GOTO GPWait ;Continue waiting
ENDIF
GPStart=0
ENDIF
return
[/code]
To me it looks like it will hang up in this loop until it completes. So you wonāt have any more input possible from the PS2 or DIY remote⦠until it completes. To me it looks like it would be easy to change this to allow input to be processed. For example could change the code to look more like:
[code];--------------------------------------------------------------------
GPStart var byte; was bit
;[GP PLAYER]
GPStatSeq var byte
GPStatFromStep var byte
GPStatToStep var byte
GPStatTime var byte
GPPlayer:
;Start sequence
IF (GPStart=1) THEN
serout cSSC_OUT, cSSC_BAUD, āPL0SQā, dec GPSeq, āONCEā, 13] ;Start sequence
GPStart=2 ; set the state to do queryā¦
ELSEIF (GPStart=2)
;See if GPPlayer has completed sequence
serout cSSC_OUT, cSSC_BAUD, āQPL0ā, 13]
serin cSSC_IN, cSSC_BAUD, [GPStatSeq, GPStatFromStep, GPStatToStep, GPStatTime]
IF (GPStatSeq=255) and (GPStatFromStep=0) and (GPStatToStep=0) and (GPStatTime=0) THEN
GPStart=0
ENDIF
ELSEIF GPStart=0xff
; user requested us to abort the sequence.
serout cSSC_OUT, cSSC_BAUD, āPL0ā, 13] ;Stop the sequence now
GPStart = 0
ENDIF
return
[/code]
Now in the main code might change it like:
;GP Player
IF GPEnable THEN
GOSUB GPPlayer
IF GPStart <> 0 THEN Main
ENDIF
I would also probably change the PS2 code that processed the button to start the sequence to maybe something like:
IF (DualShock(2).bit1 = 0) and LastButton(1).bit1 THEN ;R2 Button test
IF GPStart = 0 THEN ; See if we are running a sequence
GPStart=1 ; Nope then try to start it.
ELSE
GPStart = 0xff ; Yes - cancel it.
ENDIF
ENDIF
Now I did this on the fly here so there are probably some major problems here. Probably should run it by Xan and move to different threadā¦
Ok that fixed the not going into GP player mode. But it begs the question why would the timeout value that worked in 8.0.1.7 not work in Studio.
But it still does not recover from playing the sequence. It appears to read the query and the program waits till the sequence is finished before accepting other commands, and you can play a stored sequence several times over and over, but⦠When you press X to go back to walking mode it immediately runs to the left at high speed and ignores the PS2 forever till reset.
James and I have followed the program fairly well, but having the PS2 stuff in a separate file is blowing my mind. lol
The code may have been right on the fringe of the timings before. But just a heads up Nathan and Dale are in the process of going through the commands and trying to converge the Atom and the Atom Pro code and maybe change the timings of different commands back to milliseconds instead of .5 microseconds. Note sure about all the details yet. You can follow along up on the thread: forums.basicmicro.net/viewtopic. ⦠c41617f43b
As for the hitting the cross button to go back to walk mode, I am not very sure how all of this is supposed to work as even though you are in GPPlayer mode it still walks through the single leg code, plus the Gait code, Body and Leg IK and call the servodriver.
So maybe some variable is being updated in the loop that is not processed until you are back in WALKMODE. Donāt have any sequences to try with, but will see what happens when I try to run a non-existing one. Also may be different as I will do with Xbeeā¦
Hi Jim, I was trying to debug some of my hacked up code that runs sequences when I am not using standard serin to talk to the SSC-32. I found some bugs in my code, which I will post up for Zenta in a bitā¦
IF (GPStatSeq<>255 | GPStatFromStep<>0 | GPStatToStep<>0 | GPStatTime<>0) THEN
GOTO GPWait ;Continue waiting
ENDIF
GPStart=0
[/code]
for lets say GPSeq=2 and I donāt have any sequences defined, I found that the Serin to get the state timed out and the SSC-32 would not talk to me anymore. I had to power cycle the SSC-32.
So I am wondering where your running to one side problem is. I donāt think the SSC-32 is hung as I assume legs⦠If it were me, I would put some debug messages in the code. I would for example print out the values in ServoDriver. Here I would put in the extra debug code that only prints the values when one of them changes as to not get burried in messages.
Likewise I would output debug information coming out of the control input, like: TravelLengthX, TravelLengthZ, TravelRotationY, BodyPosX, BodyPosZ, BodyRotY, BodyYShift
I might add more in later depending on what I see or donāt see, like what values are calculated in the gait codeā¦
There has been a new beta release of Studio. Here is a quote from Nathan on the Basic Micro website:
I only started playing with this new release last night so my summary is probably incomplete. There are pluses and minuses of going to this new release.
Pluses:
Tooltips: When you type in something like: hservo, the editor will put up a tip showing the syntax of the command.
SLONG: Works again
Some fixes for HPWM for BAP-1M
???
(Those not interested in C - Skip this part)
C Compiler: It works again. He also has valid register definitions for the different Atom Pros. The register definitions are slightly more structured than before, but not as much as the files you can download from Renesas. You still have to know which bit is which in a register whereas the Renesas files you can use the bitnames (or mult-bit names) for the sub-parts of the registerā¦
Minuses:
Some of the keyboard things I normally use donāt work. This includes:
ctrl-f to do a find. - Can fix by setting it your self (View Menu-> Toolbars-> Customize)
F3 - Repeat Search (Have not found a way to get this to work yet)
BookMarks (Ctrl-1⦠Set, ALT-1⦠Jump to) - Donāt see any equivalents yetā¦
Right Click pop-up menu positions appear to be off.
Faults - If I build a multiple file project and it finds an error on a file that I donāt have open, and I double click on the error in the build status window. It opens the file, but when I click in the file, Studio Faultsā¦
Still have User Access Error screens every time I start studio on Windows 7.
Kurt, can you send a screen shot of the Win7 message? Is it a permissions warning? If you change to XP compatibility mode on the exe does it go away? I suspect it is something along this line. I still canāt reproduce this on my machines. Iām running Win7 64bit as my dev platform.
Eventually Iāll make more comprehensive register definitions. If anyone wants to help me with that feel free.
Update - I was receiving the UAE errors on only 1 machine with windows 7, but the portable that I installed Windows 7 and studio on was not. We figured out what the problem was and how to get rid of them. Hopefully no one else will have this problem. It was probably related to when I originally installed each⦠But if you have this problem, go to the directory where studio is installed. Do a properties on BasicMicroStudio.exe and go to the compatibility page. If the Run this program in compatibility mode for ⦠item is checked unchecked it.
Also do the same for HBasic32.exe which is installed in the same directory.
Most if not all of the minus that I mentioned for 18 were fixed. (ctrl+f defined, F3 ā¦). The pop-up menu has been fixed
Some more information from Nathan: