Page 1 of 2

raspberry pi and sabertooth 2X25

Posted: Wed Dec 09, 2015 1:06 pm
by drekthrall
Hello , is possible to control DC motors with Sabertooth 2X25 connected to PWM pins ( rspi 2 B => GPIO18 , GPIO 23) ?

http://www.snailshop.cz/2015-thickbox_d ... h-2x25.jpg

GPIO18 will be connected to S1
GPIO 23 to S2

Am I right ?

How to control direction ? for example in L298N are two more pins for each motor to control direction

Thanks

Re: raspberry pi and sabertooth 2X25

Posted: Sat Dec 12, 2015 11:53 pm
by Moe
Yes and no. It's possible, and fairly easy, but you can't just connect them directly - the Pi outputs 3.3V and the Sabertooth needs 5V.

Best way to do this would be an add-on board; there are loads for the Pi and the Sabertooth provides lots of options. You could use simple PWM smoothed by capacitors to give an analogue voltage to each motor (S1 and S2). In this mode, 2.5V is stop, 0V is full speed backward and 5V is full speed forward. It would take a bit of trial-and-error to get the voltages right, and if your motors are big enough to need a 25A driver then a trial-and-error approach might be a little bit dangerous.

But there is an easier option. I use a servo-controller board that outputs 5V RC, because I want to switch between Pi control and manual radio control. This way the servo-controller outputs exactly the same signals you would get from the receiver in a radio-controller toy car and the Sabertooth interprets them in the same way.

It also a has a great little 'differential mode' feature, where the S1 input controls speed to both motors and the S2 input does the steering, which means you can also use the transmitter from a toy car.

Read the manual and decide which option is best for you:
https://www.dimensionengineering.com/da ... th2x25.pdf

Re: raspberry pi and sabertooth 2X25

Posted: Sun Dec 13, 2015 8:11 pm
by drekthrall
Moe wrote:Yes and no. It's possible, and fairly easy, but you can't just connect them directly - the Pi outputs 3.3V and the Sabertooth needs 5V.

Best way to do this would be an add-on board; there are loads for the Pi and the Sabertooth provides lots of options. You could use simple PWM smoothed by capacitors to give an analogue voltage to each motor (S1 and S2). In this mode, 2.5V is stop, 0V is full speed backward and 5V is full speed forward. It would take a bit of trial-and-error to get the voltages right, and if your motors are big enough to need a 25A driver then a trial-and-error approach might be a little bit dangerous.

But there is an easier option. I use a servo-controller board that outputs 5V RC, because I want to switch between Pi control and manual radio control. This way the servo-controller outputs exactly the same signals you would get from the receiver in a radio-controller toy car and the Sabertooth interprets them in the same way.

It also a has a great little 'differential mode' feature, where the S1 input controls speed to both motors and the S2 input does the steering, which means you can also use the transmitter from a toy car.

Read the manual and decide which option is best for you:
https://www.dimensionengineering.com/da ... th2x25.pdf
Thank you for reply!

I want to control 6 DC motors ( 2 x 3 ; each motor max load 6,6A )with raspberry pi 2 B. Do you know about a motor controller where 3.3V PWM is OK ?

Re: raspberry pi and sabertooth 2X25

Posted: Sun Dec 13, 2015 9:39 pm
by Moe
Personally, no. Most Pi robot boards aren't designed to take that current, but I reckon such things should be available somewhere.

My plan is to use the Sabertooth 2x25 to control 4 wheelchair motors; two on each channel. I should be in a position to test this in the next week or so. Will report back. Do you need to control the six motors independently, or just two banks of three?

Re: raspberry pi and sabertooth 2X25

Posted: Mon Dec 14, 2015 11:31 am
by drekthrall
Moe wrote:Personally, no. Most Pi robot boards aren't designed to take that current, but I reckon such things should be available somewhere.

My plan is to use the Sabertooth 2x25 to control 4 wheelchair motors; two on each channel. I should be in a position to test this in the next week or so. Will report back. Do you need to control the six motors independently, or just two banks of three?
I would be happy if you will report back.

I need to control 2 branches of 3 motor each. As you wrote two banks of three.

Re: raspberry pi and sabertooth 2X25

Posted: Thu Dec 17, 2015 4:43 pm
by danjperron
I do have a sabertooth 2x25. I did use it for one of my first robot with a pc104 computer.

If I remember well you could use the serial port. For the Pi it will be only a adafruit 5v to 3.3V converter.

I will try to find my old code for it . It was working very well

https://www.dropbox.com/s/zhuy2tlvu8v9o ... 4.wmv?dl=1

Re: raspberry pi and sabertooth 2X25

Posted: Fri Dec 18, 2015 12:51 am
by danjperron
I found some of my old code

The sabertooth was connected to a polulu servo driver. The servo driver was converting the RS-232 to TTL with a transistor.


The good thing about the serial port is that you could use only one line , the serial TX , to control up to 8 sabertooth.

connect all of them to the serial line. Maybe A CMOS buffer would be a good thing. Something like a 74HCT08. This I.C. will handle the conversion from 3.3V to 5V.

Code: Select all

int SendPacket(unsigned char  * Packet, int count)
{
if(!emulator)
{
        write(Handle,Packet,count);
//        printf("%s\n",Packet);fflush(stdout);
}
        return(1);
}


void SendMotor(BYTE command,BYTE value)
{
        BYTE controller=131;
        BYTE buffer[8];
        int loop;
        int sum=0;
        buffer[0]=controller;
        buffer[1]= command & 0x7f;
        buffer[2]= value & 0x7f;
        for( loop=0;loop<3;loop++)
                sum+=buffer[loop];
        buffer[3]=  sum & 0x7f;

  SendPacket(buffer,4);usleep(50000);
  printf("SendMotor(command=%d,value=%d)\n",command,value);
  fflush(stdout);       
}
To change the sabertooth module you will need to add a parameter to select controller from 128 to 135 range. Presently it is at a fix sabertooth #131

Re: raspberry pi and sabertooth 2X25

Posted: Mon Dec 28, 2015 7:08 pm
by Moe
OK, I tried running two motors off the same channel of the sabertooth today and it worked fine, even with one of them reversed. As far as I can tell without bothering with scientific measurements, they go at exactly the same speed.

Re: raspberry pi and sabertooth 2X25

Posted: Mon Jan 04, 2016 6:32 pm
by drekthrall
Moe wrote:OK, I tried running two motors off the same channel of the sabertooth today and it worked fine, even with one of them reversed. As far as I can tell without bothering with scientific measurements, they go at exactly the same speed.
So for example I have 2 PWM pins on RPi for example :
pwm_motor1 = 18
pwm_motor2 = 19

So you just connected pin 18 to S1 , pin 19 to S2 and 0V to RPi's ground? http://static.rcgroups.net/forums/attac ... 1325172709

Will that work ?

I am using wiringPi to control pin's PWM (0-1024).
So for example i will set 18's PWM to 512 = this would mean that motor will stop ; if I sem PWM to 1024 = motor will run fully forward ; if I set PWM to 0 = motor will run fully forward. Does it work like that ?

btw thanks for your replies !

Re: raspberry pi and sabertooth 2X25

Posted: Tue Jan 05, 2016 12:06 am
by Moe
That wiring is correct if you're using the Sabertooth in R/C mode, i.e. using WiringPi to send servo PWM signals. The signals you're quoting look more like 'normal' motor control PWM, in which case you need to convert the digital PWM to an analogue voltage, boost it to 5V somehow and and set the Sabertooth to analogue mode.

Re: raspberry pi and sabertooth 2X25

Posted: Tue Jan 05, 2016 10:50 pm
by drekthrall
Moe wrote:That wiring is correct if you're using the Sabertooth in R/C mode, i.e. using WiringPi to send servo PWM signals. The signals you're quoting look more like 'normal' motor control PWM, in which case you need to convert the digital PWM to an analogue voltage, boost it to 5V somehow and and set the Sabertooth to analogue mode.
It's look like I can't control this thing with just raspberry . I need it to be as easy as can because I am noob.... I want to control this chassis https://www.pololu.com/product/1563 each side independently - 2x3motors in paralel ... I have good experience with dual H bridge l298N .. It is cheap and for me easy to control... So how about I buy 3x L298N (each motor will have one 2A channel )though each motor has max current draw 6,5A ( this car will be controlled on slab, lino so it won't be much tasked )? Could it work or if I make this I will burn out something ?

Sabertooth 2X12, Raspberry pi 3 , python

Posted: Tue May 07, 2019 10:00 am
by NoR
Bonjour, j'ai décidé de faire un robot autonome qui est composé de 4 moteurs qui est controlé par une carte Sabertooth 2x12 avec une raspberry pi 3. La première des chose est que les dip switch de la sabertooth(https://www.dimensionengineering.com/da ... th2x12.pdf) que j'ai mis, c'est :1 ON 2 OFF 3 ON 4 OFF 5 ON 6 OFF.
La deuxieme choses est que je code en python en utilisant le pwm de la raspberry. Je pense que mon code est exacte. Mon probleme est que quand j'éxécute mon programme les moteurs ne font pas ce que je leurs demande ou alors ils le font qu'une fois sur 10. Pourriez-vous m'aider à comprendre le problème svp ? Je vous remercie d'avance.

Re: raspberry pi and sabertooth 2X25

Posted: Tue May 14, 2019 7:13 pm
by danjperron
Il semble que ce post a été transféré sur les posts Français.

Je n'ai pas de problème avec cela puisque ma première langue est le français. ;-)

Bonjour NoR,

La première chose est de nous dire quel mode que tu as choisis pour la communication avec ton Sabertooth.

Si c'est le port série il ne faut pas oublier que c'est 5V. Il faut donc utiliser une interface pour convertir le 5V en 3.3V pour le PI.


As-tu des photos de ton montage?
Peux-tu nous fournir le code python que tu utilises?


Daniel

Re: raspberry pi and sabertooth 2X25

Posted: Wed May 15, 2019 4:24 am
by NoR
Bonjour, Malheureusement je n'ai pas de photos du montage. Au départ je voulais travailler en mode Analog mais il se peut qu'il est soit impossible de faire ce que je voulais dans ce mode. Je suis donc passer au mode R/C en utilisant la datasheet du sabertooth (https://www.dimensionengineering.com/da ... th2x12.pdf)

J'utilise le code python suivant:

Code: Select all

import RPi.GPIO as GPIO
import time


PIN_MOTOR1=12 #Moteur droite S1
PIN_MOTOR2=19 #Moteur gauche S2
try:
    #configure les pins
    GPIO.setmode(GPIO.BCM) 
    GPIO.setwarnings(False)
    GPIO.setup(PIN_MOTOR1, GPIO.OUT)
    GPIO.setup(PIN_MOTOR2, GPIO.OUT)
    motor1=GPIO.PWM(PIN_MOTOR1,1000)
    motor2=GPIO.PWM(PIN_MOTOR2,1000)
    #Avance
    motor1.start(75)
    motor2.start(75)
    #GPIO.output(PIN_MOTOR1, GPIO.HIGH)
    time.sleep(3) #Continue
    
    #Fais reculer
    motor1.start(25)
    motor2.start(25)
    #GPIO.output(PIN_MOTOR1,GPIO.LOW)
    time.sleep(5)
    #Freine et stoppe le moteur
    motor1.stop()
    motor2.stop()
except KeyboardInterrupt :
    pass
except :
    GPIO.cleanup()
    raise
GPIO.cleanup() 


    
    
    


Re: raspberry pi and sabertooth 2X25

Posted: Wed May 15, 2019 12:33 pm
by danjperron
Bonjour Nor,


J'ai trouvé que le mode série fonctionne très bien. Je ne pourrai pas vérifier le mode servo avant jeudi soir ( horaire de l'est).
Si tu regardes sur ce post le 17 décembre 2015. j'ai un vidéo de mon robot et le code pour le mode série.


J'ai encore le vieux chassis de ce robot avec les perceuses qui me servaient de moteurs. Je vais voir si je peux rouler en mode servo Jeudi.


Daniel

Re: raspberry pi and sabertooth 2X25

Posted: Thu May 16, 2019 4:30 am
by NoR
Bonjour Daniel,

Je vous remercie pour votre réponse. J'ai vu la vidéo, cela semble très bien fonctionner. Pour le code, je l'ai déja vu mais je code pas en C. Je code en python !
J'ai essayer de passer en mode série avec la librairie PySabertooth qui permet de commander les deux moteurs, mais cela ne fonctionne pas comme je le voudrais.

NoR

Re: raspberry pi and sabertooth 2X25

Posted: Fri May 17, 2019 12:35 am
by danjperron
Bon j'ai trouvé mon vieux chassis mais mes batteries sont à plat. Je vais essayer de les charger mais je pense que ce sera peine perdue.


En passant j'ai trouvé sur le net le code python pour Sabertooth
https://pypi.org/project/pysabertooth/

Tu as tout simplement à faire,

Code: Select all

sudo pip3 install pysabertooth
C'est le mode série mais cela devrait fonctionner si tu ajustes les DIP "switches".

il va falloir vérifier si le 3.3V du port série est suffisant. Sinon il faudra ajouter un module de conversion. 3.3 à 5V style i2c converter. C'est peut être ton problème avec le PWM. Mais le mode série permet de brancher plusieurs modules sur la même communication. Seulement TX est nécessaire. https://www.sparkfun.com/products/12009

P.S. Il faut enlever la console du port série et l'activer pour l'utiliser.

sudo raspi-config , interfacing option,serial, shell (no), serial Hardware (YES)

Utilise /dev/serial0 de cette façon tu auras le même port pour un PIB ou un PI3B

ex:

python3

Code: Select all

from pysabertooth import Sabertooth
moteurAB = Sabertooth("/dev/serial0",baudrate=9600,address=128)
moteur.drive(1,50)

Re: raspberry pi and sabertooth 2X25

Posted: Fri May 17, 2019 4:36 am
by NoR
C'est exactement la librairies que j'utilise !
Apres ajustement des DIP switch comme indiqué dans la datasheet du sabertooth (https://www.dimensionengineering.com/da ... th2x12.pdf). J'ai branché la sortie S1 au TX et la sortie S2 au RX. Quand je lance le programme pour faire avancer les deux moteurs , elles tournent dans le même sens mais pas à la même vitesse et quand je lance le programme pour faire reculer, elles ne tournent pas dans le même sens . De plus, un moteur fonctionne correctement quand je varie la vitesse , l'autre ne démarre pas ou ne s'arrete plus de tourner s'il démarre. Je me dis peut-être que le branchement ne se fait pas ainsi.
Je m'excuse d'avance si mes questions paraît sottes.

PS: Pour le port,j'utilise le port `/dev/ttyS0'

Re: raspberry pi and sabertooth 2X25

Posted: Fri May 17, 2019 11:04 am
by danjperron
Bonjour Nor,

Donc tu étais en mode série au début et non en PWM. Le code que tu as envoyé est PWM et non série. Voila ma confusion!

Les moteurs même s'Ils sont identiques n'ont pas exactement la même puissance. Il faut donc calibré leurs courbes. L'autre façon est d'ajouté un accéléromètre ou des compteur de tours comme boucle de retour.


Wow j'ai réussi à chargé mes batteries. Je vais donc enlevé mon cpu PC104 et mettre un Pizéro. Je vais ajouté mon sparkfun converteur entre le pi et le sabertooth.

Peut être lundi pusique c'est fête au québec ce weekend.

Peux-tu posté ton code en mode série. s.v.p.

Daniel

Re: raspberry pi and sabertooth 2X25

Posted: Fri May 17, 2019 11:42 am
by NoR
Bonjour,

Non non au début j'étais bien en PWM parce que je l'utilisais en mode analog d'ou le code que j'avais poster mais comme cela semblait impossible , je suis passer en mode série avec la librairie PySabertooth . Pour le code il est de la même forme que celui que vous avez poster avec Moteur.drive(1,50) . Je ne comprends pas quand vous dites qu'il faut calibrer leurs courbes, je ne vois pas de quoi vous parler et comment faire.

Bon WE et Bonne fête !

NoR

Re: raspberry pi and sabertooth 2X25

Posted: Fri May 17, 2019 12:37 pm
by danjperron
Commençons simplement.

Poste ton code sėrie même s'il est semblable. C'est dans les détails que les erreurs se trouvent souvent.

Re: raspberry pi and sabertooth 2X25

Posted: Tue May 21, 2019 3:31 am
by danjperron
Ok J'ai essayé un pizero avec sabertooth sur mon vieux chassis.

Ça fonctionne sauf qu'il faut absolument,

1 - convertir le TXM de 3.3V à 5V.
2 - En mode série avec adresse il faut mettre l'alimentation sur le sabertooth une fois que le Pi soit démarré. Le sabertooth reçoit une fausse impulsion du port série et il donne le mauvais baudrate.
https://imgur.com/a/NtQphTl
Je vais faire un petit vidéo pour te démontrer comment il fonctionne.

Voici le code que j'utilise avec une manette de jeu pour le faire avancer. (python 3)
https://gist.github.com/danjperron/d9ec ... 3caee9b154
Pour trouver les codes de la manette de jeu j'ai utilisé ce code modifié pour python3

Code: Select all

# Released by rdb under the Unlicense (unlicense.org)
# Based on information from:
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt

import os, struct, array
from fcntl import ioctl

# Iterate over the joystick devices.
print('Available devices:')

for fn in os.listdir('/dev/input'):
    if fn.startswith('js'):
        print('  /dev/input/%s' % (fn))

# We'll store the states here.
axis_states = {}
button_states = {}

# These constants were borrowed from linux/input.h
axis_names = {
    0x00 : 'x',
    0x01 : 'y',
    0x02 : 'z',
    0x03 : 'rx',
    0x04 : 'ry',
    0x05 : 'rz',
    0x06 : 'trottle',
    0x07 : 'rudder',
    0x08 : 'wheel',
    0x09 : 'gas',
    0x0a : 'brake',
    0x10 : 'hat0x',
    0x11 : 'hat0y',
    0x12 : 'hat1x',
    0x13 : 'hat1y',
    0x14 : 'hat2x',
    0x15 : 'hat2y',
    0x16 : 'hat3x',
    0x17 : 'hat3y',
    0x18 : 'pressure',
    0x19 : 'distance',
    0x1a : 'tilt_x',
    0x1b : 'tilt_y',
    0x1c : 'tool_width',
    0x20 : 'volume',
    0x28 : 'misc',
}

button_names = {
    0x120 : 'trigger',
    0x121 : 'thumb',
    0x122 : 'thumb2',
    0x123 : 'top',
    0x124 : 'top2',
    0x125 : 'pinkie',
    0x126 : 'base',
    0x127 : 'base2',
    0x128 : 'base3',
    0x129 : 'base4',
    0x12a : 'base5',
    0x12b : 'base6',
    0x12f : 'dead',
    0x130 : 'a',
    0x131 : 'b',
    0x132 : 'c',
    0x133 : 'x',
    0x134 : 'y',
    0x135 : 'z',
    0x136 : 'tl',
    0x137 : 'tr',
    0x138 : 'tl2',
    0x139 : 'tr2',
    0x13a : 'select',
    0x13b : 'start',
    0x13c : 'mode',
    0x13d : 'thumbl',
    0x13e : 'thumbr',

    0x220 : 'dpad_up',
    0x221 : 'dpad_down',
    0x222 : 'dpad_left',
    0x223 : 'dpad_right',

    # XBox 360 controller uses these codes.
    0x2c0 : 'dpad_left',
    0x2c1 : 'dpad_right',
    0x2c2 : 'dpad_up',
    0x2c3 : 'dpad_down',
}

axis_map = []
button_map = []
 
# Open the joystick device.
fn = '/dev/input/js0'
print('Opening %s...' % fn)
jsdev = open(fn, 'rb')

# Get the device name.
#buf = bytearray(63)
#buf = array.array(b'c', [b'\0'] * 64)
#ioctl(jsdev, 0x80006a13 + (0x10000 * len(buf)), buf) # JSIOCGNAME(len)
#js_name = buf.tostring()
buf=b'\0'*64
buf = ioctl(jsdev, 0x80006a13 + (0x10000 * len(buf)), buf) # JSIOCGNAME(len)
js_name = buf.decode("utf-8").split('\0')[0]
print('Device name: %s' % js_name)

# Get number of axes and buttons.
buf = b'\0'
#buf = array.array('B', [0])
#ioctl(jsdev, 0x80016a11, buf) # JSIOCGAXES
buf=ioctl(jsdev, 0x80016a11, buf) # JSIOCGAXES

num_axes = struct.unpack('B',buf)[0]
buf = b'\0'
buf= ioctl(jsdev, 0x80016a12, buf) # JSIOCGBUTTONS
num_buttons = struct.unpack('B',buf)[0]

#print("num_axes ",num_axes)
#print("num_buttons ",num_buttons)

#buf = array.array('B', [0])
#ioctl(jsdev, 0x80016a12, buf) # JSIOCGBUTTONS
#num_buttons = buf[0]

# Get the axis map.
buf = b'\0'*64

#buf = array.array('B', [0] * 0x40)
#ioctl(jsdev, 0x80406a32, buf) # JSIOCGAXMAP
buf = ioctl(jsdev, 0x80406a32, buf) # JSIOCGAXMAP

for axis in buf[:num_axes]:
    axis_name = axis_names.get(axis, 'unknown(0x%02x)' % axis)
    axis_map.append(axis_name)
    axis_states[axis_name] = 0.0

# Get the button map.
buf = b'\0' * 400
#buf = array.array('H', [0] * 200)
buf = ioctl(jsdev, 0x80406a34, buf) # JSIOCGBTNMAP
buf = struct.unpack('H'*(len(buf)//2),buf)

for btn in buf[:num_buttons]:
    btn_name = button_names.get(btn, 'unknown(0x%03x)' % btn)
    button_map.append(btn_name)
    button_states[btn_name] = 0

print ('%d axes found: %s' % (num_axes, ', '.join(axis_map)))
print ('%d buttons found: %s' % (num_buttons, ', '.join(button_map)))



# Main event loop
while True:
    evbuf = jsdev.read(8)
    print(evbuf)
    if evbuf:
        time, value, type, number = struct.unpack('IhBB', evbuf)

        if type & 0x80:
             print( "(initial)"),

        if type & 0x01:
            button = button_map[number]
            if button:
                button_states[button] = value
                if value:
                    print( "%s pressed" % (button))
                else:
                    print("%s released" % (button))

        if type & 0x02:
            axis = axis_map[number]
            if axis:
                fvalue = value / 32767.0
                axis_states[axis] = fvalue
                print( "%s: %.3f" % (axis, fvalue))

Donc la librarie fonctionne à merveille!

Re: raspberry pi and sabertooth 2X25

Posted: Wed May 22, 2019 4:26 am
by NoR
Bon j'utilise un raspberry pi 3 avec le sabertooth.
Voici le code que j'utilise

Code: Select all

#!usr/bin/env python
#*coding:utf-8*

from pysabertooth2 import Sabertooth
import serial
import time

saber = Sabertooth('/dev/ttyS0', baudrate=9600, address=130, timeout=0.1)

# drive(number, speed)
#number : 1-2
#speed: -100 à +100

saber.drive(1,50) 
saber.drive(2,50)
time.sleep(3)

saber.drive(1,-50) 
saber.drive(2,-50)
time.sleep(3) 

#avance pendant 5 secondes
#saber.driveBoth(50,50)
#time.sleep(3)

saber.stop()
saber.close()


Ce que je cherche à faire c'est que mon robot avance pendant 3 secondes et recule pendant 3 secondes dès l'éxecution de mon programme, je ne veux pas le commander avec une manette par exemple, car je veux le rendre autonome. Mais je n'arrive pas à le faire correctement. Pourrais-je avoir savoir comment vous avez fait le montage pour lier la sabertooth et la raspberry ? Et régler les DIP switch du sabertooth svp.

Re: raspberry pi and sabertooth 2X25

Posted: Wed May 22, 2019 8:04 pm
by danjperron
Bonjour Nor.

Ton code est des plus simpliste et devrait fonctionner.
Ce qui me fait penser que tu as un problème. C'est peut être un de ceux que je t'ai posté.


1- En mode d'addressage le baudrate ce fait automatiquement sauf que le Pi envoie des caractères aléatoires lors de son power UP ce qui entraîne un mauvais baudrate au sabertooth. La solution est d'activer l'alimentation du sabertooth une fois que le Pi est pleinement en fonction. De cette façon le premier caractère envoyé sera le code ascii 170 (0xaa).

2 - Il faut absolument convertir le TX 3.3V en TX 5V sinon le sabertooth ne fonctionnera pas. Un convertisseur d'adafruit ou de sparkfun fera l'affaire.(ou un mosfet avec des pullups)
RPI_Sabertooth.jpg
sabertooth to RPI
RPI_Sabertooth.jpg (102.66 KiB) Viewed 2581 times

Voici d'autres problèmes possible.

3 - L'alimentation du sabertooth est insuffisante et le sabertooth se remet à zéro(reset) par lui-même.

4 - J'espère que tu n'utilises pas le 5V du sabertooth. Il est seulement de 100ma!


P.S. mes DIP switch sont ceux affichés sur l'image. mon addresse est 128 et non 130. Aussi pense à faire un stop avant de reculer. Ce n'est pas très bon de reculer lorsque les moteurs tournent de l'autre sens.

N.B. J'ai noté que ton module ce nomme pysabertooth2. Tu as changé le nom ou tu as une autre version?

Daniel

Re: raspberry pi and sabertooth 2X25

Posted: Wed May 22, 2019 8:13 pm
by danjperron
Il faut peut être attendre un peut que le sabertooth soit initialisé avant d'envoyer les premières commandes.

Peut être un petit délais de 100ms après la création de l'objet saber

Code: Select all

saber = Sabertooth('/dev/ttyS0', baudrate=9600, address=130, timeout=0.1)
time.sleep(0.1)
saber.drive(1,50)
...
Je vais vérifier cela ce soir.