Control of PWM on navigator board from ground station

Hello BlueRobotics

We have a set up of a raspberry pi with the navigator board on top of it. We are trying to control the 16 PWM pins on the navigator board from a ground station, we are using pymavlink to send commands between the ground station and the raspberry pi. We have succeeded in retrieving data from the board using pymavlink. However, we are having trouble controlling the PWM pins on the navigator board, we have tried using MAV_CMD_DO_SET_SERVO however we are not able to control the PWM with this. The code we are using right now is

from pymavlink import mavutil

connection = mavutil.mavlink_connection('udp:')

target_system = 1 # Set the system ID of the autopilot
target_component = 1 # Set the component ID of the autopilot
servo_no = 5 
pwm = 2000

msg = connection.mav.command_long_send(
    target_system, target_component,
    servo_no, pwm, 0, 0, 0, 0, 0)

Hi @Alstrup, welcome to the forum :slight_smile:

I believe this comment should cover what’s going wrong, and how to fix it. If that doesn’t resolve it, please feel free to follow up with some more information of your current parameters and software versions, and what you’re ultimately trying to achieve.

As a side note, I’ve edited your post to use a code block, to make the code easier to follow and copy as relevant. Please see the How to Use the Blue Robotics Forums post for more information about what’s possible :slight_smile:

Hello Again Elliot

Ty for the reply, we have now achieved to send a PWM signal through the navigator board which is great!

However we also have a problem with blueos. We have installed Blueos on our raspberry pi and want run python scripts directly on the pi. However, when we create a file and then reboot the pi(Blueos), the file is deleted.

We are running the 1.1.0-beta 15 version of blueos.

Great to hear :slight_smile:

BlueOS core runs as a Docker container, so files created inside it will generally not be persistent across restarts of the container (including when the RPi gets rebooted). There are some directories that are mounted to the container to provide persistent access to the underlying filesystem on the RPi*, including the userdata folder, which was introduced in beta15 and is the most relevant one here - if you update to >= 1.1.0-beta.16 it will also be visible in the File Browser (and at /shortcuts/userdata in the Terminal). You can also use the red-pill command in the Terminal to access the base operating system from the BlueOS core container.

That said, while arbitrary local storage can be used for initial development purposes, custom functionality should ideally be developed into an Extension, so it’s easier to manage and share :slight_smile:

I see
Thank you for all the help mate!

1 Like