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
Servo for rudder control.
#4
(2022-05-10, 11:33 AM)ironman Wrote: Just take an arduino nano, put motor.ino on it and pull D6 high. The arduino then outputs RC-style signals on D9, that I think you can feed to an RC-style servo. See https://github.com/pypilot/workbook/wiki...-motor.ino

I like your thinking! Don't forget to correct your soundings for the tide ;-)
Ironman, Sean, Thanks for your replies, 

ok, so I flashed the nano with the motor.ino file after uncommenting the below to disable the alarms.

//#define VNH2SP30 // defined if this board is used
#define DISABLE_TEMP_SENSE    // if no temp sensors avoid errors
#define DISABLE_VOLTAGE_SENSE // if no voltage sense
#define DISABLE_RUDDER_SENSE  // if no rudder sense

and changed; 
#define pwm_style_pin 6
// pwm style, 0 = hbridge, 1 = rc pwm, 2 = vnh2sp30
uint8_t pwm_style = 1; // detected to 0 or 1 unless detection disabled, default 2

to set style 1 (RC). however I also, (mistakenly I think), a 5v onto pin 6 to pull it high. I since removed this 5v.

The Arduino connects to the pi via usb after I add a usb device in Pypilot, and the RX TX lights are flashing.

When I open the Pypilot control interface and connect the Arduino USB, it says "Arduino" in the top left, then very briefly in says "Engaged" but after about 1/2 a second switches to  "Disengaged", and next to that it says "Sync Overcurrent_fault". When I press the AP to engage nothing happens because I think the fault stops the engagement.

I looked through the Arduino code and I am a beginner but I can't see anywhere where overcurrent fault can be uncommented. Do you have any suggestions? 

I also read the following, 
  • There will be random error messages next to the word SYNC, and this can be expected. These error messages are called ‘flags’ in pypilot parlour, and at this point they are caused by the input pins on the Arduino being left open. Open input pins are bad practice in electronics; if they are left 'floating' they are susceptible to electrostatic influences and worse, damage.
but I am unsure how do I stop them "floating"? do I physically connect those pins to 0v or 5v or use  pinmode commands in the sketch.? 


I think I understand that by setting the D6 pin High via the Pwm_style=1 you get an output on D9 that is a PWM pulse of varying length that equates to servo position. I think this is similar to the servo.h library I am using in the IOT boat so hopefully it will work similar but see from the workbook wiki that its really untested. but first I think I need to get rid of the fault before proceeding.

Thanks for the help!

(2022-05-10, 01:17 PM)seandepagnier Wrote: you can do this, but keep in mind that driving a servo on absolute position is different from driving it a relative speed.

You will have to change all the gains to compensate but otherwise it should work.

Hi Sean,

I am not sure what this means, so I guess I have some googling about how servo's work and the differences of relative speed and absolute position.. this has all been a huge learning curve, but a rewarding one!

Are the Gains the sliders in the control interface?

Thanks
Reply


Messages In This Thread
Servo for rudder control. - by Marty Peters - 2022-05-10, 04:00 AM
RE: Servo for rudder control. - by ironman - 2022-05-10, 11:33 AM
RE: Servo for rudder control. - by Marty Peters - 2022-05-11, 11:09 AM
RE: Servo for rudder control. - by seandepagnier - 2022-05-10, 01:17 PM
RE: Servo for rudder control. - by seandepagnier - 2022-05-11, 01:10 PM
RE: Servo for rudder control. - by Marty Peters - 2022-05-11, 02:07 PM
RE: Servo for rudder control. - by seandepagnier - 2022-05-11, 11:28 PM
RE: Servo for rudder control. - by Marty Peters - 2022-05-15, 06:31 AM
RE: Servo for rudder control. - by seandepagnier - 2022-05-15, 01:19 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)