IR sensor exponential response
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
IR sensor exponential response
Hello Benj,
I am currently working on the infrared sensor of the allcode.
In simulation, the response is linear and responds to the equation: IR = 4290-3*distance.
In practice, the answer is of exponential type and responds to an equation IR = 4890 * exp (-0.57 * distance), then I modify my program with a macro in which I call the macro simulation readIR:
.lecture_UINT = FormulaAllCode :: Read (.I)
and I convert the value using the following code:
.lecture_float = .lecture_UINT
.lecture_float = (-0.00333 * .lecture_UINT) + 14.3
.lecture_float = 4890 * exp ((-0.57 * .lecture_float))
.lecture_string = FloatToString $ (.lecture_float)
.lecture_UINT = StringToInt $ (.lecture_string)
.Return = .lecture_UINT
Could we have in the properties of the API the possibility of having the right equation and the parameters A and B of the exponential equation: A * exp (B * distance) configurable?
Simultaneous would allow to obtain results close to reality and to be able to compare the simulation and the measurements.
I tried to create a new model based on "FormulaAllCode API" but without success ... Can you see where the problem is?
thank you in advance
Bruno
I am currently working on the infrared sensor of the allcode.
In simulation, the response is linear and responds to the equation: IR = 4290-3*distance.
In practice, the answer is of exponential type and responds to an equation IR = 4890 * exp (-0.57 * distance), then I modify my program with a macro in which I call the macro simulation readIR:
.lecture_UINT = FormulaAllCode :: Read (.I)
and I convert the value using the following code:
.lecture_float = .lecture_UINT
.lecture_float = (-0.00333 * .lecture_UINT) + 14.3
.lecture_float = 4890 * exp ((-0.57 * .lecture_float))
.lecture_string = FloatToString $ (.lecture_float)
.lecture_UINT = StringToInt $ (.lecture_string)
.Return = .lecture_UINT
Could we have in the properties of the API the possibility of having the right equation and the parameters A and B of the exponential equation: A * exp (B * distance) configurable?
Simultaneous would allow to obtain results close to reality and to be able to compare the simulation and the measurements.
I tried to create a new model based on "FormulaAllCode API" but without success ... Can you see where the problem is?
thank you in advance
Bruno
- Attachments
-
- Formula AllCode API_V2.fcpx
- (337.72 KiB) Downloaded 283 times
-
- Formula AllCode API_V2.fcfx
- (15.29 KiB) Downloaded 278 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: IR sensor exponential response
Hi Bruno,
That's brilliant thanks for letting us know and yes I will certainly add this feature for you. What version of Flowcode are you currently using, just so I add the feature into the correct version.
Not sure what has gone wrong with your attempt, I'll investigate what might be the cause.
That's brilliant thanks for letting us know and yes I will certainly add this feature for you. What version of Flowcode are you currently using, just so I add the feature into the correct version.
Not sure what has gone wrong with your attempt, I'll investigate what might be the cause.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: IR sensor exponential response
Right I've made the changes you suggested and hopefully this will now do as you want. The default is the standard linear mode but if you change the property to exponential then it should allow you to enter A and B values. I've also added the initial calculations you mentioned but not made these configurable. Let me know how you get on and if it's working nicely I'll roll out the change to v8 too.
You might want to backup your component file first just in case I've happened to break anything It can happen especially in a component like this where it builds on a lot of other components.
You might want to backup your component file first just in case I've happened to break anything It can happen especially in a component like this where it builds on a lot of other components.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: IR sensor exponential response
sorry but the component no longer appears in the components bar, nor in the search bar.
I unlocked the file, put it in the "components" directory and restarted Flowcode ...
I unlocked the file, put it in the "components" directory and restarted Flowcode ...
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: IR sensor exponential response
Hello,
Hmm. It seems to be working well for me here. I'll do some checking.
Can you say what you mean by:
Hmm. It seems to be working well for me here. I'll do some checking.
Can you say what you mean by:
Do you mean downloaded?I unlocked the file
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: IR sensor exponential response
maybe "unlock"...
- Attachments
-
- Screen Shot 01-20-20 at 02.22 PM 001.PNG
- (19.86 KiB) Downloaded 3522 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: IR sensor exponential response
Aha ok thanks.
I tried your program again and the FA component appears as a white square but it does have the new property.
Adding the component again from the menu allows it to work. Hmm odd.
Can you create a new program and does it appear then?
I tried your program again and the FA component appears as a white square but it does have the new property.
Adding the component again from the menu allows it to work. Hmm odd.
Can you create a new program and does it appear then?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: IR sensor exponential response
Ok, FA component appears as a white square with my file but i can't add the formula allcode API component
- Attachments
-
- Screen Shot 01-20-20 at 02.29 PM.PNG
- (8.6 KiB) Downloaded 3518 times
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: IR sensor exponential response
My version of flowcode is 7.3.0.7 and I am using the update of the formula flowcode API component obtained here:
viewtopic.php?f=41&t=21574
viewtopic.php?f=41&t=21574
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: IR sensor exponential response
Hmm,
I only edited the standard component, didn't have to touch the API version of the component?
Here's the API version atm.
I only edited the standard component, didn't have to touch the API version of the component?
Here's the API version atm.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: IR sensor exponential response
great!
I still have two questions
Does the "IR simulation mode" parameter also work with line following sensors or only with distance sensors?
What documents, video or tutorial help you understand how to modify a component such as the "Formula AllCode API" knowing that this component can be linked to a "Formula AllCode RB4420" or to a "Bluetooth port" and that To do this, you must be able to configure the "API Target Method" parameter?
thank you so much
I still have two questions
Does the "IR simulation mode" parameter also work with line following sensors or only with distance sensors?
What documents, video or tutorial help you understand how to modify a component such as the "Formula AllCode API" knowing that this component can be linked to a "Formula AllCode RB4420" or to a "Bluetooth port" and that To do this, you must be able to configure the "API Target Method" parameter?
thank you so much
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: IR sensor exponential response
Hello,
This is the current WIKI
https://www.matrixtsl.com/wiki/index.ph ... Components
And here is the v7 version,
https://www.matrixtsl.com/wikiv7/index. ... Components
For each property, macro and parameter in a component we try and write a helpful and meaningful tooltip which is then automatically added to the wiki page. Again there is always room for improvement here as things that may be obvious to us are not always the same for our users. It's largely only obvious to us because we have created the functionality.
Some of these v8 pages may be useful for you in terms of making and customising components.
https://www.matrixtsl.com/wiki/index.ph ... t_Creation
For now I have only edited the simulation IR distance sensors and not touched the IR line sensor values.Does the "IR simulation mode" parameter also work with line following sensors or only with distance sensors?
The main source of information is our user Wiki, it's not 100% and there are likely holes but we do try and improve it all the time.What documents, video or tutorial help you understand how to modify a component such as the "Formula AllCode API" knowing that this component can be linked to a "Formula AllCode RB4420" or to a "Bluetooth port" and that To do this, you must be able to configure the "API Target Method" parameter?
This is the current WIKI
https://www.matrixtsl.com/wiki/index.ph ... Components
And here is the v7 version,
https://www.matrixtsl.com/wikiv7/index. ... Components
For each property, macro and parameter in a component we try and write a helpful and meaningful tooltip which is then automatically added to the wiki page. Again there is always room for improvement here as things that may be obvious to us are not always the same for our users. It's largely only obvious to us because we have created the functionality.
Some of these v8 pages may be useful for you in terms of making and customising components.
https://www.matrixtsl.com/wiki/index.ph ... t_Creation
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: IR sensor exponential response
Hello, back for a second modeling of IR sensors.
First of all, a small modification concerning the exponential type equation: the equation which is best suited for a distance range from 15mm to 170mm is rather N = 2991 * exp (-0.04 * d) with d in mm. The coefficient of determination R² is 0.957.
(I had given you an equation with d in cm the last time, the equation should have been R = 4890 * exp (-0.057 * distance)) and not R = 4890 * exp (-0.57 * distance))
I have just used a second type of trend curve which corresponds even better: N = 806462 * d ^ (- 2.05). In this case, R2 = 0.991.
Will you be able to:
- correct the previous model for flowcodeV7: modification from cm to mm and default value of A and B: (N = A.exp (B.d)).
- Include a new IR simulation mode (POWER) with two parameters A and B: (A.d ^ B).
The Allcode simulation will be more accurate on a 3D route and will correspond much better on a real parourd. The choice of equations will allow us to adapt to all situations of range measurement.
I hope I didn't make a mistake this time!
Thank you so much.
Bruno
First of all, a small modification concerning the exponential type equation: the equation which is best suited for a distance range from 15mm to 170mm is rather N = 2991 * exp (-0.04 * d) with d in mm. The coefficient of determination R² is 0.957.
(I had given you an equation with d in cm the last time, the equation should have been R = 4890 * exp (-0.057 * distance)) and not R = 4890 * exp (-0.57 * distance))
I have just used a second type of trend curve which corresponds even better: N = 806462 * d ^ (- 2.05). In this case, R2 = 0.991.
Will you be able to:
- correct the previous model for flowcodeV7: modification from cm to mm and default value of A and B: (N = A.exp (B.d)).
- Include a new IR simulation mode (POWER) with two parameters A and B: (A.d ^ B).
The Allcode simulation will be more accurate on a 3D route and will correspond much better on a real parourd. The choice of equations will allow us to adapt to all situations of range measurement.
I hope I didn't make a mistake this time!
Thank you so much.
Bruno
- Attachments
-
- chart1.png
- (8.41 KiB) Downloaded 3088 times
-
- chart2.png
- (8.38 KiB) Downloaded 3088 times
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: IR sensor exponential response
Hello,
I am now using Flowcode V9 and I have just noticed that there is no possibility to choose the IR sensor simulation mode. The simulation on flowcode V7 gave excellent results to within 1mm. The measurements in real life also gave a rangefinder with an accuracy of 1mm over a distance of 15cm...
Can you put this option back on Flowcode V9 so that I can resume this work with my students?
Thanks in advance.
Bruno
I am now using Flowcode V9 and I have just noticed that there is no possibility to choose the IR sensor simulation mode. The simulation on flowcode V7 gave excellent results to within 1mm. The measurements in real life also gave a rangefinder with an accuracy of 1mm over a distance of 15cm...
Can you put this option back on Flowcode V9 so that I can resume this work with my students?
Thanks in advance.
Bruno
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: IR sensor exponential response
Hello Bruno,
Many thanks for letting us know. It must have been missed in the v8 and v9 updates. I've now added it back into the v9 component for you. You can get the latest version of the component by clicking Help -> Library Updates.
Many thanks for letting us know. It must have been missed in the v8 and v9 updates. I've now added it back into the v9 component for you. You can get the latest version of the component by clicking Help -> Library Updates.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 78
- Joined: Mon Sep 26, 2011 4:18 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: IR sensor exponential response
Thank you very much Benj.
I love this Formula allcode and your responsiveness with Flowcode V9
Best regards
Bruno
I love this Formula allcode and your responsiveness with Flowcode V9
Best regards
Bruno