Problem BAP beta or Vista or?

You have to be real careful when you install multiple version of the IDE. You could end up with a mish mash of different versions of different files which could be explaining a lot of your problems. Note that 8.0.1.6Exp is for people to test there already working code on to see if the expiremental version of HSERVO in it works. If you code doesn’t work with 8.0.1.6 it is not going to work with 8.0.1.6Exp.

I also tested the brat code in the IRPD thread and everything worked as it was posted(remote and servos functioned as it should have).

I HIGHLY recommend you completely remove all versions of the AtomPro IDE. Then install just one version at a time until the problems you are seen have been correctly diagnosed.

P.S. I hate Install Shield but it’s pretty much the only game in town. :frowning:

You could install each IDE. After each is installed move all the files installed to the AtomPro IDE directory in the ProgramFiles folder somewere else(or just rename them appropriately). No files are installed anywere else so you don’t have to worry about that. You just want to make sure that other installs don’t install over top of each other leaving random versions of files. For some reason Install Shield(even those I set it to always overwrite older versions) still insists on sometimes leaving older files. Thats why I always recommend uninstall the old version before installing the new one.

In between each of these runs I did a complete uninstall of the Atom Pro IDE. I have 8.0.0.0 still up there as you used a completely different directory. (I also keep 8.0.0.0 around as HSERVO and serial output worked well on the earlier beta)

I do have the downloads for different versions in my download directory, so I can switch to different releases. I wish you had an option in your install/uninistall that would allow you to save your personal preferences. Things like history, comm settings and the like, but that is a different story.

I have sent you an email with a video of the brat trying to run the simple program earlier in this thread, which is the same as pressing the 2 on the remote (or take one small step forward). I have verified that the same code works as expected on 8.0.0.0. James(Fish) said it worked on 8.0.1.3, but I believe that this was a version that hservo trashed registers which one symptom was serouts hanging the machine.

It would be good if you could try running the simple test program on 8.0.1.6 so you can debug it… Note: last night I did reconfigure my brat again to be back to the default pins that Jim posted and commented out the HSERVO_GROUPS, unplugged the other servo and I2C components and it still acts very wierd!!! I guess I will probably move on to something else until this is resolved.

Thanks

Ok, now that I actually have 8.0.1.6exp installed, I can say that I couldn’t get either program to work…

When I use your code, it looks like the robot has a temper tantrum and then goes limp :laughing:

and when I use the BRAT code, it goes into seizure mode when you press a button

Thanks, that is the same as I was seeing! Yes it sure was having a temper tantrum. I sent Jim an email last night with a poor quality video of it. I had a higher quality one but did not want to sent 10+MBs. When I tried it on 8.0.1.6 it did not go limp but stayed in the tantrum :laughing: for awhile…

Hopefully AcidTech will have a chance to look at it soon as it is confirmed on a couple of machines.

Kurt

I’ve seen the video and I’ve seen James results. They are not acting the same. We are going back to 8.0.1.6 and testing more with it.

Ok, I tried both programs using 8.0.1.6 (not exp this time)

Kurte’s code and the BRAT code (when I tried to make it take a step) both made the robot curl up and swing the right leg while moving the right ankle to odd angles… weird…

I am also using 8.0.1.6 at present, and am seeing somewhat erratic behavior. I get the Hip and Knee servos locked into place pretty well, but they oscillate a bit and do not settle down until I attempt to move the servos manually.

I have seen my brat’s ankle servos do as you describe, but they are not doing that now after I rearranged my code a bit. I can get completely different behaviors, depending on where I have things arranged in my code. This acts like a memory accessing problem of some sort - maybe something is getting over written that shouldn’t be.

8-Dale

Been chatting with Nathan. He is aware of a problem with hservo and 8.0.1.6. He told me he will look at it tonight. I personally programmed one of our BRAT’s with 8.0.1.3 and it’s working, but I don’t remember what problems 8.0.1.3 had. I’m just trying to get you an IDE to use in the meantime.

Sounds good. I believe 8.0.1.3 was one of the builds that HSERVO appeared to work on it’s own, but a serout may hang the processor. Something about a register being corrupted in hservo.

I have had the best luck with 8.0.0.0, but I don’t think that one is available anymore. But hopefully he will find the problem tonight and have the fix for it.

In the mean time I may spend some time on the Rover, trying to hookup the 4 inputs from the two encoders and see if I can reliably determine how far it has gone.

(I am a little worried about one of the encoders as the power line to the servo fell out when I was building the rover and while I was resoldering it back in (Jamb in to below the encoder board and try to get solder in from above, The motor runs, but I am afraid I may have damadged the encoder). But that is another story…

They’re out of stock, but I have a few laying around, so let me know. I will take care of it. 8)

Thanks Jim, you are a great company. I finished making the connectors, and have them hooked up to P16-P19 with 18 and 19 connected to the first encode level of each encoder. I will try using IRQ2 and IRQ3 to get these. At first one did not look like it was working but I think my Oscilloscope connection below it or my poor job of making connectors may have gotten in the way. But once I pushed it down some more it appears like both are working :smiley:

Now it is off to coding! Thanks again and I supposed I should not hijack my own thread.

Found the problem with 8.0.1.6 It was something I added monday when I didn’t have the Brat(just a scope). The commands worked with the test program but not with commands using speed settings. I’ve fixed it(I was trashing a register used to calculate the next position when using speed) but I can’t get on our FTP server until tomorrow. Stay tuned for the link sometime tomorrow morning.

Great news, Once you have it up all give it a shot. I assume you when you said Monday, you were refering to a week ago Monday as you posted 8.0.1.6 on Monday Jan 28th.

Yay! 8)

Here is the link.

www.basicmicro.com/downloads/software/B … p_8017.exe

I loaded up 8.0.1.7, and it seems solid so far. I get some jitter and noise, but I think that is due to a weak servo in the left knee - it’s the only one that has trouble going to center when the BRAT is in a semi laying down position. All other servos go right to center position and stay there. :slight_smile:

8-Dale

If you are using the IRPD/Brat code add an enable to the begining of each interrupt handler. This will remove the jitter caused by the interrupts. You will still have any jitter caused by the HS-422 servos themselves.

[code];System variables
righthip con p15
rightknee con p14
rightankle con p13
lefthip con p12
leftknee con p11
leftankle con p10

;calibrate steps per degree.
stepsperdegree fcon 166.6

;calibrate servos to “zero”.
;When homed in and servos are at 0 degrees
;the robot should be standing strait with
; irpd pointing up and AtomPro chip pointing forward.
righthip_start con -560
rightknee_start con -720
rightankle_start con 0

lefthip_start con -560
leftknee_start con -480
leftankle_start con -160

;Interrupt init
ENABLEHSERVO

ONINTERRUPT WKPINT_3,handle_irpd
ONINTERRUPT TIMERAINT,handle_timera
PMR5.bit3 = 1
TMA=4 ;increments on clock/256
ENABLE WKPINT_3
ENABLE TIMERAINT

lasttime var long
overflowtime var long
currenttime var long
diff var long
datacount var byte
irpd_data var word
command var byte

lasttime = -1 ;indicate next data should be a startpulse
;End of System setup. Add user variables below this line.

;Init positions
;Note, movement subroutine arguments are Rightankle,Rightknee,Righthip,Leftankle,Leftknee,Lefthip,speed
gosub movement 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
low 1
low 2
pause 1000

command=0xFF
main
if(command<>0xFF)then
if(command = 1) then ;(Button 2) Walk Forwards
gosub movement -7.0, 20.0, 20.0, 7.0,-20.0,-20.0, 500.0]
gosub movement 7.0, 20.0, 20.0, -7.0,-20.0,-20.0, 500.0]
gosub movement 7.0,-20.0,-20.0, -7.0, 20.0, 20.0, 500.0]
gosub movement -7.0,-20.0,-20.0, 7.0, 20.0, 20.0, 500.0]
elseif(command = 4) ;(Button 5) Walk Backwards
gosub movement -7.0,-20.0,-20.0, 7.0, 20.0, 20.0, 500.0]
gosub movement 7.0,-20.0,-20.0, -7.0, 20.0, 20.0, 500.0]
gosub movement 7.0, 20.0, 20.0, -7.0,-20.0,-20.0, 500.0]
gosub movement -7.0, 20.0, 20.0, 7.0,-20.0,-20.0, 500.0]
elseif(command = 18) ;(Up Vol) long stride forward
gosub movement -12.0, 45.0, 45.0, 12.0,-45.0,-45.0, 750.0]
gosub movement 12.0, 45.0, 45.0,-12.0,-45.0,-45.0, 750.0]
gosub movement 12.0,-45.0,-45.0,-12.0, 45.0, 45.0, 750.0]
gosub movement -12.0,-45.0,-45.0, 12.0, 45.0, 45.0, 750.0]
elseif(command = 19) ;(Dn Vol) long stride backward
gosub movement -12.0,-45.0,-45.0, 12.0, 45.0, 45.0, 750.0]
gosub movement 12.0,-45.0,-45.0,-12.0, 45.0, 45.0, 750.0]
gosub movement 12.0, 45.0, 45.0,-12.0,-45.0,-45.0, 750.0]
gosub movement -12.0, 45.0, 45.0, 12.0,-45.0,-45.0, 750.0]
elseif(command = 2) ;(Button 3) Kick
gosub movement 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 500.0]
gosub movement 42.0, 0.0, 0.0,-14.0, 0.0, 0.0, 500.0]
gosub movement 0.0,-32.0, 41.0,-23.0, 0.0, 0.0, 500.0]
gosub movement 0.0, 24.0,-20.0,-23.0, 0.0, 0.0, 250.0]
gosub movement 0.0, 0.0, 0.0,-18.0, 0.0, 0.0, 500.0]
gosub movement 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 500.0]
sound 9,[50\3960]
pause 50
sound 9,[50\4400]
pause 50
sound 9,[50\3960]
elseif(command = 16) ;(Channel Up) Get up from front
gosub movement 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 500.0]
gosub movement 0.0, 90.0, 45.0, 0.0, 90.0, 45.0, 500.0]
gosub movement 40.0, 90.0,-37.0, 0.0, 90.0, 45.0, 500.0]
gosub movement 0.0, 90.0,-65.0, 0.0, 90.0,-65.0, 500.0]
pause 500
gosub movement 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 750.0]
sound 9,[50\4400]
pause 50
sound 9,[50\4400]
pause 50
sound 9,[50\3960]
elseif(command = 17) ;(Channel Dn) Get up from back
gosub movement 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,1000.0]
gosub movement 0.0,-90.0, 5.0, 0.0,-90.0, 5.0,1000.0]
gosub movement 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,1000.0]
pause 1000
gosub movement 0.0, 22.0,-80.0, 0.0, 22.0,-80.0,1000.0]
gosub movement 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,1000.0]
sound 9,[50\3960]
pause 50
sound 9,[50\3960]
pause 50
sound 9,[50\4400]

   elseif(command = 0)                                    ;(Button 1) Home Position 
     gosub movement   0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 500.0] 
     sound 9,[50\4400] 
     pause 50 
     sound 9,[50\4400] 
     pause 50 
     sound 9,[50\4400] 
  elseif(command = 5)                                    ;(Button 6) Headbutt 
     gosub movement   0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 500.0] 
     gosub movement   0.0,-50.0,-90.0,  0.0,-50.0,-90.0, 500.0] 
     gosub movement   0.0, 32.0,-58.0,  0.0, 32.0,-58.0, 400.0] 
     pause 200 
     ;gosub movement   0.0,-11.0,  7.0,  0.0,-11.0,  7.0, 500.0] 
     gosub movement   0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 500.0] 
     sound 9,[50\4400] 
     pause 50 
     sound 9,[50\3960] 
     pause 50 
     sound 9,[50\3960] 
  elseif(command = 6)                                    ;(Button 7) Turn 
     gosub movement   0.0,-35.0,-40.0,  0.0, 35.0, 37.0,500.0] 
     gosub movement   0.0, 35.0, 37.0,  0.0,-35.0,-40.0,500.0] 
     gosub movement -14.0, 35.0, 37.0, 20.0,-35.0,-40.0,500.0] 
     gosub movement -14.0, 35.0, 37.0, 20.0, 35.0, 37.0,500.0] 
     gosub movement  20.0, 35.0, 37.0,-14.0, 35.0, 37.0,500.0] 
     gosub movement  20.0,-35.0,-40.0,-14.0, 35.0, 37.0,500.0] 

     ;gosub movement   0.0,-35.0,-70.0,  0.0, 35.0,  7.0,500.0] 
     ;gosub movement   0.0, 35.0,  7.0,  0.0,-35.0,-70.0,500.0] 
     ;gosub movement -14.0, 35.0,  7.0, 20.0,-35.0,-70.0,500.0] 
     ;gosub movement -14.0, 35.0,  7.0, 20.0, 35.0,  7.0,500.0] 
     ;gosub movement  20.0, 35.0,  7.0,-14.0, 35.0,  7.0,500.0] 
     ;gosub movement  20.0,-35.0,-70.0,-14.0, 35.0,  7.0,500.0] 

  elseif(command = 3)                                    ;(Button 4) Rest Position 
     gosub movement   0.0, 45.0, 45.0,  0.0, 45.0, 45.0, 500.0] 
  endif 
  Command=0xFF 

endif
goto main

;Should never need to edit anything below this line. Add user subroutines above this and below main.
lefthippos var float
leftkneepos var float
leftanklepos var float
righthippos var float
rightkneepos var float
rightanklepos var float
last_lefthippos var float
last_leftkneepos var float
last_leftanklepos var float
last_righthippos var float
last_rightkneepos var float
last_rightanklepos var float
lhspeed var float
lkspeed var float
laspeed var float
rhspeed var float
rkspeed var float
raspeed var float
speed var float
longestmove var float
;movement [lefthippos,leftkneepos,leftanklepos,righthippos,rightkneepos,rightanklepos,speed]
movement [rightanklepos,rightkneepos,righthippos,leftanklepos,leftkneepos,lefthippos,speed]
if(speed<>0.0)then
gosub getlongest[lefthippos-last_lefthippos, |
leftkneepos-last_leftkneepos, |
leftanklepos-last_leftanklepos, |
righthippos-last_righthippos, |
rightkneepos-last_rightkneepos, |
rightanklepos-last_rightanklepos],longestmove
speed = ((longestmovestepsperdegree)/(speed/20.0))
gosub getspeed[lefthippos,last_lefthippos,longestmove,speed],lhspeed
gosub getspeed[leftkneepos,last_leftkneepos,longestmove,speed],lkspeed
gosub getspeed[leftanklepos,last_leftanklepos,longestmove,speed],laspeed
gosub getspeed[righthippos,last_righthippos,longestmove,speed],rhspeed
gosub getspeed[rightkneepos,last_rightkneepos,longestmove,speed],rkspeed
gosub getspeed[rightanklepos,last_rightanklepos,longestmove,speed],raspeed
else
lhspeed=0.0;
lkspeed=0.0;
laspeed=0.0;
rhspeed=0.0;
rkspeed=0.0;
raspeed=0.0;
endif
hservo [lefthip\TOINT (-lefthippos
stepsperdegree) + lefthip_start\TOINT lhspeed, |
righthip\TOINT (righthipposstepsperdegree) + righthip_start\TOINT rhspeed, |
leftknee\TOINT (-leftkneepos
stepsperdegree) + leftknee_start\TOINT lkspeed, |
rightknee\TOINT (rightkneeposstepsperdegree) + rightknee_start\TOINT rkspeed, |
leftankle\TOINT (-leftanklepos
stepsperdegree) + leftankle_start\TOINT laspeed, |
rightankle\TOINT (rightanklepos*stepsperdegree) + rightankle_start\TOINT raspeed]
hservowait [lefthip,righthip,leftknee,rightknee,leftankle,rightankle]
last_lefthippos = lefthippos
last_leftkneepos = leftkneepos
last_leftanklepos = leftanklepos
last_righthippos = righthippos
last_rightkneepos = rightkneepos
last_rightanklepos = rightanklepos
return

one var float
two var float
three var float
four var float
five var float
six var float
getlongest[one,two,three,four,five,six]
if(one<0.0)then
one=-1.0one
endif
if(two<0.0)then
two=-1.0
two
endif
if(three<0.0)then
three=-1.0three
endif
if(four<0.0)then
four=-1.0
four
endif
if(five<0.0)then
five=-1.0five
endif
if(six<0.0)then
six=-1.0
six
endif
if(one<two)then
one=two
endif
if(one<three)then
one=three
endif
if(one<four)then
one=four
endif
if(one<five)then
one=five
endif
if(one<six)then
one=six
endif
return one

newpos var float
oldpos var float
longest var float
maxval var float
getspeed[newpos,oldpos,longest,maxval]
if(newpos>oldpos)then
return ((newpos-oldpos)/longest)*maxval
endif
return ((oldpos-newpos)/longest)*maxval

handle_irpd
enable
currenttime=overflowtime+TCA
if(currenttime<0)then ;If we overflow to a negative number reset everything
overflowtime=0
currenttime=TCA
lasttime=-1
endif
if(lasttime<0)then ;If negtive lasttime, reset
datacount=0
lasttime=currenttime
else ;else process pulses
datacount=datacount+1
diff=currenttime-lasttime
irpd_data=irpd_data>>1
if(diff>175 AND diff<195)then ;If we get a start pulse reset datacount and irpd_data
irpd_data=0
datacount=0
elseif(diff>100 and diff<120) ;we got a “1” pulse
irpd_data.bit10=1
elseif(diff>65 and diff<85) ;we got a “0” pulse
irpd_data.bit10=0
else ;we got an invalid pulse so reset
lasttime=-1
resume
endif
if(datacount=11)then
lasttime=-1
command = irpd_data&0x7F
else
lasttime = currenttime
endif
endif
Resume

handle_timera
enable
overflowtime=overflowtime+256
resume[/code]

I am running my own code. My BRAT has HS-475HB servos.

8-Dale

Yep, I have played with this release some and it appears to be working much better. Also thanks for the tip, it does make my brat less jitterly.