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.

  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dummy motor driver
#1
Hello,

first i would like to say that your whole project is amazing! 

i have a question. maybe it's a feature request...
my motor controller and steering can be adressed through serial commands... the steering is alreadz digital...but it was programmed by a friend and has no standards.
I got a few python scripts(eg left.sh, faster.sh, stop.sh) from him to control it... is there a way that i can simple start the scripts for navigation.


Thx and best regards

Dan
  Reply
#2
What do the scripts do? How do they communicate to the motor?

It would make more sense to implement a driver for your controller in servo.py It would not be efficient to execute bash scripts for this purpose since the autopilot commands the motor at 10-25hz any lag would degrade performance.

I have the arduino driver used by many, but there is also a driver for direct control from raspberry gpio pins. You could implement another driver. I can't say more without more information,
  Reply
#3
(02-02-2019, 03:58 AM)seandepagnier Wrote: What do the scripts do?  How do they communicate to the motor?

It would make more sense to implement a driver for your controller in servo.py  It would not be efficient to execute bash scripts for this purpose since the autopilot commands the motor at 10-25hz any lag would degrade performance.

I have the arduino driver used by many, but there is also a driver for direct control from raspberry gpio pins.  You could implement another driver.  I can't say more without more information,

thanks for your fast answer. this would be cool, but im not sure if this would have benefits for you or the community.
The controller is an arduino(or similar) with polulu motor controller, but the arduino has more sensors attached with a small control panel...it works standalone...arduino output goes to an raspi and has a program but its not very good and stable. so reorganisation is not so easy. 

the scripts just opens serial and send some command
For steering: it just sends an "s" and a value...from -45 to 45
For driving: it send "m" and a value...from -255(reverse) to 255
the arduino sends back changes...eg the motor slowly accelerates...so serial gives mit back:
M0
M1
M2
M3
And of course fail reporting.
This is why i asked to script it. Or how would you do it? Perhaps direct serial commands?or did you implement pipes?
  Reply
#4
If it is an arduino, it would be best to use the existing arduino sketch.   It supports 3 types of controller:

  1.   servo ESC pwm, single output
  2.   pwm and direction, two outputs
  3.   direct hbridge, four outputs
I think the polulu is pwm and direction io like the vnh2sp30, but you better check this.

What  you described is not a good protocol to use because it is inefficient and lacks error checking.   It also seems like it doesn't support all the features already implemented.   Please check the source code in arduino/motor/motor.ino of the pypilot repository.
  Reply
#5
the protocol is not good...because it is not really one Wink if i understood the code right your controller is no direct drive, so it wouldn't work at all. but maybe i should have written more about the control unit.

The whole control grew over the years. First it was just an arduino for checking temperatures and level (8) with a small control board with leds....then we added the motor control for an slow elecrical movement and a steering for it. it is actually for kanus. 24v with battery
So my control is a electic direct drive for the ship.
the raspi control let the ship slowly make circles or hold position. no openplotter or opencpn, just a small script.
Of course its underpowered but it works well for my needs. i would like the ship to follow some waypoint, of course slowly.
i found some pictures of the control unit. my controller is a dual pololu vnh5019 ...it controls a 500w motor. It's an arduino shield. no way to change pins. the steering works with a very strong servo(like the one from rc cars).

i looked at the arduino sketch of pypilot on github...but to be honest i am not a good programmer.
Do you think i should try to implement my control on pypilot or should i try a easier,not so advanced, project? Thanks
  Reply
#6
You could hack the source code of motor.ino and make it work with the motor shield you have, but I don't really recommend this unless you at least add current sensing, and preferably add optical isolation to the pi.
  Reply
#7
It would be nice if on start i had a script that if the autotpilot was plugged in it would run out for x sec then when i wanted to disengage it would run back the same time. so it would set the screw to apx mid point for attachment/ detachment
  Reply
#8
Not sure what you mean run out a certain amount.

Do you mean it should hit the end stop when it powers up, then from there move a certain amount to center itself without rudder feedback? This is possible but not sure it's a good idea. Usually I manually move the ram to center before enabling the autopilot.
  Reply
#9
I am lazy I would like it to move its self out. pressing buttons are soo much work.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)