Hello all
I am currently getting my feet wet and starting to understand the micro maestro and the Control Center program as well as the scripting language. I am using a continuous rotation servo for a project and when I use the stop script button it will continue the last command the script was stop on in the status tab basically causing the servo to rotate out of control. Is there a way to stop this from occurring? So when I stop the script it stops everything
Thanks
Too Tall
Hello.
The “Stop Script” button simply pauses the script where it is; it does not do anything to change or disable the signals being sent to the servos. There is no setting to change the behavior of that button, but depending on your application, there are several ways you could probably address this. For example, you could have an external button that your script monitors and triggers a shut down sequence to stop the servos before quitting. Alternatively, you could set the “On startup or error” setting in the “Channel Settings” tab to “Go to” and specify the neutral position for your servos (which is typically around 1500μs). Then, you could use the “Restart Device” option in the “Device” drop-down menu instead of using the “Stop Script” button. Depending on your servos, it might work to set the “On startup or error” behavior to “Off” instead.
Brandon
Thanks Brandon
Choosing the device tab and using restart device instantly stops the servo and is exactly the fail safe that I need.
I will likely be posting up some scripting questions this week as I am having some issues where I get stuck in a perpetual loop with some of the other subs(get_moving_state, and delay_seconds) example scripts when I am trying to ask it to run x amount of times when using the stack command depth to compress the sequence. I am going to go and post what I have so far and maybe you can point me in the right direction.
2
begin dup while
8 4 8 4
all_frames
1 minus
repeat
begin
neutral
drop
quit
repeat
sub frame_1 #slow speed
1 1 acceleration
10 1 speed
1000 times # times the servo positioning
1 servo
1 delay_seconds
moving_wait
return
sub frame_2
8 1 acceleration
80 1 speed
1000 times
1 servo
3 delay_seconds
moving_wait
return
sub delay_seconds
begin dup while # check if the count has reached zero
1 minus 1000 delay # subtract one and delay 1s
repeat
drop return # remove the 0 from the stack and return
sub moving_wait
begin
get_moving_state
while
# wait until it is no longer moving
repeat
return
sub neutral
6000 1 servo
return
sub all_frames
begin depth
while
3 1 acceleration
30 1 speed
1000 times
1 servo
2 delay_seconds
moving_wait
repeat
return
I am glad to hear that helped!
When you call the depth command, it is also reading the 2 you put on the stack in the beginning, which means your all_frames
subroutine is probably running one more time than you want it to and using the 2 to try to set the target of the servo to 2000 (and that causes problems when it returns to your main loop and tries to subtract 1 from nothing).
You should be able to fix that by putting 1 greater_than
before the while
in your `all_frames_ subroutine, so it only loops while there is more than 1 value on the stack.
Brandon