set_heading ( heading : int ) ¶Īssuming you aim the robot with the blue tail light facing you, then 0° is forward, 90° is right,Ģ70° is left, and 180° is backward. Sets the speed to zero to stop the robot, effectively the same as the set_speed(0) command. stop_roll ( heading : Optional = None ) ¶ Per second reported by the motor encoders. You can also read the real-time velocity value in centimeters Which persists until you set a different speed. For example, use set_speed(188) to set the speed to 188 Ollie is almost three times faster than Sphero. Each robot type translates this value differently into a real world speed Sets the speed of the robot from -255 to 255, where positive speed is forward, negative speed is backward,Īnd 0 is stopped. SpheroEduAPI ¶ roll ( heading : int, speed : int, duration : float ) ¶Ĭombines heading(0-360°), speed(-255-255), and duration to make the robot roll with one line of code.įor example, to have the robot roll at 90°, at speed 200 for 2s, use roll(90, 200, 2) set_speed ( speed : int ) ¶ For example, if you set heading = 0°, speed = 60, duration = 3s, the robot would roll forward for 3s at a moderate speed. Sphero robots move with three basic instructions: heading, speed, and duration. You can use sequential movement commands by separating them with line breaks, like the Hello World! program. Movements control the robot’s motors and control system. set_main_led ( Color ( r = 0, g = 0, b = 255 )) droid. find_toy () with SpheroEduAPI ( toy ) as droid : droid. Import time from spherov2 import scanner from spherov2.sphero_edu import SpheroEduAPI from spherov2.types import Color toy = scanner. SpheroEduAPI.get_vertical_acceleration().
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |