Home        Store        Docs        Blog

Unable to set manual mode via set_mode_manual()


#1

Hello everyone,

I am currently attempting to write a workaround for the FS_PILOT_TIMEOUT on the BlueROV2, which automatically disarms the ROV after a certain amount of seconds once it starts receiving ‘rc’ commands from the user. My aim is to prevent the ROV from automatically disarming itself.

The method I am using is to rapidly send MODE_MANUAL commands to the ROV, by calling mavutil.mavfile.set_mode_manual() at high frequencies. Unfortunately, the Pixhawk doesn’t appear to receive the command, and MAVProxy instead raises a RuntimeError(‘no write() method supplied’), which is thrown by mavutil.mavfile.write(). After examining the stack trace for the function, I discovered that the caller for write() is send(), located in the file pymavlink/dialects/v20/ardupilotmega.py. Surprisingly enough, the send() function doesn’t appear to include any command for sending commands to the Pixhawk:

def send(self, mavmsg, force_mavlink1=False):
      '''send a MAVLink message'''
      buf = mavmsg.pack(self, force_mavlink1=force_mavlink1)

      self.file.write(buf) <<<<<<<<here's where mavutil.mavfile.write() is called

      self.seq = (self.seq + 1) % 256
      self.total_packets_sent += 1
      self.total_bytes_sent += len(buf)
      if self.send_callback:
          self.send_callback(mavmsg, *self.send_callback_args, **self.send_callback_kwargs)

The full calling pattern is:

set_mode_manual() -> command_long_send() -> send() -> write()

Even more surprising, I actually managed to use this technique successfully just last week, and the ROV was able to follow ‘rc’ commands without disarming, even with long intervals between each command.

Any insight would be appreciated. Thank you.


(Jacob) #2

Hello. I am sorry, but I do not understand why you are going through all of this trouble. Please correct me if I am missing something.

The ‘rc’ command is just a shortcut to send the RC_CHANNELS_OVERRIDE message. You simply need to send the RC_CHANNELS_OVERRIDE message at a regular interval. Is there a problem doing it this way?

Also, another console command you might find useful is ‘long’, which is a shortcut to send COMMAND_LONG messages.

-Jacob


(Jacob) #3

Another option would be to disable the failsafe via the FS_PILOT_INPUT parameter.


#4

Thank you for the reply, Jacob. I had initially only set the FS_PILOT_INPUT parameter to disabled, but it was still disarming itself. To be safe, I ended up setting all the FS failsafe action parameters to warn only/disabled, and now it works like a charm.

Thanks again for all the help, you saved me a lot of time!