Asked — Edited

Script Help

Hey guys I need a bit of assistance with this tiny part of a script.

IF ($Lelbowposition >68) And ($Relbowposition <1)

I want this to be known as "safe position"

So later in my larger script it will check arm" safe position "before moving forward.

Can I just use an equals sign at the end of the statement and call it " safe position"

Thanks Chris


ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

PRO
Synthiam
#1  

Hey Chris - not sure I'm following you. Can you expand on this?

Also, might be a great idea to start with blockly. Follow some examples in the robot program to learn how comparisons work for IF conditions.

#2  

Hey DJ thanks for the reply. Everything Ive done is in scripting. Basically all I want is IF left elbow position is greater than 68 and left elbow is less than 1, I want to say arms are in a safe position in order to move.

so if left elbow position>68 and right elbow position <1 = safe position

#3  

Then I can use " safe position" = true to allow robot movement

                       &quot;safe position&quot; =not true do not allow movement
PRO
Synthiam
#4  
  1. how can a servo position be less than 1?

  2. is this script to prevent the robot from physically moving if the arms are in the way?

#5  

Hi Chris,

How about this:


IF ($Lelbowposition &gt;68) And ($Relbowposition =1)
  &quot;do something&quot;
ELSEIF ($Lelbowposition &lt;68) And ($Relbowposition &gt;1)
  Halt()
ENDIF

The "do something" is where you can put your command for movement or a Goto command to go to a movement section of your script. You can also place Say commands in each IF or ELSEIF section to have you robot tell you he's about to move or stopped because it's to dangerous to move. ;)

#6  

Yes that is what im looking for. Thanks Dave! And yes Dj it is to prevent the robot from physically moving if the arms are in a unsafe position. I came up with something different but Dave your solution is a bit more elegant. Thanks

PRO
Synthiam
#7  

Ah I see. There's a movement script control. It will execute every time a Movement Panel is instructed to move. You can override it by checking that condition with the movement. Specify a Stop() in it if the condition is not met.

Here's the control: https://synthiam.com/Tutorials/Help.aspx?id=47