Trouble with USB drone connection to Python on boot using DroneKit on RPI

I am trying to activate a solenoid valve when a certain switch is flipped on a transmitter, and I got that working to some degree, but only under certain circumstances. It only works if I boot the RPI, then connect the MicroUSB to the Cube, and THEN launch my program.

When I try to leave the MicroUSB connected when I reboot or unplug and plug in the RPI, I get the message ‘device reports readiness to read but returned no data’ until I unplug and replug it in.

Do not use USB in flight…

Why do you need a Raspberry Pi to manage a solenoid? Just use an RC command?

Sorry, I am very new to this scene in any capacity. How should I use the RC command to control the solenoid? How would I do that without some RPI or Arduino?

Just set up the output as a relay in ardupilot

I get the message ‘device reports readiness to read but returned no data’ until I unplug and replug it in.

That sounds awfully similar to this other report:

  • read() on the FD is just returning zero bytes
  • a reboot command (PREFLIGHT_REBOOT_SHUTDOWN) can be sent to the pixhawk, and does cause the pixhawk to reboot
  • comms are OK after the pixhawk reboots

@patdan10, when this happens, are you also able to reboot the pixhawk via dronekit/pymavlink (by sending a PREFLIGHT_REBOOT_SHUTDOWN MAVLink command)?