![]() ![]() ![]() R2-D2 and R2-Q5 that combine movement, lights and sound. Plays iconic Star Wars Droid animations unique to BB-8, BB-9E, SpheroEduAPI ¶ play_animation ( animation : IntEnum ) ¶ Star Wars Droid Movements ¶ class spherov2.sphero_edu. Nearby metallic and magnetic objects can affect the accuracy of the compass, so try to use this feature in an area without that interference, or hold it up in the air if you can’t get away from interference. Sphero BOLT has a compass (magnetometer) sensor that has unique functionality. Resets the heading calibration (aim) angle to use the current direction of the robot as 0°. To full power for 4s, making the robot jump off the ground, use raw_motor(255, 255, 4). To the motors, whereas Set Speed is a target speed measured by the encoders. This is different from set_speed() because Raw Motor sends an “Electromotive force” The robot will jump because stabilization (use of the IMU to keep the robot upright) is disabled when using Where positive is forward, negative is backward, and 0 is stopped. raw_motor ( left : int, right : int, duration : float ) ¶Ĭontrols the electrical power sent to the left and right motors independently, on a scale from -255 to 255 However, you can control the motors using Motor Power with raw_motor() when When stabilization is off you can’t use set_speed() to set a speed because it requires the control system Gyro: Programs like the Spinning Top where you want to to isolate the Gyroscope readings rather than having Jumping: Set Motor Power to max values and the robot will jump off the ground! Or even jumping if you set the power very high. The robot will not balance, resulting in possible unstable behaviors like wobbly driving, When set_stabilization(false) and you power the motors, Stabilization is normally on to keep the robot upright using the Inertial Measurement Unit (IMU),Ī combination of readings from the Accelerometer (directional acceleration), Gyroscope (rotation speed),Īnd Encoders (location and distance). Turns the stabilization system on and set_stabilization(false) turns it off. Note: Unlike official API, performance of spin is guaranteed, but may be longer than the specified duration. Use set_speed() prior to spin() to have the robot move in circle or an arc or circle. Spins the robot for a given number of degrees over time, with 360° being a single revolution.įor example, to spin the robot 360° over 1s, use: spin(360, 1). For example, use set_heading(90) to face right. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |