
Creativita
Australia
Asked
— Edited
This thread is for the purpose of script evaluation. If you are stuck in writing a script or just can't get it to work post it and it can be checked by other EZ-B users. It can also be used for the sharing of a script that you believe would be particularly useful to others. Remember to include a breakdown of all the parts of your script.
I have been trying to work on movement equivalent of the Colour Found Script in the Camera box whilst DJ is making a real one. Here is what I have come up with.
ControlCommand("Sleep Script", ScriptStop) ControlCommand("Port Shutdown Script", ScriptStop) ControlCommand("Restart Script", ScriptStart) ControlCommand("Camera", CameraMotionTracking) WaitForServoMove(D4) Say ("Movement Detected")
"Sleep Script" is the script which "switches off" my robot and "Port Shutdown" is one that starts a shutdown of all the ports. "Restart Script" is the script that reverses what these scripts have done. I have allocated D4 as my head servo and the servo that will rotate to follow movement. If I have started the Camera Motion Tracking will it say "Movement Detected" when the head has moved? This may sound stupid but I am new to this.
I also have a variation.
ControlCommand("Sleep Script", ScriptStop) ControlCommand("Port Shutdown Script", ScriptStop) ControlCommand("Restart Script", ScriptStart) ControlCommand("Camera", PauseOff) WaitForServoMove(D4) Say ("Movement Detected")
This uses the "ControlCommand("Camera", PauseOff)" instead of "ControlCommand("Camera", CameraMotionTracking)." I am not sure which varitation is more correct. Or is it even "ControlCommand("Camera", CameraMovementTrackEnable)."
What a sad thread. I thought this would be really popular
I must have missed this thread. It's done right!
I do that with the wall-e, for example. When things like "Dance Please" are said, the top of the script Pauses the speech recognition, pauses the personality generator, and then does its action. When the action is done, it restores everything by calling the INIT script.
You did good
Thanks. It's good to know I am on the right track. I would hate to write hundreds of lines of code and find that it is all written incorrectly
If it works, there is no wrong way. I've designed the scripting and control model so that you can be creative, but not break anything. Meaning the number of configuration options and control interaction is limitless but if it works, it's right
That could be the new motto for ARC. "If it works, it's right".
I have a robot that uses the front wheel as both drive wheel and steering wheel. One servo rotates the wheel while a dc motor turns the wheel either forward or reverse. This is an old Hero Jr. robot from the 80's.
Both controls are attached to a mobile Movement Panel with right, left, forward, back and stop buttons. All the functions work...sort of. The robot moves forward and backwards fine, but to turn, I rotate the servo and then have to move the motor forward for a short burst to turn then stop and center everything again. The script I created does not actually do this but turns the robot in circles and I am not sure why.
ServoSpeed(d0, 3) #Rotate the servo... Servo(d0,130)
Rotate the robot...
repeatuntil($second = 2) Set(d1,Off) Set(d2,On) endrepeatuntil #Center the wheels and stop. Set (d1, Off) Set (d2, Off) Servo(d0,93) $TrackBarValue=90
The RepeatUntil does not seem to loop for 2 seconds...so I am assuming that $second means something else?
I appreciate any help someone could give me to get started...
Thanks, Greg