This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to choose 'compass' mode when route is active
#8
(2019-09-04, 01:04 AM)ironman Wrote: To get back to my own original topic again :-) I found that the following change to the body of receive_nmea in nmea.py in the tinypilot does allow me to switch to compass mode even when a route is active. 

        if line[3:6] == 'APB' and time.time() - self.last_apb_time > 1 
            and self.last_values['ap.mode'] == 'gps' and self.last_values['ap.enabled']:
            self.last_apb_time = time.time()
            data = line[7:len(line)-3].split(',')
            #if self.last_values['ap.enabled']:
            #    mode = 'compass' if data[13] == 'M' else 'gps'
            #    if self.last_values['ap.mode'] != mode:
            #        self.client.set('ap.mode', mode)

            command = float(data[12])
            xte = float(data[2])
            xte = min(xte, 0.15) # maximum 0.15 miles
            if data[3] == 'L':
                xte = -xte
            command += 300*xte; # 30 degrees for 1/10th mile
            if abs(self.last_values['ap.heading_command'] - command) > .1:
                self.client.set('ap.heading_command', command)

I had overlooked what was said in another thread, in which you explain the background of this functionality. I understand the design rationale now, but still, for my purpose I'd like to have it switched it off, like above. Is it possible to make this behaviour dependent on a parameter, so it can be switched on or off by an end user without having to change code?

Thx,


Yes, this is an alternative.  You want the active route to work only in gps mode.

The other way is convenient because you don't need to switch modes when you activate the route.  So it is a tradeoff.  Not sure if using compass mode to dodge is best, normally you can use manual control.

As far as processing the waypoints in pypilot and using the buzzer, it's possible but not implemented.   I don't really see the reason since it is implemented in opencpn already.   Opencpn can play a sound.   Also, the autopilot_route_pi plugin for opencpn provides alternate processing of route following.   It also provides optional confirm dialog on waypoint arrival to do what you asked for, but rather than switching back to compass course, it holds the gps course.

If you want to do this logic in the actual autopilot, how do you want to acknowledge waypoint arrival?

Are you sure using waypoints and arrival radius is the best way to follow a route? Just because old systems used it doesn't make it best. I prefer route position bearing, where the heading is constantly recomputed toward a position forward along the route, so waypoints have no significance and the boat makes better turns.

I can see how different modes might be better in different situations, and I am also curious about a route following logic using wind steering mode, automatically trying to predict future position of the boat via tacks if needed.
Reply


Messages In This Thread
RE: Unable to choose 'compass' mode when route is active - by seandepagnier - 2019-09-04, 01:36 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)