1 minute read

Summary

This week, I collaborated with the community to identify and resolve bugs, as well as review various pull requests. My primary contribution involved setting up a CI/CD pipeline to enforce a uniform code style and standardizing the frontend’s interaction with both the Robotics Backend and the BT Studio backend.

Style Pipeline

During my collaboration last week, I noticed that developers often introduced unnecessary diffs due to inconsistent code styles. As the project approaches maturity, it is becoming critical to address these issues.

After consulting with the developers, I configured two GitHub workflows: one for Python and another for JavaScript/JSX files.

For Python, we opted for the Black Formatter, a PEP8-compliant, opinionated code formatter. For JavaScript, we chose Prettier, one of the most widely adopted formatters in the industry. Currently, these pipelines are configured not to auto-format the code, as we believe that each developer should be responsible for writing code that adheres to the established style guidelines and familiarizing themselves with the formatting conventions.

Refactoring with Async Functions

The BT Studio frontend had been increasingly relying on complex promise chains to manage communications with the Robotics Backend and the tree_api. To improve this, I proposed refactoring the codebase to utilize async functions. By allowing the use of the await keyword, async functions enable more readable and maintainable code, effectively handling asynchronous operations with cleaner promise-based behavior.

Subtrees in PyTrees

This week, I also began exploring how to integrate subtrees into PyTrees, the Behavior Tree library used in BT Studio. In BT Studio, the graphical diagram is converted from JSON to XML, which is then parsed and executed by the tree_gardener library. This library constructs the trees as BehaviorTree objects within the PyTrees framework. I discovered that PyTrees provides methods for inserting subtrees and performing various tree operations. I have started conducting offline tests to better understand and implement these features. I discussed with my mentors to make some offline demos for next week.

Other contributions

Contributed PRs

Reviewed PRs