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
No communication between RPi and Nano using pypilot service
#1
Hi everyone

I'm building a navigation system including pypilot, and I'm currently having som trouble getting pypilot to talk to the Arduino. Below is a list of my hardware and the software I've installed.

Hardware:
RPi4, 8 GB with 64 GB SD-card in HighPi Case with fan
IMU 9250 mounted on snappable protoboard as a HAT
Arduino Nano (original) connected to RPi via USB cable
GPS on a USB cable
Keyboard, mouse and 13.3" screen
Potmeter for rudder sense

Breadboard, various wires, cables, resistors, LEDs and whatnot
Two channel 5V relay for allowing 12V signal to rudder control. The boat has permanent hydraulic pressure available, and the rudder is controlled by opening one of two sets of solenoid valves - so no pwm is required, just 12V for either starboard or port. Trying to move the rudder past end of travel has no consquence, the rudder just stops.

Software:
Lysmarine BBN 2022-06-23 (OpenPlotter 2 won't boot on my RPi 4, unfortunately)
OpenCPN 5.6.2
Pypilot plugin 0.34.4.0
Pypilot 0.34

I've used Arduino IDE (preinstalled in BBN, version 1.8.16) to install motor.ino onto the Arduino after applying below changes:
Disabled temp-sense
Disabled voltage-sense
clutch_pwm = 255 (is this the correct way to apply full signal without pwm ramp-up?)


When I start the pypilot plugin in OpenCPN, it is disconnected from pypilot. After hitting config and OK it connects (127.0.0.1), but reports "No Motor Controller" (and Tx and Rx on Nano stay off). Using terminal to first stop pypilot service (sudo service pypilot@pypilot stop) and then run it (pypilot), the OpenCPN plugin changes state to idle, and Tx and Rx start flashing.

I've grounded all analog pins on the Nano (except A4) through 1kOhm each, and connected A4 to the center pin of the potmeter, with the two outer pins connected to 3.3V and GND, respectively. Measuring the voltage between A4 and either 3.3V or GND using a voltmeter gives the expected values (perfectly linear from 0 to 3.3V when turning the potmeter), but in pypilot calibration, the rudder mostly reports False with sometimes erratic values (both positive and negative, sometimes within +/- 10, sometimes above or below 1000 - potmeter position doesn't seem to influence this value).

Is there a difference between the services pypilot and pypilot@pypilot, and could this have anything to do with my troubles?


To sum up, I have the following questions:
1. Is "clutch_pwm = 255" in motor.ino the correct way to disable ramp-up for rudder control?
2. Why does pypilot service fail to communicate with the Nano when pypilot run in terminal does?
3. Why does pypilot not read A4 correctly for rudder sense?
4. Which pins on the Nano should I use for controlling the relay (one pin for starboard and one pin for port)?


Thank you in advance Smile

Best regards, Jonas.
Reply


Messages In This Thread
No communication between RPi and Nano using pypilot service - by Jonas.EH - 2022-07-21, 02:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)