FEZ Cerbot v1.3 - motor control

Hello,

I have trouble using following call with Cerbot:


            cerbotController.SetMotorSpeed(-25, 100);

My goal is to turn the Cerbot 180 degrees to avoid obstacles. But when I use this line both wheels are spining the same direction and speed.

Could someone try to spin Cerbot’s wheels oposite way?

Here is my DeviceInfo:


DeviceInfo:
  HAL build info: 4.2.0.0, Copyright GHI Electronics, LLC
  OEM Product codes (vendor, model, SKU): 255, 0, 65535
  Serial Numbers (module, system):
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  Solution Build Info: 4.2.5.0, Copyright (C) GHI Electronics, LLC
  AppDomains:
    default, id=1
  Assemblies:
    mscorlib,4.2.0.0
    Microsoft.SPOT.Native,4.2.0.0
    Microsoft.SPOT.Hardware,4.2.0.0
    Microsoft.SPOT.Graphics,4.2.0.0
    Microsoft.SPOT.TinyCore,4.2.0.0
    Microsoft.SPOT.Hardware.SerialPort,4.2.0.0
    Microsoft.SPOT.IO,4.2.0.0
    System.IO,4.2.0.0
    Microsoft.SPOT.Hardware.OneWire,4.2.0.0
    Microsoft.SPOT.Hardware.Usb,4.2.0.0
    System.Xml,4.2.0.0
    Microsoft.SPOT.Hardware.PWM,4.2.0.1
    Microsoft.SPOT.Net,4.2.0.0
    System,4.2.0.0
    GHI.OSHW.Hardware,4.2.5.0
    Gadgeteer,2.42.0.0
    Microsoft.SPOT.Net.Security,4.2.0.0
    Microsoft.SPOT.Touch,4.2.0.0
    System.Http,4.2.0.0
    GHI.Hardware.FEZCerb,4.2.5.0
    System.Net.Security,4.2.0.0
    Cerbot,1.0.0.0
    GHIElectronics.Gadgeteer.FEZCerbot,1.0.0.0

Thanks for any information,

Jan

Did you assemble yourself? Sounds like one of your motors is wired backwards.

Thanks, but he uses this method with same speed for both motors, not different.

Nope, bought it assembled. Do someone have some simple code to drive just the wheels without library provided? To ensure if the software isn’t trouble here?

Thanks,
Jan

There is definitely a problem in the driver. I just tried and got the following results.

            cerbotController.SetMotorSpeed(99, 0);      // Both wheels move forward.
            cerbotController.SetMotorSpeed(0, 99);      // No wheels move.
            cerbotController.SetMotorSpeed(99, -99);     // Both wheels move forward.

I guess this has gone unnoticed before now since we’ve all been focusing on a balancing bot that moves both wheels in the same direction all the time :frowning:

EDIT: Here be the problem…

public void SetMotorSpeed(int leftSpeed, int rightSpeed)
{
	if (leftSpeed > 100 || leftSpeed < -100 || rightSpeed > 100 || rightSpeed < -100)
		new ArgumentException("The motor speed must be between -100 and 100");

	if (this.leftInverted)
		leftSpeed *= -1;

	if (this.rightInverted)
		rightSpeed *= -1;

	this.SetSpeed(this.leftMotor, this.leftMotorDirection, leftSpeed, true);

// What's wrong with this statement??? (wink, wink)
	this.SetSpeed(this.rightMotor, this.rightMotorDirection, leftSpeed, false);
}

You can download the driver from codeplex and fix it yourself until the next SDK comes out.

2 Likes

Well well, what a nasty bug :slight_smile: Thanks Ianlee74 for help, now I know what to do to keep my cerbot running like charm!

Jan

We’ll have this fixed in the next release of the SDK.

1 Like

Thx John for the info,

Jan