I’m not normally a guy that cares that much about my development environment, build pipeline, version control and so forth. Usually I view that as extra uninteresting fluff, and prefer to spend time on the coding part of programming. Normally I have the luxury that someone else takes care of all that stuff for me, but this time its only me and Rolf (the robot). So, I guess I should spend some time to set up an environment and a pipeline of sorts.
Let’s go over what the starting point looks like now. I have the VNC viewer application to remote into Rolf’s Raspberry Pi environment. The Raspberry comes bundled with some text editors and a python IDE. All the source code from Hiwonder is stored on the SD card of the robot, but is not under any source control, and I have no way to construct an os image from scratch that gets the Rolf up and running. So let’s try and come up with a plan.
- Create a complete backup of the SD card so that I can recover from fuck-ups
- Find a way to install all necessary packages from a clean Raspberry Pi os install
- Clone down the official stock TonyPi SW.
- Set up the TonyPi SW so that it boots into an operational robot.
- Create some project structure to avoid a mono-repo of everything.
- Set up version control and decide if I want to self-host or not.
- Set up Visual Studio Code with an ssh extension so that I can program and deploy without VNC.
Introducing source control
So, after poking around a bit more inside Rolf’s OS it seems that the whole home directory of the raspberry pi is a git repo. Querying git for the remote points us to a Chinese git host and Aiden Wei’s personal profile. Sadly, the repo is not public, and I can’t find any links to it on the HiWonder website. In the appendix of their downloadable lessons however, it says that source code is available upon request, so I have contacted Hiwonder support to see if they will send it to me. But, until that code eventually arrives I guess it will have to suffice with my own backup.
It seems to be one main git repo in the home directory that includes the LAB_Tool, TonyPi sdk, a toolbox folder and the language setting software. It also includes a git submodule with the servo tool. My plan is to make all the hiwonder provided sw into submodules and replace the main repo with my own.
Initially I thought that self hosting my repo would be a fun idea, since I have this fancy website and all. But it seems that getting git to work with the ftp server that my hosting service provides require some clever finagling. I will have to mount the ftp server as a local drive on my computer and trick git into working with it as a local drive. I’ll try and see if any of the visual studio code plugins make this a seamless experience, if not I guess I’ll have to throw in the towel and just stick with Github or Gitlabs like normal people do.
Update: So Hiwonder responded to my request and sent me a link to the source code. I took a look at it and its simply the contents of the Hiwonder folder already loaded onto the raspberry pi. Also comparing the dates on the received source code and the code loaded onto the Raspberry Pi indicate that there are no differences between the two versions.
So I did some soul-searching regarding hosting the source code and all that. I’ve now spent a couple evenings fiddling with different options, and I think its time to just say “fuck it”, host the code on Github for now, and move on to more interesting stuff. I can always migrate the repos later, and the structure of them are likely to change a lot as the project moves on. There’s simply no use to overcomplicating the perfect setup right now. Eventually I want to include the source code on the project page for Rolf on this website, but until the itch to do more webdev reveals itself I’ll just mess around with private repos for now.
The repo
So after fiddling a bit I ended up with a repo on Github with all the source code for the TonyPi robot.

I tried out the git submodule feature as a form of package management. Some of the source code for the project is public repos, such as “pigpio” and “mjpg-streamer,” those dependencies are linked directly to the original repos. I created some private repos to host the Hiwonder SW which I do not have the rights to post. I imagine that my code for Rolf will be its own nested repo here.
I kept the project structure very flat as I’m not completely sure how all the components are linked together as of now. But I should probably refactor a bit to consolidate all the Hiwonder-stuff into one repo. I’m thinking of introducing a HW abstraction layer or something down the road so that I can run control algorithms either on actual HW or on a simulator. So I’ll postpone the refactoring until then, this should be good enough for now.
Playing around with visual studio code
As I said earlier I often have the luxury that I don’t need to configure my own IDE, but here its only me and Rolf. Since Rolf isn’t helping much I will have to figure something out. I started with visual studio code, since I’ve heard so much praise for it, but never used it myself. I installed extensions for python and compilers for c++ and rust and created some simple “hello worlds” for the three languages. And I tried out Github’s Copilot, I’m a bit late to the party as usual but my first impression is super good. It seems to do great when queried with the hiwonder source-code, and I hope I can use it to generate some boiler plate code for me.
Finally there’s the remote development package for visual studio code. This package let’s me ssh into the raspberry pi and work directly on the code there, this is great as I don’t have any proper way to deploy to the target platform yet. However, I haven’t figured out how to get copilot to work across the ssh connection, it seems to want me to install the copilot extension onto the Pi itself and that seems a bit backwards. I googled a bit and there seems to be ways to forward the copilot extension over the ssh connection. I’ll try those out and report back at a later time.
Deploying to target
So the last steps of my todo-list are complete: I have my source code under version control, I have a dev environment and I have a way of executing that code on Rolf, the robot. But I still do not have full control of the whole SW stack, and I haven’t checked the second bullet point. I have no way of creating a clean system image and configuring it to be ready for my code. I’m still a noob at raspberry pi robotics, and I don’t fully understand how the Hiwonder SW actually registers to the OS, and getting that knowledge seems to take some time. Additionally if or when I actually migrate to ROS I might have to reconstruct all this another time. So I’ve taken a shortcut, I have the complete working system image that Hiwonder provides backed up somewhere, and I know how to layer my changes on top of those. Until I have a better solution in place, that will be my recovery plan in case of complete fuck-ups and the need to reconstruct Rolfs programming from scratch.