Some questions about S2.
Jarvan
Posts: 31
I am Ann from RobotC company in Xi'an. I am responsible to translate all the documents in the HELP section and I found some problems I could not understand. I list some questions show in the following section. I will so appreciate if you could help me to answer these questions.
1. Motion Tiles
Articles:
Unlike the Scribbler I, the S2 has wheel encoders to regulate precisely the distance and speed that each wheel turns. Because of this, setting the time and wheel speeds actually sets the overall distance traveled, and the time itself is only approximate. However, if the S2 is unable to cover the prescribed distance in twice the time specified, it will time out, and the program will move on to the next tile. As a benchmark, a rotation in place at full speed for one second will typically cover about 90 degrees.
Question:
1). How could robot know it can not cover the prescribed distance in twice the time specified? Why in the twice time?
2). S2 will run in the time specified, and when the time is over, the program will move on to the next tile immediately. How does the program know it should wait for longer time?
Could you give me more explanation? So I could understand and translate to Chinese
2. what is the function of barcode ? How could we use it?
3. Coin Came Up Heads
Articles: This condition enables you to add some randomness to your programs. This is useful when your S2 gets stuck in a corner, for example, and you need to vary the techniques required to free it. It can also be used to vary the sounds played under a given set of circumstances. For this condition to be TRUE the coin flip has to have come up "heads". You can require that anywhere from 1 to 8 consecutive coin flips has to yield "heads" for the condition to be TRUE. This is done with the slider control. Doing so varies the probability of the result being TRUE by cutting it in half with each successive increment in the required number of consecutive "heads". The probability for one "heads" is 1/2; for two, 1/4;
for three, 1/8; etc.
Questions:
1) What is the function of coins? How can it be used to vary the sounds played under a given set of circumstances?
Could you give me more explanation?
Waiting for your reply~
Warm Regards,
Ann & Jarvan
1. Motion Tiles
Articles:
Unlike the Scribbler I, the S2 has wheel encoders to regulate precisely the distance and speed that each wheel turns. Because of this, setting the time and wheel speeds actually sets the overall distance traveled, and the time itself is only approximate. However, if the S2 is unable to cover the prescribed distance in twice the time specified, it will time out, and the program will move on to the next tile. As a benchmark, a rotation in place at full speed for one second will typically cover about 90 degrees.
Question:
1). How could robot know it can not cover the prescribed distance in twice the time specified? Why in the twice time?
2). S2 will run in the time specified, and when the time is over, the program will move on to the next tile immediately. How does the program know it should wait for longer time?
Could you give me more explanation? So I could understand and translate to Chinese
2. what is the function of barcode ? How could we use it?
3. Coin Came Up Heads
Articles: This condition enables you to add some randomness to your programs. This is useful when your S2 gets stuck in a corner, for example, and you need to vary the techniques required to free it. It can also be used to vary the sounds played under a given set of circumstances. For this condition to be TRUE the coin flip has to have come up "heads". You can require that anywhere from 1 to 8 consecutive coin flips has to yield "heads" for the condition to be TRUE. This is done with the slider control. Doing so varies the probability of the result being TRUE by cutting it in half with each successive increment in the required number of consecutive "heads". The probability for one "heads" is 1/2; for two, 1/4;
for three, 1/8; etc.
Questions:
1) What is the function of coins? How can it be used to vary the sounds played under a given set of circumstances?
Could you give me more explanation?
Waiting for your reply~
Warm Regards,
Ann & Jarvan
Comments
1). Since the S2 has encoders it knows how much each wheel rotates. The quote about the movement timeout is applied to the case where the wheel doesn't rotate even though it should be. This might happen if the wheel was stuck (stalled), for example. In that case the timeout will come into effect and prevent the program from waiting indefinitely for the block to finish. It would only know this after the timeout has expired.
I don't know why specifically twice the time was chosen, but it's probably just a guess that most "stuck" cases will fit into that timeout. It's a tradeoff between waiting too long and holding up the program and waiting to little and giving false timeouts.
2). It sounds like this isn't adjustable, but you should double check the inputs or configuration.
2. I don't know.
3.
1) The coins provide true/false randomness in the ratios of 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128, 1/256. This allows you to do "mostly" the same thing, but every once in a while to try something new. The use case seems to be to use it in a conditional statement. With the music program you could have something like (pseudo code):
With this code you'd play the unique sound 1 in 4 times, on average.
I have some guesses about the other questions but they are just guesses. Hopefully Phil will give you the correct answer. If Phil doesn't see this thread soon, you might want to email him (he doesn't use the forum PM feature).
Thanks much for your efforts in translating the S2 docs to Chinese! I hope the lollowing answer your specific questions:
1.1) The distance each wheel travels is computed from the selected time and the wheel's selected velocity. Under normal circumstances, the time required to complete the requested motion will be close to the original time selected. However, under a stall condition or failing batteries, the requested movement will take longer. If it takes longer than twice the amount of time requested in the first place (i.e. if the wheels are turning at half the requested velocity), a fault condition is assumed, and the movement terminates.
The 2x time-out period seemed reasonable when I incorporporated it into the generated Spin code, but it's entirely arbitrary. It could just as easily have been set to 3x or 1.5x, for example.
1.2) It will only wait for the longer time (and quit) if the requested distance has not been covered.
2.1) The barcodes can be used to select from amongst different sound sequences, for examle, or to construct a "virtual maze."
3.1) The fucntion of the coin flip is to add randomness to the S2's actions. When used in a conditional tile, you can choose between two actions, depending upon the outcome. Those two actions could be different motion profiles or a choice between two sound sequences, for example.
My suggestion, if you're doing the translation, is to get your hands on an S2 and program it yourself. You will get a much better grasp of its behavior than you will simply by reading the Help file and attempting to transliterate it.
-Phil
Phil,
I am still confused about your answers.
1.Motion Tiles:
My co-workers set the time as 5 seconds and the wheels velocity as 50 and insert sound tile. He held S2 and the idler wheel kept static. However, S2 just ran in 5 seconds and play sound immediately. But according your explanation, S2 should run in 10 seconds then play music because the idler wheel doesnt detect the motion of wheels. Do I misunderstand your opinion? Could you explain why this situation happened?
2.Observation Sensor Tile
1) Once an observation is made, it remains in effect until another one is made. Will the program save the observed value of sensor into a certain memory?
2) That way, you can use a single observation in several conditionals without disturbing it. How could I use it in several conditionals? Why it will be disturbed?
3) What is the difference between use conditional tiles directly and inserting observation sensor tile before using it? When S2 is covering the black surface, if program run the observation line sensor first, dose it can observe the black line? And then, when it reaches to the white surface, if program run the line sensor conditional, what is the observed value of line sensor? Is it black or white?
3. scribbler.ini
1) If you want to modify the automatic insertion behavior of the program, you can do so by editing the file scribbler.ini. It's found in the main S2 program directory. Below are the various options, the factory-set value being 2:
What is scribbler.ini? Where I could find it?
2) Once you've created and saved a program with one of these settings, the setting current when the program was created will be saved with the program. That way, if the setting is later edited, the program will continue to work as if the original setting were in effect.
Does this means when I created and saved a program with one of these settings, this setting will be saved. If I edit these setting later, the edited setting will not be saved and the program will still follow the original setting? Maybe this question is so easy from your perspective. I am just worried I misunderstand the meaning of these sentences.
I will so appreciate your help.
You have asked some very good questions!
The encoder in the tail wheel for stall detection is independent of the encoders in the drive wheels. Stall detection using the tail wheel is not automatic, it must be invoked with the stall sensor tile (the one with the cracked windshield). It is effective only during motion that does not have a defined duration. In the experiment you cite, the stall detector was not used. To make the duration last the full ten seconds, your co-workers would have had to hold the drive wheels to keep them from turning or allowing them to turn very slowly. Then the program would have detected that the required distance was not covered quickly enough and turned off the drive motors after ten seconds..
Here's an example of how to use the stall detector. The motion starts without any prescribed time. Then it plays a tune, followed by checking the stall detector. if there's stall it stops the motors and exits the loop. Otherwise, it plays the tune again and re-checks the stall detector, ad infinitum or until there's a stall.
Yes.
Here's how you can use a single observation in several conditionals:
Here's the code it produces:
Note that there is only one observation but that the results are used in three different conditionals. The way you would "disturb" an observation is to make another one of the same kind. This will erase the previous results and replace them with new results.
The default behavior is this: if you omit the observation tile, one will be inserted in the code automatically ahead of any conditionals that use it. Only one automatic observation is inserted in a given loop or subroutine. If you need subsequent observations within the same loop or subroutine, you need to insert them yourself. In the example you cite, the second conditional will still return black if the conditional was within the same loop or subroutine, because there was not another observation inserted ahead of the new conditional.
That is actually an error in the help file. The real name of the file is s2.ini, not scribbler.ini. It's found in the same folder that s2.exe is in.
Yes. When you save a program, the setting in effect when the program was saved is saved with it. When you reload that program the saved setting overrides whatever is in s2.ini, so it behaves as if the original setting were in place.
Thank you for taking the time to understand some of the GUI's finer points, Ann!
-Phil
For the motion tile, I still cannot understand~ If you didn’t set time, the robot how knows the distance it should cover? How does it know it should wait for ten seconds???
By the way, do you know “Check to change all calls to new color”in the DIC file? I never saw this note when I program.