Part: Diff_drive

Hello development team,

I wonder, why diff_drive part is not included at the default distribution.

Is nobody missing this basic 2 wheel controller ?
I’d like to extend the controller classes for simple arduino nano pymata usage.

Thanks for a short feedback


By and large the current design has one set of drive wheels and one steering set. More of an Ackerman model, even though kinematic models aren’t directly used in the project per say like they might be in a ROS project. The default car receive its velocity commands for essentially a fixed set of rear wheels.

Whereas differential drive is more suited for robots with two primary wheels that provide velocity and angle from a single set of wheels and have a third caster or similar type wheel for balance.

I suspect the real reason is that most of the model cars more closely resemble the ackerman, but as indicated at the top, even that is controlled through simple “+1/-1” for forward/reverse and “+1/-1” for left right without any linear algebra one might normally use to convert angle/velocity into separate motor commands on a differential drive robot.

That said, there’s nothing stopping you from building your own diff-drive robot and using the part. (I’m in process on such a car myself, mostly because it’s much easier to get odometery)

Yes, thats it. I’m coming from ROS and have a lot of diffdrive robots available. I’m typically using tank like vehicles and use simple USB connected arduino PWM hardware.
We should give it a try and I like to port my generic ros USB PWM drivers to DonkeyCar.

Many thanks for your friendly hints


There are TwoWheelSteeringThrottle in the donkeycar 3.0.x I use this class and Adafruit_DCMotor_Hat to run donkeycar on JetBot. However, TwoWheelSteeringThrottle did not work as it is, so I am using it as follows.

diff -ur donkeycar/donkeycar/parts/ac\                                                                       
---   2019-06-25 20:32:47.733752617 +\
+++ donkeycar/donkeycar/parts/       2019-06-23 12:41:12.214024421 +\
@@ -241,9 +241,13 @@
         from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor      
         import atexit                                                          
-        self.FORWARD = Adafruit_MotorHAT.FORWARD                               
-        self.BACKWARD = Adafruit_MotorHAT.BACKWARD                             
- = Adafruit_MotorHAT(addr=0x60)                                 
+        #self.FORWARD = Adafruit_MotorHAT.FORWARD                              
+        #self.BACKWARD = Adafruit_MotorHAT.BACKWARD                            
+ = Adafruit_MotorHAT(addr=0x60)                                
+        self.FORWARD = Adafruit_MotorHAT.BACKWARD                              
+        self.BACKWARD = Adafruit_MotorHAT.FORWARD                              
+        self.RELEASE = Adafruit_MotorHAT.RELEASE                               
+ = Adafruit_MotorHAT(i2c_bus=1)                                 
         self.motor =                               
         self.motor_num = motor_num                                             
@@ -251,8 +255,10 @@
         self.speed = 0                                                         
         self.throttle = 0                                                      
+    def turn_off_motors(self):                                                 
     def run(self, speed):                                                      
         Update the speed of the motor where 1 is full forward and              
@@ -270,10 +276,10 @@
     def shutdown(self):                                                        
 class Maestro:                                                                 
1 Like

Hi thanks,
great hint. I’m digging in the same lines to add my new driver :slight_smile: