|
Page 1 of 1
|
[ 4 posts ] |
|
bug: struct float values NEVER can be assigned/no read b.val
Author |
Message |
Ford Prefect
Guru
Joined: Sat Mar 01, 2008 12:52 pm Posts: 1030
|
 bug: struct float values NEVER can be assigned/no read b.val
hi,
similar to problem of my other question re. structure operations,
the struct values can't be assigned at all if they are float (see lines 99-101),
and even can't be read at all if the struct is passed to a function by value; see lines 61 and 109 (code see next post):
There it seems if you can't assign any float values at all, not even directly!
_________________ regards, HaWe aka Ford #define S sqrt(t+2*i*i)<2 #define F(a,b) for(a=0;a<b;++a) float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}
Last edited by Ford Prefect on Sat Apr 19, 2008 6:13 am, edited 10 times in total.
|
Thu Apr 17, 2008 9:17 am |
|
 |
Ford Prefect
Guru
Joined: Sat Mar 01, 2008 12:52 pm Posts: 1030
|
simplified code for bug fixing:
 |  |  |  | Code: // Neuronales Netz aus 1 Neuron // LTU = Linear Threshold Unit oder // Adaline = Adaptive linear element
#define printXY nxtDisplayStringAt
const int nl0 = 20;
const int nd = 20; const float th = 0.5; float lbd = 0.2;
float dummy;
//**********************************************************************
typedef struct{ float in[nd]; float w[nd]; float t[nd]; float net; float thr; float act; float out; } tNeuron;
tNeuron Neuron0[nl0]; // nl0=20 Neuronen in Eingabeschicht 0
//**********************************************************************
void ResetNeuron(tNeuron &neur){ // alles auf Null int d;
for (d=0; d<nd; d++) { neur.in[d]=0; neur.w[d]=0; neur.t[d]=0; } neur.net=0; neur.thr=th; neur.act=0; neur.out=0;
}
//**********************************************************************
void initAllNeurons(){ // alle Netz-Neuronen auf Null
ResetNeuron(Neuron0[0]);
}
//**********************************************************************
float netPropag(tNeuron neur){ // DOESN'T WORK! [line 61] int j=0; float s=0;
for(j=0;j<nd;j++){ s+= (neur.in[j]*neur.w[j]); // gewichtete Summe } dummy=s; // global variable to check the value of s printXY( 0,20, "s loc"); printXY(50,20,"%4.1f",s); return s; }
//**********************************************************************
void pause() { while(true) wait1Msec(50); }
task displayValues(){ while(true) {
printXY( 0,60, "in(0 1)"); printXY( 50,60, "%2.0f", Neuron0[0].in[0]); printXY( 70,60, "%2.0f", Neuron0[0].in[1]);
printXY( 0,50, "w (0 1)"); printXY( 50,50, "%2.1f", Neuron0[0].w[0]); printXY( 70,50, "%2.1f", Neuron0[0].w[1]); // FAULTY! shows 0/1, but must be 0.8/1.3 !!!
printXY( 0,40, "net"); printXY(50,40,"%4.1f",Neuron0[0].net); // should change depending on Sensor Values printXY( 0,30, "dummy"); printXY(50,30,"%4.1f",dummy); // should change depending on Sensor Values
printXY( 0,10, "thr"); printXY(50,10,"%4.1f",Neuron0[0].thr); // FAULTY! shows 1.0, but must be 1.5 !!!
} return; }
void InitThisNeuronalNet(){ Neuron0[0].w[0]=0.8; // [line 99] FAULTY!!! should be assigned to 0.8, but gets 0.0 !!!! Neuron0[0].w[1]=1.3; // [line 100] FAULTY!!! should be assigned to 1.3, but gets 1.0 !!!! Neuron0[0].thr=1.5; // [line 101] FAULTY!!! should be assigned to 1.5, but gets 1.0 !!!! }
task RefreshNet(){ while(true){ Neuron0[0].in[0]=(float)SensorValue(0); // Input 0: Touch-Sensor an S1=0 Neuron0[0].in[1]=(float)SensorValue(1); // Input 1: Touch-Sensor an S2=1
Neuron0[0].net=netPropag(Neuron0[0]); // [line 109] function call - -> [line 61] } return; }
task main(){ SensorType(S1)=SensorTouch; SensorType(S2)=SensorTouch;
InitAllNeurons(); InitThisNeuronalNet();
StartTask (displayValues); StartTask (RefreshNet); pause(); }
|  |  |  |  |
@developers, @Dick Swan: Could you please have a look to this bug?
_________________ regards, HaWe aka Ford #define S sqrt(t+2*i*i)<2 #define F(a,b) for(a=0;a<b;++a) float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}
|
Fri Apr 18, 2008 5:44 pm |
|
 |
starwarslegokid
Moderator
Joined: Wed Jan 31, 2007 3:39 am Posts: 299 Location: San Diego, California. USA
|
The problem is this is not a bug posting forum, its a discussion forum for users to discuss NXT programing and pass along ideas. This is not the proper way to contact the developers with bugs, we have mentioned it many times. The proper way to post a bug is with the bug tracker, that is the best way to post your bugs to the developers, thats why its there. Once it is in the bug tracker, the developers will get to it as soon as possible.
Right now Dick is very busy due to FIRST robotics changing their robotics system to the NXT for their future season, and he is working on making RobotC fully compatible with their new hardware.
Once again, you need to be patient! Change dosn't occur in an instant, it takes allot of time and work. Remember, RobotC would not be what it is today without all the suggestions from its users, but patience is a must, and all your messages are coming across as impatient, blunt, and non understanding. There is absolutely no need to keep reposting reminders.
Scott
_________________Mmmm Legos B-) My Robot Projects: http://www.freewebs.com/robotprojects/
|
Thu May 01, 2008 3:33 pm |
|
 |
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 620
|
This issue has been fixed as of the latest firmware release posted to the forums.

_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
Tue May 06, 2008 2:20 pm |
|
|
|
Page 1 of 1
|
[ 4 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
|
|