ARC Pro

Upgrade to ARC Pro

Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.

United Kingdom
#1  

@nomad.

Show us the script you're using.

PRO
Belgium
#2  

hi steve.

its says run once

User-inserted image

User-inserted image

PRO
Synthiam
#3  

Share your project by uploading the ezb file here.

PRO
Belgium
#4  

i forgot how to do that.

#5  

@nomad.... look in you ez robot folder on your harddrive . Find your ezb project file... attach it to a post and upload it...

United Kingdom
#8  

@nomad.

yeah, the link for your project works fine. I had a quick look through it and can't see what is causing the issue I'm afraid. Hopefully someone else will be able to figure it out for you.

#9  

Here is my guess as to what is happening.

I think that the stand up sequence is running and then evaluating the gyro before the robot has a chance to get to a point that the gyro is in a standing position. I would add more time to the sleep command at the bottom. You might take it up to 10000 and see if that is the issue. If so, you could start reducing this down to however long it takes.

You would think that the line waiting for the auto positioner running to be false would prevent this from happening but, give it a shot. If that "Fixes" the issue, we will have a better idea of how to completely fix the issue.

PRO
Belgium
#10  

ok i decrease the sleep with 1000 and up to 4000 not working. also you have the effect that jd will lie down for long time . before getting up.

#11  

Yea, I expected it to delay the standup time, but it answers that the script must be being called 2 times from somewhere. I don't have one of these sensors so I don't have a way to test. I think DJ is going to be your best help unless others have one and a JD that they can test with.

#12  

Use this code and then post the output in the little black window under the script back to this thread. Make sure to get all of it which might require that you scroll up a bit.



ControlCommand("MPU9150", Init)

sleep(100)

:loop
#Added these because $AccelX and $AccelY were not recognized
print("Start of loop")
$XAccel = $AccelX
$YAccel = $AccelY

IF ($AutoPositionStatus = true)

  print("AutoPositioner already running...")  

  sleep(2000)
  
  goto(loop)
  
ENDIF 
  
ControlCommand("MPU9150", RunOnce)

print ("x: " + $XAccel)
print ("y: " + $YAccel)

IF ($YAccel > 8000)

  print("Getting up from front")
  
  ControlCommand("Auto Position", AutoPositionAction, "Getup")
  
  waitfor($AutoPositionStatus = false)
$XAccel = $AccelX
$YAccel = $AccelY


print ("x: " + $XAccel)
print ("y: " + $YAccel)
  

ELSEIF ($YAccel < -8000)

  print("Getting up from rear")
  
  ControlCommand("Auto Position", AutoPositionAction, "stand from sit")
  
  waitfor($AutoPositionStatus = false)
$XAccel = $AccelX
$YAccel = $AccelY

print ("x: " + $XAccel)
print ("y: " + $YAccel)
  
ENDIF 
  
sleep(1000)
$XAccel = $AccelX
$YAccel = $AccelY

print("End of loop...Restarting")
goto(loop)


PRO
Belgium
#13  

like this?

#autopositionstatus = ""

ControlCommand("MPU9150", Init)

sleep(100)

:loop

$YACCEL = $ACCELY

$XACCEL = $ACCELX

if($autopositionstatus=true)

print("autopositioner alredy running")

sleep(1000)

goto(loop)

endif

ControlCommand("MPU9150", RunOnce)

print("x8:" + $XACCEL)

print("y8:" + $YACCEL)

if($YACCEL > 8000)

print ("GETTING UP FROM FRONT")

controlcommand("auto position",autopositionaction,"getup")

waitfor($autopositionstatus=false)

elseif($YACCEL <-8000)

print("getting up from rear")

ControlCommand("Auto Position", AutoPositionAction, "stand from sit")

waitfor($autopositionstatus=false)

endif

sleep(1000)

goto(loop)

#14  

The text will happen after you run the script. it will look like this

Start of loop y = (something here) x = (Something here) Getting up from rear end of loop restarting

This will be in the little black box at the bottom of the script window.

Also, get the code I sent a couple of posts ago. It has a couple of more things that might solve or point to the problem.

#16  

The issue was with having to specify other variables and not updating these variables in the script. Nomad, please post the working script and have a great day!

PRO
Belgium
#17  

ControlCommand("MPU9150", Init)

sleep(100)

:loop #Added these because $AccelX and $AccelY were not recognized print("Start of loop") $XAccel = $AccelX $YAccel = $AccelY

if ($AutoPositionStatus = true)

print("AutoPositioner already running...")

sleep(2000)

goto(loop)

endif

ControlCommand("MPU9150", RunOnce) $XAccel = $AccelX $YAccel = $AccelY print ("x: " + $XAccel) print ("y: " + $YAccel)

if ($YAccel > 8000)

print("Getting up from front")

ControlCommand("Auto Position", AutoPositionAction, "Getup")

waitfor($AutoPositionStatus = false) $XAccel = $AccelX $YAccel = $AccelY

print ("x: " + $XAccel) print ("y: " + $YAccel)

ELSEif ($YAccel < -8000)

print("Getting up from rear")

ControlCommand("Auto Position", AutoPositionAction, "stand from sit")

waitfor($AutoPositionStatus = false) $XAccel = $AccelX $YAccel = $AccelY

print ("x: " + $XAccel) print ("y: " + $YAccel)

endif

sleep(500) $XAccel = $AccelX $YAccel = $AccelY

print("End of loop...Restarting") goto(loop)

thank you d.cohran

PRO
Belgium
#18  

forgot to check solved

United Kingdom
#19  

Great solve David, and I'm pleased you got everything sorted now nomad.:)

PRO
Belgium
#20  

steve g

thats two jd's getting up now.d.cohran is good programmer.