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 rudder feedback
#1
I am just testing pypilot with openplotter 1.0.

My setup:

RPI3B
Arduino Nano
Pololu Simpel Motor Controller
MPU 9255
Hydraulic Pump 24 V 20 A
Hall-Effect Rotary Position Sensor output 0,5 - 4,5 V

So far everything is working and the rudder is moving. But I do not get any rudder feedback. On scope and client it is always 0. I also simulated contr. and motor-temp with the same 0 result. Simulated current and voltage show up. Instead I could use end-switches but more complicate and I still have the position sensor from my arduino autopilot project. Any ideas?

Another question, what do the gains D2, FF, DD and PR stand for?

BTW there is a bug in the ocpn-pypilot-controller in manual mode the rudder is moving in the wrong direction. in AP mode everything ok.

Kalle
Reply
#2
(2018-06-05, 02:11 PM)kalle Wrote: I am just testing pypilot with openplotter 1.0.

My setup:

RPI3B
Arduino Nano
Pololu Simpel Motor Controller
MPU 9255
Hydraulic Pump 24 V 20 A
Hall-Effect Rotary Position Sensor output 0,5 - 4,5 V

So far everything is working and the rudder is moving. But I do not get any rudder feedback. On scope and client it is always 0. I also simulated contr. and motor-temp with the same 0 result. Simulated current and voltage show up. Instead I could use end-switches but more complicate and I still have the position sensor from my arduino autopilot project. Any ideas?
It's difficult to say without more information. How is the controller connected? Over uart or? Do you have a separate arduino to measure voltage and current?

Did you modify the code on the polou controller? Are you using the motor.ino sketch from pypilot?

There are several options for how to hook all of this up.
Quote:Another question, what do the gains D2, FF, DD and PR stand for?
D2 -- experimental is the D gain squared. Will make adjustments with very fast boat movement but not much if the boat is turning slower. Is non-linear
FF -- feed forward This gain applies rudder movement with changing heading command. When holding a heading it does nothing, but takes effect following routes, or when you adjust the heading
DD -- rate of rate of change. basically the derivative of the D gain, very useful to reduce overshoot and lag
PR -- experimental Square root of position gain. This makes less movements when the heading is very wrong to avoid overshoot.

Let me know if you have any other questions. You can easily make your own gains in basic_autopilot.py or remove these change them etc...
Quote:BTW there is a bug in the ocpn-pypilot-controller in manual mode the rudder is moving in the wrong direction. in AP mode everything ok.

Kalle
I think it is maybe a bug in the ui, not the autopilot. Is this in the pypilot plugin of opencpn? It might already be fixed, the version in openplotter will lag behind a bit. For now, just remember to move the other way in manual mode, eventually it will be fixed.
Reply
#3
Hi Sean,
thank you very much for your reply. I appreciate your work for open source projects like OCPN, OP and Pypilot and a big thank you for that.
I am using the arduino motor.ino sketch output digital pin 9 to pololu RC input. After some try and error that connection seems to work fine. Pololu has its own software for configuring their controllers.
At the moment I do not measure volts current or temp even it would be nice to see autopilot power consumption.
In case of having an hydraulic steering the problem is to stop the pump at the end points. So I need rudder-feedback. I think on Scope servo.rudder_pos should be the measured rudder position (in my case always 0). I tried to understand your pypilot code but my programming skills are limited to only a little bit arduino-code. Using end-switches or with a simple (for a programmer I think ugly) change in motor.ino I can manage it but that will not help the project.
The bug is in OCPN-plugin not pypilot but anyway not serious.

Kalle

Ps
I forgot
Arduino ADC 6 connected to position sensor
Reply
#4
The position rudder must range from 0 to 1.1 volts. Maybe this is the problem? What is the voltage on adc pin 6? If the sensor reads above about 1 volt, or below 0.1 volt then no rudder position will ever be reported.

If you aren't measuring current at all, you could change the admux register and change the range for rudder feedback for 0 to 5 volts.

If you don't measure current, you absolutly must have end of track switches, or rudder feedback.
Reply
#5
Changing the admux register was the solution. Setting the temp. and current values to 0 avoided fault messages from not connected sensors. Up to now its working fine. Perhaps this weekend the first sea trials. I will report.

Kalle
Reply
#6
(2018-06-08, 10:45 AM)kalle Wrote: Changing the admux register was the solution. Setting the temp. and current values to 0 avoided fault messages from not connected sensors. Up to now its working fine. Perhaps this weekend the first sea trials. I will report.

Kalle

I have the same Problem, I use a Potentiometer to give rudder Feedback. It Returns values on Pin A4 
of 0-5V. So how do y handle this. I guess I have to Change the ADMUX Register, but I don´t find how to do that in the Motor.ino of the Arduino?

It is correct that the Max-Rudder and Min-Rudder stays then a 256/512 ?? Or du I have to modyfy that an more ?

Please some help.

Thank you
Reply
#7
(2019-01-07, 12:40 AM)xfactor99 Wrote:
(2018-06-08, 10:45 AM)kalle Wrote: Changing the admux register was the solution. Setting the temp. and current values to 0 avoided fault messages from not connected sensors. Up to now its working fine. Perhaps this weekend the first sea trials. I will report.

Kalle

I have the same Problem, I use a Potentiometer to give rudder Feedback. It Returns values on Pin A4 
of 0-5V. So how do y handle this. I guess I have to Change the ADMUX Register, but I don´t find how to do that in the Motor.ino of the Arduino?

It is correct that the Max-Rudder and Min-Rudder stays then a 256/512 ?? Or du I have to modyfy that an more ?

Please some help.

Thank you

For now I solved it, adding an power divider to the potentiometer to reduce the 0-5V output to 0-1 V, so this is working now.

Rudder indicator is showing nicely in opencpn

Anyway it would be nice to know were in the motor.ino for the Arduino, I can change the ADMUX setting for Pin A4.

Save sailing

Andreas
Reply
#8
(2019-01-07, 12:50 PM)xfactor99 Wrote:
(2019-01-07, 12:40 AM)xfactor99 Wrote:
(2018-06-08, 10:45 AM)kalle Wrote: Changing the admux register was the solution. Setting the temp. and current values to 0 avoided fault messages from not connected sensors. Up to now its working fine. Perhaps this weekend the first sea trials. I will report.

Kalle

I have the same Problem, I use a Potentiometer to give rudder Feedback. It Returns values on Pin A4 
of 0-5V. So how do y handle this. I guess I have to Change the ADMUX Register, but I don´t find how to do that in the Motor.ino of the Arduino?

It is correct that the Max-Rudder and Min-Rudder stays then a 256/512 ?? Or du I have to modyfy that an more ?

Please some help.

Thank you

For now I solved it, adding an power divider to the potentiometer to reduce the 0-5V output to 0-1 V, so this is working now.

Rudder indicator is showing nicely in opencpn

Anyway it would be nice to know were in the motor.ino for the Arduino, I can change the ADMUX setting for Pin A4.

Save sailing

Andreas

In an older version of motor.ino which I still use I did:


   // setup adc
    DIDR0 = 0x3f; // disable all digital io on analog pins
    ADMUX = _BV(REFS0); // external 5v
 //   ADMUX = _BV(REFS0)| _BV(REFS1) | _BV(MUX0); // 1.1v


I think in the newer version it could be different. Have a look at line 380.

Kalle
Reply
#9
(2019-01-07, 01:38 PM)kalle Wrote: In an older version of motor.ino which I still use I did:


   // setup adc
    DIDR0 = 0x3f; // disable all digital io on analog pins
    ADMUX = _BV(REFS0); // external 5v
 //   ADMUX = _BV(REFS0)| _BV(REFS1) | _BV(MUX0); // 1.1v


I think in the newer version it could be different. Have a look at line 380.

Kalle

Ha Kalle,
thank you verry much for awnsering.

What you had did not help in tha actual version of motor.ino.
But thanks to your post I´v got the right hint. 
I finaly changed the line 632, outcomented the last part of the line to:

"" const uint8_t defmux = _BV(REFS0); //| _BV(REFS1); // 1.1v ""

So this gives me 0-5 Volt (internal) Voltage-Reference to Pin A4 = Ruddersensor
instead of the 0-1.1 Volt 

Save sailing
Andreas
Reply
#10
(2019-01-07, 06:01 PM)xfactor99 Wrote:
(2019-01-07, 01:38 PM)kalle Wrote: In an older version of motor.ino which I still use I did:


   // setup adc
    DIDR0 = 0x3f; // disable all digital io on analog pins
    ADMUX = _BV(REFS0); // external 5v
 //   ADMUX = _BV(REFS0)| _BV(REFS1) | _BV(MUX0); // 1.1v


I think in the newer version it could be different. Have a look at line 380.

Kalle

Ha Kalle,
thank you verry much for awnsering.

What you had did not help in tha actual version of motor.ino.
But thanks to your post I´v got the right hint. 
I finaly changed the line 632, outcomented the last part of the line to:

"" const uint8_t defmux = _BV(REFS0); //| _BV(REFS1); // 1.1v ""

So this gives me 0-5 Volt (internal) Voltage-Reference to Pin A4 = Ruddersensor
instead of the 0-1.1 Volt 

Save sailing
Andreas

Thank you Andreas,

I will remember your hint if I change to the newer version.

Also save sailing for you,

Kalle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)