2023-09-16, 10:26 PM (This post was last modified: 2023-09-16, 10:26 PM by rbergevoet.)
As I mentioned in another thread (link), I am working on controlling my PyPilot with a Raymarine ST7002 control head.
I've got the necessary SeaTalk communication ready and working on the Arduino (MEGA), but now I want to show the course info on the ST7002 screen.
I am looking in the python code as to where / how I should add the course information to the serial communication between the Pi and the Arduino, but have a hard time figuring that out.
(2023-09-16, 10:26 PM)rbergevoet Wrote: As I mentioned in another thread (link), I am working on controlling my PyPilot with a Raymarine ST7002 control head.
I've got the necessary SeaTalk communication ready and working on the Arduino (MEGA), but now I want to show the course info on the ST7002 screen.
I am looking in the python code as to where / how I should add the course information to the serial communication between the Pi and the Arduino, but have a hard time figuring that out.
Can someone point me in the right direction?
Regards,
Reinier
Bump!
is there somebody who can point me in the right direction? As there is not much comments in the code, and my understanding of Python is not that good, I have a hard time figuring out how / where the serial communcation takes place.
you could write a simple service that communicates over serial to your device as well as connects to pypilot. this way you do not need to modify the core pypilot service itself. the pypilot hat and pypilot web clients are both examples of this.
(2023-10-10, 05:34 PM)seandepagnier Wrote: you could write a simple service that communicates over serial to your device as well as connects to pypilot. this way you do not need to modify the core pypilot service itself. the pypilot hat and pypilot web clients are both examples of this.
Hi Sean,
thanks for your answer, I think this might indeed be the best solution.
Can you give me a clue as to in which file (maybe even the line number) I can best call my new script, so that it will be automatically called in the loop, so the course info in refreshed?
(2023-10-25, 01:53 AM)seandepagnier Wrote: I am suggesting you write a separate script that runs its own process and service.
Hi Sean,
I have been busy on getting the rest of the SeaTalk1 bus communication up-and-running, responsive and stable, and I nearly finished with that, so now I can resume working on this.
Can you give me some advice as to where in the code (which file) I can best call my new code, so that it will be called regularly to update the course? My Python reading is not that good, and I have a hard time following what the actual sequence in your Python code is, so some help would be great!
Since Pypilot already uses the serial pins on the Raspberry pi Zero for Tinyilot, I will have to use bitbanging GPIO for the serial, right?
Attached you will find a piece of python code that uses the pypilot_client library to communicate to pypilot. The script subscribes itself to a few parameter values in the pypilot operation data model, and will receive updates from pypilot because it has subscribed itself. The test payload is processThings() and it prints to the standard output the values of three of these parameters periodically. You would need to modify this script so it runs as a service in the background, it subscribes to the parameter values you need, and instead of printing those values to the prompt, pass those parameters to your seatalk scripts. So you won't need to tap into the arduino communication protocol.
This doodle was a bit of a finger exercise to condense the code required that I needed for another project. I think in it you will find all you need to achieve what you want.
(2023-10-25, 01:53 AM)seandepagnier Wrote: I am suggesting you write a separate script that runs its own process and service.
Hi Sean,
I have been busy on getting the rest of the SeaTalk1 bus communication up-and-running, responsive and stable, and I nearly finished with that, so now I can resume working on this.
Can you give me some advice as to where in the code (which file) I can best call my new code, so that it will be called regularly to update the course? My Python reading is not that good, and I have a hard time following what the actual sequence in your Python code is, so some help would be great!
Since Pypilot already uses the serial pins on the Raspberry pi Zero for Tinyilot, I will have to use bitbanging GPIO for the serial, right?
Regards,
Reinier
Generally yes you would be limited to bitbanging. You might want to use usb for this instead, or a more recent raspberry pi which supports multiple hardware serial ports.
Your code can be a separate project from pypilot. If it is a separate service it only needs to communicate to pypilot via sockets.
2024-01-24, 07:15 PM (This post was last modified: 2024-01-24, 09:32 PM by ironman.)
Oh, reading the other thread, do I understand now you want to integrate your seatalk software with motor.ino on the same arduino? That seems to me a very unholy plan, if I may say. An arduino is single thread, and motor.ino I believe relies heavily on timer based interrupt service routines, that are very finicky to debug and have to respond very fast. There are good bit-banging libraries (e.g., pigpio) available for raspberry (tinycore I don't know) for receiving seatalk, but sending is more difficult because you need to monitor the line for collisions while sending, as you might have already solved in your arduino sketch. I would say they best way forward for you is to add another arduino to your setup, and then you can use the extra uart on a more recent pi, as sean suggests, or the usb port.
that isnt what I read. I think he realizes the motor controller must use the only hardware serial port on the pi and to add an additional port would need bitbanging.