5 years
Hello all,
I am participating in an underwater Robotics in competition. I am using roborealm for the entire control of the AUV!! The image Processing part is very helpful and satisfies the competition requirement.
I will be using six thrusters to control the AUV. 2 thrusters for scanning the object (using differential drive), another 2  for Forward/Backward and the last 2 for Up/Down. I am using Arduino Uno.
The issues i am facing here now, is controlling the motors.
1. Firstly, i want to bring about a differential drive before the image processing part, so that the vehicle PANS to detect the object.
For achieving this I wrote a VBScript
motorA = 800
motorB = 1000

I need the PWM out for all the six thrusters. In differential drive they have given an example of a joystick, but this is autonomous, and I don't want to use the analog out.
How do i go about this?

I need help. Thanks in advance.
Steven Gentner from United States  [1424 posts] 5 years
I'm assuming this is a duplicate/related post for


Please read that post first.

Anonymous 5 years
Hi steven!! thanks for replying, it's a coincidence that it's similar!! i am still having this difficulty, that is controlled using a joystick but here i need to make it autonomous..!! I tried setting 2 variables again motora = 1000 and motorb = 1000, and  and called it arduino module, PWM pin 3 and 5!! sadly, motors did not run, could you please help me with it..
Steven Gentner from United States  [1424 posts] 5 years
Can you verify that the motors work and that setting those pins on the arduino cause the motors to move?

I'd recommend writing a quick Arduino Sketch to verify this ...

Otherwise, please post the robofile you currently have so I can verify your setup.

Anonymous 5 years
Thanks for replying!!

Yes, the motors work, i have verified it. I have already attached my robo file. Plz help me!
Steven Gentner from United States  [1424 posts] 5 years
Have you written a quick Arduino Sketch that sets the values of pin3 and pin9 to 800 and 1000 to see if the motors respond?

Anonymous 5 years
Hi Steven, yes i tried the motors are running with a basic arduino sketch. The motors run.
And moreover, i wrote a vbscript like this
motora = 1000
connected it to servo motor, when i change the value to different value like 2500, the servo responds and goes to the max position.
So the same PWM must run the motors, isn't it?? Like i had asked i want to bring about the panning (clockwise)  using thrusters, is it possible?
Steven Gentner from United States  [1424 posts] 5 years
Yes, the motors will most likely react to the PWM signal ... thus the 500 to 2500 range.

Note, 1000 is NOT normally neutral in the PWM world, 1500 is.

I think you have all you need. Just play around with the values for a bit and then reread this post. You just need to gain a little comfort in setting values for the thrusters and what each value does. Once you have a better understanding of how these values affect the thrusters/servos you can change them accordingly. Try recording what a bunch of different values do and see if you can build a model from those values.

Anonymous  [2 posts] 5 years
Hey....i have been working on something similar after going through this thread!!. Thanks steven.!!
  I went through the ball tracking tutorial in the tutorial section on roborealm website. Since the vb script was written for a ssc i had an issue in using the same vb script for an arduino board, so i resolved this issue by replacing the values to 1500 in place of 128, when i tested it with an arduino it appears to be working fine.

question 1: is this how it should be done or is there anything i need to change?
question 2: tracking the ball stops as soon as the ball is out of the raster....as soon as it goes out of the raster it should scan so that the ball comes inside the raster and the robo resumes the tracking operation.
will the differential drive module work ? or will any change in the existing vb script work? PLEASE HELP!!
Steven Gentner from United States  [1424 posts] 5 years

Q1: Not sure if that would be the only change. It is certainly the most common since different servo/motor boards will use different value ranges. Some other boards are not able to switch from negative values to positive values really quickly so care should be taken if your board doesn't support that very well. In most cases they do i.e. they slowly ramp down and up instead of just switching voltage instantly which could damage your motor.

Q2: For predictive movement have a look at the code in


where the VBScript is more complicated but will continue to move the turret in the direction where the ball was last seen.

If you happen to be using the Differential Drive then that can be used to achieve the same thing but with less code. I.e. just enable the Predictive Behavior and set a decay value. The decay value indicates how long the robot should continue to move in the last known direction in an attempt to pickup the ball again.

Note, the turret code also uses a search pattern by default which works for a turret but will probably not work very well for a moving robot.


Anonymous  [2 posts] 5 years
Thank you steven


 New Post   Forum Index