United Kingdom
Asked — Edited

New Script Command Request

@DJ and team.

I give a small request that I hope you would consider adding to EZ-Script.

Would it be possible to add a new script command for servostop()? I'm not talking about the one the one that already exists for modified servos, but for standard ones (more like a stopservo() or possitionstop() command). The idea is to add this for things like controllers and joysticks.

E.g, you have a servo which has a centre possition of 90, and a set max possition of say 160, and a set speed of 2. When a button is pressed on a controller the servo starts to move from 90 towards 160, but if you release the button the servo stops in its current possition and stays there. Press the button again and it continued to travel towards 160, or back to 90 by pressing another button.

I'm aware that there are ways to write a script for this, but I've had a lot of trouble with it so far, and having a simple script command in the script menu would make things so much easier. Would it be something that you would consider adding? And if there is a command to do just this, then I apologise in advance and would appreciate someone informing me of what script command to use.

Thanks, Steve.


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

United Kingdom
#17  

Yeah this would work for claws. Tied in with a current monitor on the ADC port you could have it totally autonomous for when closing, when the resistance is high the current increases, this can be picked up by the current monitor, fed in to the ADC, monitored by ARC and can stop the script for closing the claw.

That's just one method that could work, I'm sure there are other methods, probably even better methods.

United Kingdom
#18  

@Rich.

Thank you, thank you, and again thank you. :D That has ended what has been a pretty rubbish day on a real high note. Looking at the code now and it's starting to make sense a lot more now. I obviously still have a long way to go with scripting, but I appreciate all the help (and patience) you and others offer.

Thanks again. :):)

#19  

I was just discussing monitoring how tight the claw was closing using an ADC port. He said the best way would be to open the servo and get resistance from the pot, but that monitoring the ground wire for power spikes would probably also work.

Added to my project list.

Alan

United Kingdom
#20  

@Steve, you're welcome. Hopefully the scripts and explanation make sense and help you understand what's going on:)

@Alan, these work well on the ADC ports, I use a few in my projects. Melvin monitors one for the current to the drive motors so that if he gets stuck it is detected, he also has one for the EZ-B to monitor power being drawn by the EZ-B and connected devices.

They also do an I2C version which looks like it'll work well but I've not used it yet.

Trinidad/Tobago
#21  

@Steve to get the buttons to move the servo when held down and then as it is released the servo stops you can create two scripts:


:loop
if(GetServo(D0)<150)
  ServoUp(D0,1)
endif
sleep(100)
GoTo(loop)

and


:loop
if(GetServo(D0)>75)
  ServoDown(D0,1)
endif
sleep(100)
GoTo(loop)

and then in the joystick control when the button is pressed down run


ControlCommand("Script Manager", ScriptStart, "Move servo Up")
#and
ControlCommand("Script Manager", ScriptStart, "Move servo Down")

and then for when the button is released you run


ControlCommand("Script Manager", ScriptStop, "Move servo Up")
#and
ControlCommand("Script Manager", ScriptStop, "Move servo Down")

So i've tested this method and it seems to work but you may have to adjust the increment you want to increase by as well as the sleep command in the movement scripts

United Kingdom
#22  

@Vgosine.

Thanks for your response. I appreciate it. I'm golden now. :)

Trinidad/Tobago
#23  

Awesome:) I'm glad to help out