AVRGUI and servos

We need to program 2 servos to spin much more than the standard open close on the AVRGUI. We are so lost on how to edit this command. Can someone please tell me how to do it? I do not understand the sandbox or VS. We are just completely lost on this front.

I feel ya brother, It took a bit to understand how to properly write code for the AVR but I was fortunate enough to have years of prior background in programming and CS. Even with my experience, understanding the structure of writing sandbox code was still difficult, so with your willingness to learn I am more than happy to help.

First and foremost, the Bell-provided servos have a hardware limitation that doesn’t allow past 180-degree movement; I have heard of teams purchasing 360-degree servos and utilizing them but have never actually seen it or attempted it myself. If anyone has more information regarding it you should definitely post about it :).

Secondly, VS code is an IDE ( Integrated Development Environment ) which summed up is an application to write and run code. There are a million online resources on in-depth ‘how to’ use VS Code. Here’s one: Official Learn VS code in 7 Minutes. Once you have a general understanding of VSCode you need to connect to the AVR via Remote Development. Power up your AVR & follow the remote desktop documentation, if you have any issues with the remote desktop connection try plugging in an ethernet ( this isn’t mentioned in documentation but helped us a lot. ). Once you’re successfully connected, you can begin programming in the AVR-2022/VMC/sandbox.py.

How you might ask? This is programmed in Python ( Learn basic syntax here ). The stock sandbox.py comes with information on the architecture and some examples however, this alone won’t get you far so I highly recommend you familiarize yourself with the AVR-Python-Libraries and Sandbox Architecture documentation.

Lastly, here are some notes/additional information I’d like to include to get you on your way.

When Subscribing to a Payload’s Messages ( Reading information ):
This is the tricker brother of the two as it has a little bit of prerequisites before you can actually get the information, and even when you do so it’s not exactly how you think.
Make sure you import the class at the beginning of the program

from bell.avr.mqtt.client import (  # MQTTModule class from the MQTT client library
from bell.avr.mqtt.payloads import (  # Importing a specific payload class for message handling

Update the topic map to include your payload and function

 self.topic_map = {
            "avr/fcm/status": self.handle_status_message,
            "avr/vio/confidence": self.handle_vio_message,

Define the payload in the parameters within the function.

def handle_status_message(self, payload: AvrFcmStatusPayload) -> None:

Concluding the prerequisites it’s worth noting that the function is RUN WHEN THE PAYLOAD IS SENT alongside its information. You’re able to access the payload information within the function via


When Sending a Payload Message ( Sending Actions ):
There are no requirements for importing classes or mapping topics. You just need to use the function


One last thing: make sure to check you are using self. when needed.

Hope this helps :slight_smile: - Tyler w/ Team Atlas 78867A


I am limited on knowledge of editing the GUI however, There was a forum post regarding it not that long ago that can help you. How to compile GUI after making changes to code

1 Like

My team has done some work with 360 degree servos and continuous servos and 360 are mostly the same. 360 servos can be controlled almost exactly like 180 servos the PWM signals are slightly different but they still are the same range just map deferent. For continuous servos all you do is specify forward or backwards and the servo will then move you can do this by sending the “open” or “close” payload.

On thing I did not see mentioned is that you should not need the sandbox to control servos the easiest way that we have done that is sending a message like with this function in the GUI.

def set_servo_pos(self, number: int, position: int) → None:
Set a servo state
AvrPcmSetServoAbsPayload(servo=number, absolute=position),

If the PCM module is compiled on the drone (if not you can run ./start.py run pcm) then the pcm will handle the servos you don’t need to mess with the sandbox code the pcm will handle all of the servo code then to change the move angle you can call the function with a deferent position.

Hope this helps,
Jack w/ Team 2468

1 Like