Course 3 / Lecture 6:

Orientation in space, the gyroscope sensor

This lecture is about measuring orientation using a gyroscope. It will explain how you can gather information from the gyro sensor shipped with your Lego robot, and it will also help you understand important terms like roll, pitch, yaw. The gyroscope is used for controlling movement of robots. They are also used to detect unexpected events, such as when a robot falls or rolls over.

Look how simply you can connect the sensor.

The Lego Gyroscope sensor can be easily connected to ports of the Lego Brick. You can find these ports bottom of the Lego Brick. The brick can automatically detect all connected input or output devices and let's you use Ozeki 10 reach those devices via Bluetooth. You can see how easy to connect the Gyroscope sensor to the Lego Brick on Figure 1 below.


Figure 1 - Gyroscope sensor connected to the Brick

Requirements




Video tutorial: 'How to use the Lego Gyroscope sensor in Ozeki 10'




Task #1:

Open Control Panel!

Before continue reading please make sure that the gyroscope sensor is properly connected to right port of the Brick. If the Brick has not been paired to your computer yet, please pair it by checking the guide of Bluetooth pairing at http://www.ozeki.hu/index.php?owpn=6065. After you have connected the sensor to your Brick and paired it to the PC, you need to open your webbrowser then navigate to the following URL: http://localhost:9505. Please log in with your username and password that you have entered during the installation progress then click on the Control Panel like Figure 2 shows.


Figure 2 - Ozeki 10 Dekstop

Task #2:

Select the Gyroscope sensor from list!

After you have opened the Control Panel, you will see all the previously installed connections as you can see on Figure 3. If your list is empty you should install the 'Lego' connection. To do this please check out the guide for installing Lego connection at http://www.ozeki.hu/index.php?owpn=6067. Although if you have already done this, please select the gyroscope connection like on Figure 3. You should find it between other Lego Mindstorms connections. By default it is called 'Gyro_Sensor_1'.


Figure 3 - Selecting Lego Mindstorms EV3 Gyroscope Sensor

Task #3:

Subscribe to sensor events!

Please type 'subscribe' and hit enter (Figure 4), so Ozeki 10 can easily receive messages through chat. The gyro sensor can work from the chat interface. If you did not subscribe, you will not be able to access information using 'read'. The 'subscribe' command can start to follow device events. After subscribing, you can read receive messages arriving from the Lego Gyroscope Sensor to Ozeki 10. Additionally by typing 'help', you can list all available gyroscope commands for Ozeki.


Figure 4 - Subscribing to all gyroscope measurements, including angles or rotation speeds as well

Task #4:

Read the angle of the gyroscope sensor!

With 'read' you can measure the angle state of the gyroscope as seen on Figure 5. It is good to know that it is provided in degrees. You can type 'calibrate' and hit enter to set it to 0°. During calibration please do not move the sensor. As a matter of fact you should steadily hold it for approximately 1 minute. Please test it after calibration by typing one more 'read'. You should read 0° for the sensor's angle state. You can move the sensor and type read anytime you wish.


Figure 5 - Check the current angle with 'read' anytime you wish

Task #5:

Change sensor mode to 'Movement rate'!

On the sensor's top panel you will find a 'Configure' tab page (Figure 6), which is used for changing the sensor mode to measure 'Movement rate' instead of the actual angle. The movement rate constists of a direction (- or +) and a rotation speed measured in angles per second. Keep in mind if the angle speed is positive, the rotation is clockwise, if it is negative, the rotation is counterclockwise.


Figure 6 - Changing gyro sensor mode to 'Movement rate'

Task #6:

Read movement rate!

Please switch back to the 'Chat' panel to read the rotation speed of the gyroscope. On Figure 7 you can see the gyroscope swinged in a counterclockwise direction. The read command was sent during the maneuver, which you can find in the video tutorial too. Try changing movement direction to clockwise and read the movement rate again. This type of measurement can be used in the future to make sure your Lego motors rotate other components as fast as possible.


Figure 7 - 'Read' movement rate

Task #7:

Check the low level communication of the sensor!

You can check the history of the gyroscope sensor communication by navigating to the 'Events' panel on the top of the GUI as you can see it on Figure 8. On it you can see the exact dates and time when the sensor received or sent messages. This tab makes you capable to access data in more details. Approximately all communication between the gyroscope sensor and Ozeki 10 can be found here, unless you have cleared the 'Events' textbox or decided to stop refreshing it.


Figure 8 - The 'Events' tab shows all message communication of the sensor




The Lego Mindstorms EV3 Gyroscope commands set for Ozeki 10

The tables contain the Lego gyroscope commands you can use with Ozeki 10. These commands can be sent through Ozeki 10 chat by yourself if you click the blue 'Send' button on the bottom right hand side of the chat window. This is how you saw it in the steps above. It is good to know that by typing 'help' you can list all commands you can see in the tables below and read descriptions too.

Command examples Description
read read gyroscope sensor angle value
calibrate recalibrate your gyro sensor angle to 0°

Commands Table - Calibrate or read Lego Gyroscope data

Basic commands Description
help request the command set
subscribe subscribe to device messages
unsubscribe unsubscribe from device messages
subscribers shows the list of subscribers

Basic commands Table - General commands for all devices

More information


Next


Copyright © 2000- |Ozeki Ltd | info@ozekirobot.com |
Page: 6088 | 79.99.42.43 | Login