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
Reduce steering when AP not active
#1
Hi,

When the AP is not active, I can control the rod (I use a ST2000+ as actuator) with the arrow buttons.
However, one keypress already pushes the rod quit far out/in.
How can I reduce this distance that the rod travels?

regards
Hans
Reply
#2
(2018-07-04, 01:22 PM)It Paradyske Wrote: Hi,

When the AP is not active, I can control the rod (I use a ST2000+ as actuator) with the arrow buttons.
However, one keypress already pushes the rod quit far out/in.
How can I reduce this distance that the rod travels?

regards
Hans

manual control could be improved.

This is using which control program?  The opencpn plugin or from the browser?

The source code needs to be changed to reduce this distance, it's easy to do.
Reply
#3
(2018-07-07, 06:34 PM)seandepagnier Wrote:
(2018-07-04, 01:22 PM)It Paradyske Wrote: Hi,

When the AP is not active, I can control the rod (I use a ST2000+ as actuator) with the arrow buttons.
However, one keypress already pushes the rod quit far out/in.
How can I reduce this distance that the rod travels?

regards
Hans

manual control could be improved.

This is using which control program?  The opencpn plugin or from the browser?

The source code needs to be changed to reduce this distance, it's easy to do.

Hi Sean,

It is both the web interface and the buttons.
Which files should I alter?
I am not very familiar with the Tiny Core Linux setup, I can alter the files like:
/usr/local/lib/python2.7/site-packages/lcd/client.py by copying the file it is linked to, to the link location,
however after reboot the linked file is there again. How can I make the changes persistent?

I am still waiting for an IMU, so am testing without it. but I encountered a bug there...
in
/usr/local/lib/python2.7/site/packages/lcd/client.py
the error message in fittext :
"compass or gyro failure!"
is not processed correctly

The client.py crashes and restarts,
the log file says:

2018-06-11_20:34:06.74833 fittext ERROR
2018-06-11_20:34:06.74837 compass or gyro failure! True 0
2018-06-11_20:34:06.74865 Traceback (most recent call last):
2018-06-11_20:34:06.74893   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 1236, in <module>
2018-06-11_20:34:06.75153     main()
2018-06-11_20:34:06.75209   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 1233, in main
2018-06-11_20:34:06.75784     idle()
2018-06-11_20:34:06.75845   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 1194, in idle
2018-06-11_20:34:06.76091     lcdclient.display()
2018-06-11_20:34:06.76147   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 903, in display
2018-06-11_20:34:06.76409     self.display_page()
2018-06-11_20:34:06.76468   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 661, in display_control
2018-06-11_20:34:06.76621     self.fittext(r, _('ERROR\ncompass or gyro failure!'), True, black)
2018-06-11_20:34:06.76678   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 463, in fittext
2018-06-11_20:34:06.76797     metrics = map(lambda word : (word, font.draw(self.surface, False, word, metric_size, self.bw)), words)
2018-06-11_20:34:06.76854   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 463, in <lambda>
2018-06-11_20:34:06.76977     metrics = map(lambda word : (word, font.draw(self.surface, False, word, metric_size, self.bw)), words)
2018-06-11_20:34:06.77031   File "/usr/local/lib/python2.7/site-packages/lcd/font.py", line 60, in draw
2018-06-11_20:34:06.77085     font[c] = create_character(os.path.abspath(os.path.dirname(__file__)) + "/font.ttf", size, c, surface.bypp, crop, bw)
2018-06-11_20:34:06.77139   File "/usr/local/lib/python2.7/site-packages/lcd/font.py", line 85, in create_character
2018-06-11_20:34:06.77192     ifont = ImageFont.truetype(fontpath, size)
2018-06-11_20:34:06.77244   File "/usr/local/lib/python2.7/site-packages/PIL/ImageFont.py", line 239, in truetype
2018-06-11_20:34:06.77332     return FreeTypeFont(font, size, index, encoding)
2018-06-11_20:34:06.77438   File "/usr/local/lib/python2.7/site-packages/PIL/ImageFont.py", line 128, in __init__
2018-06-11_20:34:06.77503     self.font = core.getfont(font, size, index, encoding)
2018-06-11_20:34:06.77570 IOError: cannot open resource
~

I am running the image of 18062018
Reply
#4
(2018-07-08, 08:31 AM)It Paradyske Wrote:
(2018-07-07, 06:34 PM)seandepagnier Wrote:
(2018-07-04, 01:22 PM)It Paradyske Wrote: Hi,

When the AP is not active, I can control the rod (I use a ST2000+ as actuator) with the arrow buttons.
However, one keypress already pushes the rod quit far out/in.
How can I reduce this distance that the rod travels?

regards
Hans

manual control could be improved.

This is using which control program?  The opencpn plugin or from the browser?

The source code needs to be changed to reduce this distance, it's easy to do.

Hi Sean,

It is both the web interface and the buttons.
Which files should I alter?
I am not very familiar with the Tiny Core Linux setup, I can alter the files like:
/usr/local/lib/python2.7/site-packages/lcd/client.py by copying the file it is linked to, to the link location,
however after reboot the linked file is there again. How can I make the changes persistent?

I am still waiting for an IMU, so am testing without it. but I encountered a bug there...
in
/usr/local/lib/python2.7/site/packages/lcd/client.py
the error message in fittext :
"compass or gyro failure!"
is not processed correctly

The client.py crashes and restarts,
the log file says:

2018-06-11_20:34:06.74833 fittext ERROR
2018-06-11_20:34:06.74837 compass or gyro failure! True 0
2018-06-11_20:34:06.74865 Traceback (most recent call last):
2018-06-11_20:34:06.74893   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 1236, in <module>
2018-06-11_20:34:06.75153     main()
2018-06-11_20:34:06.75209   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 1233, in main
2018-06-11_20:34:06.75784     idle()
2018-06-11_20:34:06.75845   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 1194, in idle
2018-06-11_20:34:06.76091     lcdclient.display()
2018-06-11_20:34:06.76147   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 903, in display
2018-06-11_20:34:06.76409     self.display_page()
2018-06-11_20:34:06.76468   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 661, in display_control
2018-06-11_20:34:06.76621     self.fittext(r, _('ERROR\ncompass or gyro failure!'), True, black)
2018-06-11_20:34:06.76678   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 463, in fittext
2018-06-11_20:34:06.76797     metrics = map(lambda word : (word, font.draw(self.surface, False, word, metric_size, self.bw)), words)
2018-06-11_20:34:06.76854   File "/usr/local/lib/python2.7/site-packages/lcd/client.py", line 463, in <lambda>
2018-06-11_20:34:06.76977     metrics = map(lambda word : (word, font.draw(self.surface, False, word, metric_size, self.bw)), words)
2018-06-11_20:34:06.77031   File "/usr/local/lib/python2.7/site-packages/lcd/font.py", line 60, in draw
2018-06-11_20:34:06.77085     font[c] = create_character(os.path.abspath(os.path.dirname(__file__)) + "/font.ttf", size, c, surface.bypp, crop, bw)
2018-06-11_20:34:06.77139   File "/usr/local/lib/python2.7/site-packages/lcd/font.py", line 85, in create_character
2018-06-11_20:34:06.77192     ifont = ImageFont.truetype(fontpath, size)
2018-06-11_20:34:06.77244   File "/usr/local/lib/python2.7/site-packages/PIL/ImageFont.py", line 239, in truetype
2018-06-11_20:34:06.77332     return FreeTypeFont(font, size, index, encoding)
2018-06-11_20:34:06.77438   File "/usr/local/lib/python2.7/site-packages/PIL/ImageFont.py", line 128, in __init__
2018-06-11_20:34:06.77503     self.font = core.getfont(font, size, index, encoding)
2018-06-11_20:34:06.77570 IOError: cannot open resource
~

I am running the image of 18062018
From the error message it seems font.ttf was not installed...  the git repository got corrupted, and when I recloned I forgot to extract the data.  I will fix for next release.   It only happens if you don't have an imu which makes the autopilot useless anyway.

How are you using the lcd client?  What is your hardware setup?
Reply
#5
(2018-07-09, 03:29 PM)seandepagnier Wrote: From the error message it seems font.ttf was not installed...  the git repository got corrupted, and when I recloned I forgot to extract the data.  I will fix for next release.   It only happens if you don't have an imu which makes the autopilot useless anyway.

How are you using the lcd client?  What is your hardware setup?

I know it doesn't work without IMU, I hope it will be delivered soon... :-)
In the mean time I am trying to get it up and running as far as possible.
I connected a Nokia 5110 LCD on the spi interface, the LCD is hardly readable due to a bad connection by the way, so I ordered an other one.
The actuator is an old Raymarine ST2000+, the compass of the thing is defect so I was able to purchase it for little money.
It is driven by an H-bridge, with IRF540/9540, and a couple of transistors (bc547 and bc557), I designed myself.
I use an arduino red board (equal to uno, still waiting for the nano to come in) with your code to drive the H-bridge, the only modification I made was the polarity of the driving pins to the H-bridge. To activate a MOSFET in the bridge, a positive signal is needed.

Could you explain me how the filesystem on the pypilot image works? How can I modify e.g. the client.py?

Do you have a block diagram of the whole software? Which blocks there are etc., and how the blocks are communicating?
regards
Hans
Reply
#6
(2018-07-09, 07:02 PM)It Paradyske Wrote: I know it doesn't work without IMU, I hope it will be delivered soon... :-)
In the mean time I am trying to get it up and running as far as possible.
I connected a Nokia 5110 LCD on the spi interface, the LCD is hardly readable due to a bad connection by the way, so I ordered an other one.
The actuator is an old Raymarine ST2000+, the compass of the thing is defect so I was able to purchase it for little money.
It is driven by an H-bridge, with IRF540/9540, and a couple of transistors (bc547 and bc557), I designed myself.
I use an arduino red board (equal to uno, still waiting for the nano to come in) with your code to drive the H-bridge, the only modification I made was the polarity of the driving pins to the H-bridge. To activate a MOSFET in the bridge, a positive signal is needed.

Could you please post your source code changes or make a pull request?

The irf540 and 9540 has high on resistance. These may work for a few amps but are still less efficient.

The mosfets I am using are 1-2 milliohm, all n channel giving less than 1% losses in the mosfets at 12 volts 10 amps.
Quote:Could you explain me how the filesystem on the pypilot image works? How can I modify e.g. the client.py?

Do you have a block diagram of the whole software? Which blocks there are etc., and how the blocks are communicating?
regards
Hans
I will make more block diagrams soon. For now you should just ask specific questions.
Reply
#7
(2018-07-10, 03:35 PM)seandepagnier Wrote:
(2018-07-09, 07:02 PM)It Paradyske Wrote: I know it doesn't work without IMU, I hope it will be delivered soon... :-)
In the mean time I am trying to get it up and running as far as possible.
I connected a Nokia 5110 LCD on the spi interface, the LCD is hardly readable due to a bad connection by the way, so I ordered an other one.
The actuator is an old Raymarine ST2000+, the compass of the thing is defect so I was able to purchase it for little money.
It is driven by an H-bridge, with IRF540/9540, and a couple of transistors (bc547 and bc557), I designed myself.
I use an arduino red board (equal to uno, still waiting for the nano to come in) with your code to drive the H-bridge, the only modification I made was the polarity of the driving pins to the H-bridge. To activate a MOSFET in the bridge, a positive signal is needed.

Could you please post your source code changes or make a pull request?

The irf540 and 9540 has high on resistance.  These may work for a few amps but are still less efficient.

The mosfets I am using are 1-2 milliohm, all n channel giving less than 1% losses in the mosfets at 12 volts 10 amps.

RDS on is indeed a bit high, 117 mOhm and 44mOhm (I must admit I only saw the 44mOhm when I selected them)
150 mOhm on 10A gives 15W dissipation ...
I use a ST1000+ currently I have limited the current to 5 A.

I didn't know you were pulsing the MOSFETs, I expected a static steering voltage, so the H bridge would be activated continuously when the motor has to turn.
What driver are you using for the MOSFETs? One that shifts the power up, to be able to use N-channels for high and low?


My code for the Arduino:


// run at 4mhz instead of 16mhz to save power,
// and to be able to measure lower current from the shunt
#define DIV_CLOCK

//#define HIGH_CURRENT   // high current uses 300uohm resistor and 50x amplifier
//#define HIGH_CURRENT_OLD   // high current uses 500uohm resistor and 50x amplifier
// otherwise using shunt without amplification

#define rc_pwm_pin 6 // todo: use this pin to detect rc pwm
#define RC_PWM  // remote control style servo

#ifndef RC_PWM
// for direct mosfet mode, define how to turn on/off mosfets
// do not use digitalWrite!
#define a_top_on  PORTB |= _BV(PB1)
#define a_top_off PORTB &= ~_BV(PB1)
#define a_bottom_on PORTD |= _BV(PD2)
#define a_bottom_off PORTD &= ~_BV(PD2)
#define b_top_on  PORTB |= _BV(PB2)
#define b_top_off PORTB &= ~_BV(PB2)
#define b_bottom_on PORTD |= _BV(PD3)
#define b_bottom_off PORTD &= ~_BV(PD3)

Yes I mixed up the outputs a little bit, and changed the levels.

And I use a lower PWM frequency:
#ifdef DIV_CLOCK
    ICR1=4000;  //fPWM=1khz
#else
    ICR1=16000;  //fPWM=1khz
#endif

I'm not so familiar with creating pull requests, so I have to study on that.


Could you please explain how I make my changes persistent?

regards
Hans
Reply
#8
Quote:RDS on is indeed a bit high, 117 mOhm and 44mOhm (I must admit I only saw the 44mOhm when I selected them)
150 mOhm on 10A gives 15W dissipation ...
Anything above 0.5 watts needs a heat sink.
Quote:I use a ST1000+ currently I have limited the current to 5 A.
Still you have 4W losses at 5 amp. The st1000+ probably uses even less.

My resistance is 5-6 mOhm, no where near 150.
Quote:I didn't know you were pulsing the MOSFETs, I expected a static steering voltage, so the H bridge would be activated continuously when the motor has to turn.
What driver are you using for the MOSFETs? One that shifts the power up, to be able to use N-channels for high and low?
The driver shifts power through a capacitor to drive high side mosfets. The maximum speed is 98.5% because off time is needed to keep the high side gates charged. The resistance in the mosfets, measurement shunt and other parts makes the max speed around 97% but only 1.5% is lost in heat.
Quote:My code for the Arduino:


// run at 4mhz instead of 16mhz to save power,
// and to be able to measure lower current from the shunt
#define DIV_CLOCK

//#define HIGH_CURRENT   // high current uses 300uohm resistor and 50x amplifier
//#define HIGH_CURRENT_OLD   // high current uses 500uohm resistor and 50x amplifier
// otherwise using shunt without amplification

#define rc_pwm_pin 6 // todo: use this pin to detect rc pwm
#define RC_PWM  // remote control style servo

#ifndef RC_PWM
// for direct mosfet mode, define how to turn on/off mosfets
// do not use digitalWrite!
#define a_top_on  PORTB |= _BV(PB1)
#define a_top_off PORTB &= ~_BV(PB1)
#define a_bottom_on PORTD |= _BV(PD2)
#define a_bottom_off PORTD &= ~_BV(PD2)
#define b_top_on  PORTB |= _BV(PB2)
#define b_top_off PORTB &= ~_BV(PB2)
#define b_bottom_on PORTD |= _BV(PD3)
#define b_bottom_off PORTD &= ~_BV(PD3)

Yes I mixed up the outputs a little bit, and changed the levels.

And I use a lower PWM frequency:
#ifdef DIV_CLOCK
    ICR1=4000;  //fPWM=1khz
#else
    ICR1=16000;  //fPWM=1khz
#endif
I think this means you run at 400hz instead of 1khz. Should be ok, but you should also adjust the code in "void position(uint16_t value)"

I should make macros to make changing the frequency easier.
Quote:I'm not so familiar with creating pull requests, so I have to study on that.


Could you please explain how I make my changes persistent?
You would have to commit to git.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)