Data logging the behavior of the LEGO Mindstorms Robot and its Gyro Sensor Pro Preview

This video tutorial is about understanding the "magic". In this video tutorial, we would conduct an experiment and will look at how exactly does the integral part of the PID algorithm compensate for the error that the LEGO Mindstorms EV3 robot makes. 

 

  • #658
  • 10 Jan 2018
  • 9:11

Logging into a datalog file

We can not conduct an EV3-G experiment because we need to use the sensor. But we can do the following - write into the datalog file and then open the file with LibreOffice and plot a graph. In this way, we could see what is the value of the Gyro sensor and what is the value of the integral part and then understand how does the integral part affects the behaviour of the robot. 

Compensating with the integral part

When the robot slightly moves to one side it makes an error. This error is added to the integral part and the integral part increases. As it increases to about 7-8 the robot start correcting for this error. This is the value of the steering and the robot turns slightly back to the line. You could see the graphic below where with Red you have the values of the integral part and with blue the values of the gyro sensor.

Spreadsheet files for plotting the Gyro Sensor Behaviour

In this spreadsheet, we have the values for the Integral part and the Gyro sensor for moving straight with the robot.