Monsterborg does not spin correctly

I got a new monsterborg and assembled everything as described.
Everything worked fine! Congratulations, good description.
And started with the monsterSequence and also that worked fine for
the first time ..but then spinning started to make problems, no 360°,
not reproducible.
I assumed the wheels slipped, but not the problem.
I checked the contacts on the Thunderborg, correct.
I ran the test program and realized that the right motors went back
to the starting position after the complete sequence, but the left motors
didn't!
What do I do wrong? Any advice appreciated. Thanks.

piborg's picture

You have not done anything wrong, the script just needs some tuning :)

The first thing to bear in mind is that the monsterSequence.py is a simple example using the sleep command. This produces an approximate delay, but it will vary slightly on each run.

What you want to do is tune the delays to match the actual speed of your MonsterBorg. Start by looking for this line in the script:

testMode = False                        # True to run the motion tests, False to run the normal sequence

and change the value to True.

When you run the script now it should try and drive for 50 cm and spin for 360° one step at a time. What you want to do is tune the settings one at a time until the MonsterBorg moves the correct distance.

Forward / reverse motion:

  • If the MonsterBorg moves too far reduce timeForward1m slightly
  • If the MonsterBorg does not move far enough increase timeForward1m slightly

Spinning:

  • If the MonsterBorg moves too far reduce timeSpin360 slightly
  • If the MonsterBorg does not move far enough increase timeSpin360 slightly

Another point to bear in mind is the spin time will be affected by surfaces. For example a thick carpet resists the MonsterBorg spinning and needs a larger delay.

Thanks for fast reply...however I have done al this.
Maybe I wasn't detailed enough:
I ran monsterSequence and the first time it worked perfectly (one or two times) the move as well as the spin.
I then wanted to try out the tuning by using the test mode and all of a sudden the spinning didn't work anymore, so I suspected something broke or got loose. I therefore checked the wheels and afterwards the contacts on the board; everything was o.k.. To exclude the surface effect you mentioned I took off the wheels and looked at the turning motors without the wheels attached and found that the left motors apparently worked fine (that means after the sequence they came back to the Initial Position) but the right ones didn't.
Of course the sequence is now srewed up, but the movement Forward and backward is still correct?!
Would it make sense to test with the Tbsequence?

piborg's picture

The tbSequence.py script just runs the motors through some fixed power outputs, so running it would not prove very much.

When you say the spinning no longer worked, how was the MonsterBorg moving instead?

relatively unpredictable, making 180° turns instead of 360, sometimes less, often not getting back to the starting Position????

piborg's picture

It sounds like the left and right motors may not be running at the same speeds.

When you run the MonsterBorg forwards in the tuning script does it drive straight or does it drift to the left or right?
If it does drift is it a long way or just a small amount?

it drives pretty straight

piborg's picture

Does it also drive pretty straight in reverse?

sorry for bothering you that much, but...
I ran a few more tests:
drive 0.5/reverse(set values) o.k., drive 1.0/reverse o.k. (straight line)
spin 360°/-360°: about 200°/-200°, spin 180°/-180° around 90°/-90°

So no change,just again: when I ran it the first time, everything was fine, I was amazed and delighted, but then...

piborg's picture

No worries, odd things like this happen sometimes :)

It sounds like the spin is only running for about half the time it needs to. Try doubling the value of timeSpin360 and see if the spin is closer to the correct angles.

On a side note the amount moved will vary slightly with the battery voltage. Most of the time this will not be too much of a difference, but it may get large when the batteries are starting to get flat.

good idea: I tried this already, but this didn't change much, it span a bit further, but not 360°.
The batteries are new, I installed them with the new mborg.

..just to let you know, I tried a few more things:
I newly installed the software -> no change
I introduced TB.GetDriveFault1 and 2 all "False" , so seems to be correct ?!

There is still a difference between the left and right motors after spin:
the right motors return to their initial position (without being on the ground, no resistance)
the left motors don't
After the move both motors are correct, back to their inital position (explaining the straight line)

I'm getting confused :-(((

piborg's picture

Looking at the code again there will be a minor difference between the time each side is actually on for.

If you look at the PerformMove function:

# Function to perform a general movement
def PerformMove(driveLeft, driveRight, numSeconds):
    # Set the motors running
    TB.SetMotor1(driveRight * maxPower)
    TB.SetMotor2(driveLeft * maxPower)
    # Wait for the time
    time.sleep(numSeconds)
    # Turn the motors off
    TB.MotorsOff()

you can see that the motors are set one at a time, but they are powered off at the same time. This will mean the right side motors are on for slightly longer than the left motors.

On longer moves this will not matter, but on shorter moves it may make a difference. If instead we re-code the function to turn the motors off in the same order it may make things a bit more equal:

# Function to perform a general movement
def PerformMove(driveLeft, driveRight, numSeconds):
    # Set the motors running
    TB.SetMotor1(driveRight * maxPower)
    TB.SetMotor2(driveLeft * maxPower)
    # Wait for the time
    time.sleep(numSeconds)
    # Turn the motors off
    TB.SetMotor1(0)
    TB.SetMotor2(0)

I tried it out, but sorry didn't change anything

I tried it out, but sorry didn't change anything

piborg's picture

I am not sure this will make any difference, but it may change the behaviour.

Look for the power settings in the script:

# Power settings
voltageIn = 12.0                 # Total battery voltage...
voltageOut = 12.0 * 0.95         # Maximum motor voltage...

Change the voltageOut so it matches the voltageIn:

# Power settings
voltageIn = 12.0                 # Total battery voltage...
voltageOut = 12.0                # Maximum motor voltage...

What this will do is allow the script to use 100% power. This might help or it might have no effect.

Hi Piborg,
In my despair I changed the batteries and this did the trick!
I don't understand why they ran that low so early, but anyway...
Sorry for bothering you with so many questions, thanks for your support
and help!

Subscribe to Comments for "Monsterborg does not spin correctly"