1 minute read

During this month, the project improved significantly.

First, Oscar identified several issues I had while using the network:

  • Using an incorrect initial position
  • Sending the absolute position instead of the offset from the default position
  • Projecting gravity onto the base instead of the pelvis
  • Assuming that the network returned the values in the same order used by the simulation

After identifying these problems, he developed a new version of the code that fixed them.

Once the issues were solved, I spent some time understanding the new implementation and later modified it.

I integrated the three-thread architecture from the previous post into Oscar’s code, introducing two main changes:

  • The first change was modifying the robot’s movements to better observe its rotation.
  • The second, and most important one, was changing how the threads handled timing.

The simulation runs much faster than real time. For example, a 16-second simulation only takes around 2.7 seconds to execute. Because of this, the control thread was not behaving correctly: when the initial 2-second waiting state finished, the simulation was already close to ending.

To solve this issue, I started using simulation time instead of real time inside the threads. However, since it is difficult to know exactly how long each thread should wait before its next iteration, I implemented a micro-sleep strategy. The threads repeatedly sleep for very short periods until the simulation time reaches the next scheduled execution point.

G1 walking G1 walking routine

Summary

  • Understanding Oscar’s code
  • Integrating the three-thread architecture
  • Fixing timing issues in the threads

Categories:

Updated: