Page 1 of 1
NXTMMX - No unregulated speed control?
Posted: 22 Sep 2011, 12:41
by ricardocrl
Hi all,
I'm using an NXTMMX with PF motors L. With an Angle sensor from HiTechnic, I want to do my own PID control of the motor positioning.
I got surprised that the speed of the L motor seems to be "full", whatever value I ask for. It makes me believe that the NXTMMX is using speed regulation, making the speed always maximum due to no tachometer feedback.
Does anyone confirm that the NXTMMX doesn't work with unregulated speed/power?
Ricardo
Re: NXTMMX - No unregulated speed control?
Posted: 29 Sep 2011, 15:21
by mattallen37
I ran into the same situation with the new NXShield. I talked to Deepak about it, and he said to set the P parameter to 0. Therefore, write registers 0x7a, and 0x7b to 0. The NXShield motor control and NXTMMX are very much the same. I tested it to work with the NXShield, but I haven't tried it with my NXTMMX yet (I should see exactly the same results). I don't know that the "speed" written to the speed register translates into PWM percentage, but it is some sort of direct PWM control.
Re: NXTMMX - No unregulated speed control?
Posted: 29 Sep 2011, 17:20
by ricardocrl
I got a reply from mindsensors support some days ago with nice information:
Use the function:
void MMX_Init( byte port, byte addr, byte profile )
where profile is MMX_Profile_RCX_Motors
this initializes the NXTMMX for RCX motors (which don't have the encoder).
It's not reported in the API, but now we know!
I haven't tried it yet!
Re: NXTMMX - No unregulated speed control?
Posted: 29 Sep 2011, 17:24
by ricardocrl
Oops, now I checked and, that macro is not defined. There is no new API in the mindsensors webpage, so I'll ask them again the value of MMX_Profile_RCX_Motors.
I'll drop it here as soon as I know.
Re: NXTMMX - No unregulated speed control?
Posted: 29 Sep 2011, 17:46
by mattallen37
Okay, cool.
Re: NXTMMX - No unregulated speed control?
Posted: 29 Sep 2011, 19:28
by ricardocrl
Here are the new features!
Code: Select all
/*
* Motor profile related constants
*/
#define MMX_Profile_NXT_Motors 0
#define MMX_Profile_RCX_Motors 1
#define MMX_Profile_LinearActuators 2
void MMX_Init( byte port, byte addr, byte profile )
{
SetSensorLowspeed(port);
switch (profile) {
case MMX_Profile_NXT_Motors:
// do nothing.
break;
case MMX_Profile_RCX_Motors:
MMX_WriteByte(port, addr, 0x46, 0); // set M1 speed to zero.
MMX_WriteByte(port, addr, 0x4e, 0); // set M2 speed to zero.
MMX_WriteByte(port, addr, 0x7a, 0); // set P lo-byte to zero.
MMX_WriteByte(port, addr, 0x7b, 0); // set P hi-byte to zero.
break;
case MMX_Profile_LinearActuators:
// not implemented yet.
break;
default:
TextOut(0, LCD_LINE5, "MMX: Incorrect ", false);
TextOut(0, LCD_LINE6, "Motor Profile. ", false);
TextOut(0, LCD_LINE7, " ", false);
TextOut(0, LCD_LINE8, "Press ORNG Btn ", false);
PlayTone (440,200);
Wait (500);
PlayTone (440,200);
until(ButtonPressed(BTNCENTER, true));
StopAllTasks();
break;
}
}