ARC Pro

Upgrade to ARC Pro

Unlock the true power of automation and robotics by becoming a proud subscriber of Synthiam ARC Pro.

#1  

Are you sure you are using it properly? Have you initialized it? Show me your script?

PRO
Belgium
#2  

this is what the (?) mark chows

User-inserted image

#3  

That's great but you need to write a script like below (DJ's code for the mpu6050) in order to use it the way you saw on the video DJ made of JD getting up after falling over... This is for the MPU6050 not for the MPU9150, however the code can be easily adapted to work with the MPU9150


ControlCommand("MPU6050", Init)

sleep(100)

:loop

IF ($AutoPositionStatus = true)

  print("AutoPositioner already running...")  

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

print ("x: " + $MPUAccelX)
print ("y: " + $MPUAccelY)

IF ($MPUAccelY > 8000)

  print("Getting up from front")
  
  ControlCommand("Auto Position", AutoPositionAction, "Getup")
  
  waitfor($AutoPositionStatus = false)
  
ELSEIF ($MPUAccelY < -8000)

  print("Getting up from rear")
  
  ControlCommand("Auto Position", AutoPositionAction, "stand from sit")
  
  waitfor($AutoPositionStatus = false)
  
ENDIF 
  
sleep(1000)

goto(loop)

PRO
Belgium
#4  

mpu 6050? in his video and text it chows mpu 9150 but i try yours.

#5  

I know... the example is for the mpu6050 ... but tweaking it a little and it will work with the 9150,,, Download the Example Project from the cloud for JD and the MPU650....

PRO
Belgium
#6  

withs one do i have then?

#7  

Based on what is available for purchase in the store, I would say the MPU9150.




ControlCommand("MPU9150", Init)

sleep(100)

:loop

IF ($AutoPositionStatus = true)

  print("AutoPositioner already running...")  

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

print ("x: " + $MPUAccelX)
print ("y: " + $MPUAccelY)

IF ($MPUAccelY > 8000)

  print("Getting up from front")
  
  ControlCommand("Auto Position", AutoPositionAction, "Getup")
  
  waitfor($AutoPositionStatus = false)
  
ELSEIF ($MPUAccelY < -8000)

  print("Getting up from rear")
  
  ControlCommand("Auto Position", AutoPositionAction, "stand from sit")
  
  waitfor($AutoPositionStatus = false)
  
ENDIF 
  
sleep(1000)

goto(loop)


PRO
Belgium
#8  

so i choose the mpu 9150 in ARC?

#9  

Yes. I dont have one, but I would believe that this would be right based on what is available for sale in the store.

PRO
Belgium
#10  

got error in line 11 cant find loop?

Canada
#13  

nomad TMBS , you are very close , yes use the MPU9150, but first add an MPU9150 control to your project. Then look at the variables in the MPU9150, they are not the same as the MPU6050. Try this,

ControlCommand("MPU9150", Init)

sleep(100)

:loop

ControlCommand("MPU9150", RunOnce)

$initheading=round($CompassHeading,0)

print($initHeading)

print("AccelX AccelY AccelZ CompassHeading") print($accelx + " " + $accely + " " + $accelz + " " + $initheading)

print("CompassX CompassY CompassZ") print($compassx + " " + $compassy + " " + $compassz)

print("GyroX GyroY GyroZ") print($gyrox + " " + $gyroy + " " + $gyroz)

sleep(1000)

goto(loop)

#14  

Nomad will post the working script. For some reason, the variables were not recognized in the script (even using the correct names). We had to assign new variables and then assign these variables the values from the AccelX and AccelY variables and then use the new variables in place of these in the script. He will post it and you will see what I am talking about. Weird.

#15  

from what I remember, this script worked but I am not connected to his computer to see anymore.


ControlCommand("MPU9150", Init)

sleep(100)

:loop
#Added these because $AccelX and $AccelY were not recognized later in the script for some reason.
$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)
  
ELSEIF ($YAccel < -8000)

  print("Getting up from rear")
  
  ControlCommand("Auto Position", AutoPositionAction, "stand from sit")
  
  waitfor($AutoPositionStatus = false)
  
ENDIF 
  
sleep(1000)

goto(loop)


PRO
Belgium
#16  

here's the script for the gyro


ControlCommand("MPU9150",init)

sleep(100)

:loop

print("start of loop")

$XAccel=$AccelX
$Yccel=$AccelY

if ($Autopositionstatus=true)

print("Atopositioner alredy 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,"get up")

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")

$XAccel=$AccelX
$YAccel=$AccelY

print ("X:"+$XAccel)
print ("Y:"+$YAccel)

endif

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

print ( End of loop...restarting")

goto(loop)


Germany
#17  

@nomad TMBS

how long your gyro works ?

I have the Ez Robot 4-in-1 Orientation Sensor and after a few minutes my Controller cut the W-Lan connection and freeze.

It works fine for a while but then ..

regards Marty

PRO
Belgium
#18  

smarty

i just tested for about 10 min,no disconnecting did you use the script from d.cohran? and i use a router from EnGenius N 300 mbps