Unitree Go1 Canbus & Autostart

Good day, everyone.

This is my first post here. I am Carlos an Electrical Engineering Student. I found a lot of useful advice on this site and decided to make an account and ask a question I couldn’t find the answer to. I am not part of the droneblocks program or curriculum, so if the forum is only for those, I hereby apologize.

I am currently doing a project with the Unitree Go1 EDU and I have been able to mostly get it to do what I want it to do.

My project is to control the Go1 with a joystick using CANbus. This has gone smoothly until now. I connect through UDP to the Go1 using my laptop(Ubuntu) and execute a modified python(and C++) code through the LeggedSDK to make it move. To do this I use a USB to CAN converter on the physical side and SocketCan and PythonCan to code with CAN signals.

The last step to complete this project is to make the Go1 execute this code on startup and read the can signals (via USB connection to the Raspberry), but since i haven’t been able to find any backups to the Pi or the Nano’s I have been kind of afraid to edit the files in the Go1 itself.

Is there a way i can add my code to startup without negatively impacting the Go1? and would it be possible to install can-utils on the Go1 Raspberry to let it read and interpret signals from the CAN converter?

As i mentioned before, if this is the wrong place to ask about this or i am missing something obvious i apologize.

Thank you for your time.

Hi Carlos, welcome to the forum and it sounds like a cool project that you’re working on. We’d love to hear more about it when you have time. Is your code fairly isolated where you could run it as a systemd service? I could help you set that up if you haven’t done it before.

Raspberry PI startup script using Systemd - PragmaticLinux

If your implementation requires modifying some of the startup scripts and modifying other files then let me see if I can ask @ryan about it. I know he’s made some startup modifications in the past and I believe there was an RPi image provided by Unitree at some point. Not sure if there are images for the Nanos though.

I haven’t done any canbus work with Go1 but it looks like you can install can-utils via apt. I don’t think that should have any negative impact on your system. But let me see if we can dig up some more info. Let us know how your code runs and if it’s possible to run it as a separate process with having to modify any existing processes.

Good luck with your project!

Hi @dbaldwin , thank you for your welcome and response.

I am not very experienced with Linux in general, so I didn’t know about Systemd yet. Thank you for sharing this. I have not uploaded my code into Go1 yet, just in case. But we did manage to install can-utils and use a config so that the CAN kernel modules are loaded on boot.

We also used Systemd to make a .network that configures our chosen CAN connection to always run at a certain bitrate and that, in the case of an off event, keeps trying to reconnect.

The idea was to ssh a Python script into the SDK files of the Go1 and make use of Systemd or Cron to have it launch on boot. The script simply reads the CAN signals and uses high-state SDK commands to make the Go1 move in response.

But I have seen that the SDK in the Go1 doesn’t have any amd64, so I assume that Python scripts won’t be able to run on the Go1 itself? Maybe I am looking at the wrong location (Unitree/sdk/unitree_legged_sdk)? I could write a C++ variant if that is needed in this case.

My idea may very well be a crude way of doing this, if not impossible at all. Should I maybe try to do something different? Like making use of shell executables? Is it something I am missing?

Once again, thank you for your time and response. :slightly_smiling_face: