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
Pypilot GPS and Windvane
#1
Hello,

I'm using Openplotter on a rpi3.
On the new version, there is pypilot.

I've bought a windvane and I use a usb gps mouse. The windvane output NMEA0183 (for example: $IIMWV,045.0,R,000.00,N,A which has no wind because i test indoor).

I can't have it working. I've tried to attribute serials ports on pypilot (which is ok, they appears on the autopilot tab) but on client, wind.source stay to none.
It doesn't seem that I can output kplex or signal-k to pypilot (so I attribute serial to pypilot, which output then on nmea).

Moreover, if i attribute gps and/or windvane to pypilot, pypilot output gps (and compass, since my imu is ok with pypilot) on nmea (port 20220) but never windvane. Is there something missing somewhere ?

Thanks !
Reply
#2
Are you in OP v1.x.x?

You have just to assign your windvane to pypilot in serial tab, enable basic autopilot in pypilot tab and it should be available in port 20220
Reply
#3
Yes, i'm in OP v1.0.1
I think we have find why it doesn't work. Our nmea windvane doesn't compute checksum (only A if good or V if bad), so I think vane sentences are ignored by Pypilot.
I've successfull added checksum with red, but I can only output red on physical port or on network (i don't think I can output to a virtual /dev/ttyXXX), so it doesn't help for pypilot. Is it possible on pypilot to get data on nmea bus insead of on physical port ?

Thanks
Reply
#4
Maybe creating a virtual port?
@Sean?
Reply
#5
pypilot can receive nmea data on port 20220. It will always ignore messages with bad checksums.

Messages received by serial ports are output over tcp at a max rate of 2 times a second.
Messages received by tcp are not relayed to tcp or serial, they are only used internally.

In either case, messages are used internally by pypilot at the full rate. So yes, you would need a valid checksum on the wind sentence for the wind source to work.


If it was relaying gps data already, then I'm pretty sure the problem for wind is a failed checksum which is silently ignored. You should try sending the wind sentence to port 20220, but keep in mind, it will only be used by pypilot, and not retransmitted over tcp to other connections. It would be possible to change the behavior quite easily by modifying nmea.py.

Try configuring your serial ports to "none" in openplotter, and add them just in opencpn. You should have wind and gps data in opencpn, and you can add a tcp connection to 20220, and be sure to checkbox for "output as nmea repeater or autopilot". Now pypilot gets the wind or gps from opencpn.


Let me know what you you tried, what you expect it to do, what you think it should do differently and we can improve things.
Reply
#6
I've digged a little more into the problem.

If i connect gps + wind directly to pypilot (attribution in "serial" tab of openplotter), Pypilot forward nmea gps to 20220 but not wind. But in pypilot client, gps source is set to none (and wind too), and i was unable to activate gps.

If I connect only gps on serial, it's not forwarded.

If I try to forward nmea (output) on kplex on port 20220, pypilot doesn't seem to receive data (even if wind has added checksum).

If I forward from node-red wind packet adding checksum to pypilot (on 20220), it work, i've the wind data on pypilot and I can use it !
So i do a node-red configuration outputing both on pypilot and on kplex (so I can debug easily).
I add gps on node-red.



I've digged a little more into the problem.

If i connect gps + wind directly to pypilot (attribution in "serial" tab of openplotter), Pypilot forward nmea gps to 20220 but not wind. But in pypilot client, gps source is set to none (and wind too), and i was unable to activate gps.

If I connect only gps on serial, it's not forwarded.

If I try to forward nmea (output) on kplex on port 20220, pypilot doesn't seem to receive data (even if wind has added checksum).

If I forward from node-red wind packet adding checksum to pypilot (on 20220), it work, i've the wind data on pypilot and I can use it !
So i do a node-red configuration outputing both on pypilot and on kplex (so I can debug easily).
I add gps on node-red.

Finally, i get this configuration:


[Image: node_red.png]


I listen on 40440 for kplex output and I connect to 127.0.0.1 20220 for pypilot output.

On kplex, i see that i've all my data (gps + wind).

On pypilot, wind.source is tcp, but gps.source still to none.

Since it's an usb gps mouse, and i've a lowrance elite 5 ti, i will try with the lowrance as source to see if it's the same.


Moreover, i don't know if it's important or not, but i've found somewhere in your code a typo (not sure but i think), MVW insead of MWV:

[Image: mvw.png]
Reply
#7
(2018-06-22, 11:05 AM)quetzal Wrote: I've digged a little more into the problem.

If i connect gps + wind directly to pypilot (attribution in "serial" tab of openplotter), Pypilot forward nmea gps to 20220 but not wind. But in pypilot client, gps source is set to none (and wind too), and i was unable to activate gps.
Try running gpsd and connect the gps to that. pypilot should automatically detect gpsd
Quote:If I connect only gps on serial, it's not forwarded.
It sounds like an issue with the serial port setup. What is in the file "~/.pypilot/serial_ports" ?

You should try pulling the latest git of pypilot. I just rewrote the serial detection, it should work better now.

Quote:If I try to forward nmea (output) on kplex on port 20220, pypilot doesn't seem to receive data (even if wind has added checksum).

If I forward from node-red wind packet adding checksum to pypilot (on 20220), it work, i've the wind data on pypilot and I can use it !
So i do a node-red configuration outputing both on pypilot and on kplex (so I can debug easily).
I add gps on node-red.

I know opencpn can forward both gps and wind just fine. You need $GPRMC sentence for gps. If node-red can do it, but kplex cannot, then there is probably something wrong with kplex, or it isn't connecting.
Quote:Finally, i get this configuration:


[Image: node_red.png]


I listen on 40440 for kplex output and I connect to 127.0.0.1 20220 for pypilot output.

On kplex, i see that i've all my data (gps + wind).

On pypilot, wind.source is tcp, but gps.source still to none.

Since it's an usb gps mouse, and i've a lowrance elite 5 ti, i will try with the lowrance as source to see if it's the same.
I would ensure you have $GPRMC with proper checksum going in. Try using opencpn (output to 20220), and/or gpsd. This is what I use. I don't use kplex, but it should work and I intend for it to work.
Quote:Moreover, i don't know if it's important or not, but i've found somewhere in your code a typo (not sure but i think), MVW insead of MWV:

[Image: mvw.png]
an old typo, this file isn't used, so it doesn't make a difference


I will be away from internet for 2-3 weeks, so I won't be able to answer much until after
Reply
#8
I think "~/.pypilot/serial_ports" was good because the list in openplotter was good to, but now i've removed all.

With gpsd all is working good ! With the cheap gps usb receiver it's ok. With the lowrance, it's not ok because lowrance don't send timestamp in nmea sentences !

So I've gpsd which is ok, and wind which is ok.
For information (if someone else has the same problem), the code on nodered to add checksum is:


Code:
var nmea = msg.payload;
var checksum = 0;


var nmea_stripped = nmea.substring(1, nmea.indexOf('\r\n'));

for(var i = 0; i < nmea_stripped.length; i++)
{
   checksum = checksum ^ nmea_stripped.charCodeAt(i);
}


checksum = checksum.toString(16);

padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;

while (checksum.length < padding) {
   checksum = "0" + checksum;
}

msg.payload = '$' + nmea_stripped + '*' + checksum.toUpperCase() + '\r\n';
return msg;



Now I only need the motor driver to test  Smile  (i've not "studied" the question of the motor driver for now, but you have published all the code so I only need the hardware part).

When I try to run the github version, i've an error:
Quote:min/max compass calibration not in use
Using ellipsoid compass calibration
Accel calibration not in use
LSM9DS0 init complete
Traceback (most recent call last):
  File "/usr/local/bin/pypilot", line 11, in <module>
    load_entry_point('pypilot==0.1', 'console_scripts', 'pypilot')()
  File "/usr/local/lib/python2.7/dist-packages/pypilot-0.1-py2.7-linux-armv7l.egg/pypilot/basic_autopilot.py", line 108, in main
    ap.run()
  File "/usr/local/lib/python2.7/dist-packages/pypilot-0.1-py2.7-linux-armv7l.egg/pypilot/autopilot.py", line 178, in run
    self.iteration()
  File "/usr/local/lib/python2.7/dist-packages/pypilot-0.1-py2.7-linux-armv7l.egg/pypilot/autopilot.py", line 317, in iteration
    self.servo.poll()
  File "/usr/local/lib/python2.7/dist-packages/pypilot-0.1-py2.7-linux-armv7l.egg/pypilot/servo.py", line 427, in poll
    device_path = serialprobe.probe('servo', [38400], 1)
  File "/usr/local/lib/python2.7/dist-packages/pypilot-0.1-py2.7-linux-armv7l.egg/pypilot/serialprobe.py", line 195, in probe
    devices = enumerate_devices()
  File "/usr/local/lib/python2.7/dist-packages/pypilot-0.1-py2.7-linux-armv7l.egg/pypilot/serialprobe.py", line 105, in enumerate_devices
    devices = scan_devices()
  File "/usr/local/lib/python2.7/dist-packages/pypilot-0.1-py2.7-linux-armv7l.egg/pypilot/serialprobe.py", line 89, in scan_devices
    if os.path.realpath(devices) in allowed_serial_ports:
  File "/usr/lib/python2.7/posixpath.py", line 375, in realpath
    path, ok = _joinrealpath('', filename, {})
  File "/usr/lib/python2.7/posixpath.py", line 381, in _joinrealpath
    if isabs(rest):
  File "/usr/lib/python2.7/posixpath.py", line 54, in isabs
    return s.startswith('/')
AttributeError: 'list' object has no attribute 'startswith'
got signal atexit cleaning up


I've some serials ports but connected to kplex / gpsd / node-red, i've not digged in the problem to see where is it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)