| Author |
Message |
|
gemoomaw
Rookie
Joined: Tue Nov 22, 2011 7:57 am Posts: 8
|
 Need to evaluate the input from 3 sensors
I am using 3 sonar sensors to determine position in amaze. I am new to robotc but have experience in basic and foxpro
I have not found a way to use If (value1) and (value2) and (value3) then result = x
I could use x in a switch that calls motor routines.
|
| Wed Nov 23, 2011 8:44 am |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Need to evaluate the input from 3 sensors
If I understand you correctly, then you need something like this: does this help?
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Wed Nov 23, 2011 10:00 am |
|
 |
|
gemoomaw
Rookie
Joined: Tue Nov 22, 2011 7:57 am Posts: 8
|
 Re: Need to evaluate the input from 3 sensors
Thanks
Specificly here are the conditions I want to evaluate to navigate the maze
// Forward Front Sensor > 13, left sensor > 7 right sensor > 7cm .. Centered in hallway no end in sight // AdjustLeft Turn FrontSensor >13, left Sensor >7 Right Sensor < 7cm .. getting close to right wall // AdjustRight Turn FrontSensor >13 left Sensor < 7 Right Sensor > 7cm...
// HardLeft Turn FrontSensor < 13 left Sensor > 10 Right Sensor < 26cm Near end, left open // HardRight Turn FrontSensor < 13 left Sensor < 10 Right Sensor > 26cm
Does the" &&" above equal the "and" in my post where all conditions need to be present to = true. Where can I find concantation statements. In Foxpro it is 1>2 .and. 2>3 = true
|
| Wed Nov 23, 2011 2:35 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Need to evaluate the input from 3 sensors
I believe this will help you.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Wed Nov 23, 2011 3:40 pm |
|
 |
|
gemoomaw
Rookie
Joined: Tue Nov 22, 2011 7:57 am Posts: 8
|
 Re: Need to evaluate the input from 3 sensors
That article is exactly what I needed. Is it part of a larger document that I could obtain? My next need is to learn how to call subroutines with parameters.
|
| Wed Nov 23, 2011 6:21 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Need to evaluate the input from 3 sensors
Yes, it is part of the "Introduction to ROBOTC" by the Carnagie Mellon Robotics Academy. It's available here. But before you can view it, you will have to make a account with them. http://www.robotc.net/teachingmindstorms/reference/hp_functions.pdf
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Wed Nov 23, 2011 7:31 pm |
|
 |
|
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 495
|
 Re: Need to evaluate the input from 3 sensors
Subroutines in ROBOTC are used in exactly the same way as in ANSI C (except that you cannot have any recursion). A quick google search on "functions in C" will help you out. However, I will display some of the basics here. That is a simple subroutine with one integer parameter. If you want to add more parameters, just separate them with a comma. To have a subroutine that returns something: You will need to place these functions above the main task, or place function prototypes above the main task and the actual functions afterwards.
_________________ sudo rm -rf /
|
| Wed Nov 23, 2011 7:34 pm |
|
 |
|
gemoomaw
Rookie
Joined: Tue Nov 22, 2011 7:57 am Posts: 8
|
 Re: Need to evaluate the input from 3 sensors
Wow this is great. Now I need to put this to work
Thanks a lot
I may be back
|
| Wed Nov 23, 2011 10:00 pm |
|
 |
|
gemoomaw
Rookie
Joined: Tue Nov 22, 2011 7:57 am Posts: 8
|
 Re: Need to evaluate the input from 3 sensors
I may be blind but I have failed to find the full document("Introduction to ROBOTC") you reference on cs2n. Could you send me a link?
There are many valuable resources here. I have a student who will greatly profit from the beginning lessons in RobotC
Thanks for your help
|
| Thu Nov 24, 2011 8:02 am |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Need to evaluate the input from 3 sensors
I did. In my previous post, the word "here" is a link. Click on it, and it will bring you to that page. Try signing in on another tab, and then going to it.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Thu Nov 24, 2011 9:54 am |
|
 |
|
gemoomaw
Rookie
Joined: Tue Nov 22, 2011 7:57 am Posts: 8
|
 Re: Need to evaluate the input from 3 sensors
Found the resource files.
Getting closer
Now I need sound files for testing my sonar sensors but cannot find the files so that I can know what I can call. I find the ones for Lego Mindstorms in the Lego directory but none with the RobotC directory. Where should the Robotc files reside? If they are missing I could copy the Lego files to that directory.
There is a "woops.rso" in one of the sample programs and it works. I have searched for that file and for *.rso but get no results
!!! Found that I can copy sound files from the Lego..engine/sounds to Robomatterinc/RobotC../systemfiles
|
| Thu Nov 24, 2011 9:01 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Need to evaluate the input from 3 sensors
Good for you!!(and for me  ) That's exactly what I was about to suggest.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Thu Nov 24, 2011 11:18 pm |
|
|