View unanswered posts | View active topics It is currently Sat Dec 20, 2014 1:33 am






Reply to topic  [ 6 posts ] 
motor power reading 
Author Message
Novice

Joined: Sun Feb 24, 2008 6:15 pm
Posts: 50
Post motor power reading
Hi,

Could you explain to me why the following code :
Code:
#pragma config(Motor,  motorA,          ,              tmotorNormal, openLoop)
#pragma config(Motor,  motorC,          ,              tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//#include "PID.h"
#include "Odo.h"



task main()
{
nMotorEncoder[motorA] = 0;
nMotorEncoder[motorC] = 0;

   motor[motorA] = (int)(1.0*0.047);
         motor[motorC] = (int)(1.0 * 0.047);
         wait1Msec(10);
         writeDebugStreamLine("%d;%d;", motor[motorC],motor[motorA]);//,(int)(1.0 * 0.047));

   motor[motorA] = floor(1.0*0.047);
         motor[motorC] = floor(1.0 * 0.047);
         wait1Msec(10);
         writeDebugStreamLine("%d;%d;%d", motor[motorC],motor[motorA],floor(1.0 * 0.047));

            motor[motorA] = 0;
         motor[motorC] = 0;
         wait1Msec(10);
         writeDebugStreamLine("%d;%d", motor[motorC],motor[motorA]);
         wait10Msec(100);
      writeDebugStreamLine("%d;%d", motor[motorC],motor[motorA]);

}


I have the following debug stream :

34;40;
34;40;0
34;40
34;40

My robot works better when the read of the motor[motorC] give 0 and not 34 or 40!

Thanks

Thibaud

_________________
My Eurobot team website :
http://blog.mlrobotic.com/


My MOCs :
http://nxtgen.6mablog.com


Wed Feb 08, 2012 3:15 pm
Profile WWW
Online
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1367
Post Re: motor power reading
Hmm, that sounds like a bug in RobotC. The motor array takes integer type so the (int) cast of (1.0*0.047) should be 0. Please send a report to support@robotc.net.


Wed Feb 08, 2012 3:28 pm
Profile
Novice

Joined: Sun Feb 24, 2008 6:15 pm
Posts: 50
Post Re: motor power reading
Thanks for your answer i will send an email to the support.

If i restart the NXT(with usb connected) i obtain good results but sometimes the result are bad... it's very strange

_________________
My Eurobot team website :
http://blog.mlrobotic.com/


My MOCs :
http://nxtgen.6mablog.com


Wed Feb 08, 2012 4:53 pm
Profile WWW
Novice

Joined: Sun Feb 24, 2008 6:15 pm
Posts: 50
Post Re: motor power reading
I've done some tests today, after a run of my program, and download via usb the same program i've always the error. But if i use Bluetooth to download my program I don't have the error.

_________________
My Eurobot team website :
http://blog.mlrobotic.com/


My MOCs :
http://nxtgen.6mablog.com


Sun Feb 12, 2012 3:06 pm
Profile WWW
Novice

Joined: Sun Feb 24, 2008 6:15 pm
Posts: 50
Post Re: motor power reading
Hi Miki,

the error that I have is explained on my first post. When i download the program with usb and execute it the debug stream output is not good(i read some values in the motor array but not the 0 that i put in)

The motor execute my 0 as an other value!

_________________
My Eurobot team website :
http://blog.mlrobotic.com/


My MOCs :
http://nxtgen.6mablog.com


Sun Feb 12, 2012 6:00 pm
Profile WWW
Novice

Joined: Sun Feb 24, 2008 6:15 pm
Posts: 50
Post Re: motor power reading
I will doing the test tonight.

But i want to add an information, the error is not only on the debugstream
if i do the following test

Code:
motor[motorA] = 0;
if(motor[motorA] == 0)
{
}
else
{
}


I enter in the else and not in the if. The thing persist in USB but not in BT... Sometimes if i'm not in debug i've the error to.

Thibaud.

_________________
My Eurobot team website :
http://blog.mlrobotic.com/


My MOCs :
http://nxtgen.6mablog.com


Mon Feb 13, 2012 4:59 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.