Script Help

 
#1

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

#2

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.

#3

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

#4

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

"safe position" =not true do not allow movement

#5

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?

#6

Hi Chris,

How about this:

Code:


IF ($Lelbowposition >68) And ($Relbowposition =1)
"do something"
ELSEIF ($Lelbowposition <68) And ($Relbowposition >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. Winky

#7

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

#8

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: http://www.ez-robot.com/Tutorials/Help.aspx?id=47