|
Page 1 of 1
|
[ 10 posts ] |
|
CMUcam Sample Code in RobotC 1.52
| Author |
Message |
|
lyncas
Rookie
Joined: Tue Mar 10, 2009 2:43 pm Posts: 21 Location: Houston, TX
|
 CMUcam Sample Code in RobotC 1.52
I open up the sample program without any modifications , And i get the following compliation errors. I am doing something wrong ?
|
| Fri Jun 26, 2009 4:24 pm |
|
 |
|
MarkO
Rookie
Joined: Fri Jun 12, 2009 6:38 pm Posts: 25 Location: Albany, Oregon, USA, North Western Hemisphere, Planet Tera
|
 Re: CMUcam Sample Code in ROBOTC 1.52
I get the same thing... It apears to be all related to the missing Structure "TTrackingDataInts myData;". I am looking into it...
|
| Sat Jun 27, 2009 7:45 pm |
|
 |
|
MarkO
Rookie
Joined: Fri Jun 12, 2009 6:38 pm Posts: 25 Location: Albany, Oregon, USA, North Western Hemisphere, Planet Tera
|
 Re: CMUcam Sample Code in ROBOTC 1.52
OK, so somebody needs to Recompile the "RobotCIFI.exe" or wherever the Pre-Compiled Header Files are located, so that this will Compile.. Also, the RobotC Header Files ALL need to be Re-Written for "Conditional Inclusion" (See K_n_R, s4.11.3), with the format: The Errors as presented by lyncas, seem to revolve around the Structure "TTrackingDataInts" and its Declaration "myData". Of course, there are other Errors, once these are "cleaned up". So, the Source Code, "CMUCAM_Simple_Test.c" #includes"cameraConfiguration.h". "cameraConfiguration.h" #includes"TCamera.h". "TCamera.h" #includes"cameraIntrinsics.h", IF there is a DEFINE for "ROBOTC", Which seems reasonable. "cameraIntrinsics.h" #includes"TCameraResults.h", IF there is a DEFINE for "hasCamera", which there is not, but adding the DEFINE to the Source Code "CMUCAM_Simple_Test.c" causes other Errors to appear.. Adding the DEFINE "hasCamera": Now shows these Errors: These "Undefined variable(s)" are defined in "cameraIntrinsics.h", which ARE REQUIRED to create the Definitions for "intrinsic functions", "StartCamera()", "StopCamera()", "ResetCameraConfigurationToDefault()", "SetCameraConfig(...)", "GetCameraConfig(...)", "GetTrackingParms(...)", "bool variableIndex(...)". "cameraIntrinsics.h" also contains the Definition for the "intrinsic function" "TTrackingDataInts". The "Undefined variable(s)", 'sysFuncCameraFunctions', 'sysFuncSetCameraConfig', 'sysFuncGetCameraConfig', 'sysFuncGetTrackingParms', 'kExternCMUCAMTracking', 'kSystemStreamCameraIOToPC' apperar to be RobotC, Opperation Codes (Op Codes), defined in the file "OpcodeDefinitions.h", in the Enumeration (enum), "TSystemFunctions", Enum "TSystemExternParms", and Enum "TSystemParmTypes". These are ALL setup with "Conditional Inclusion", on the DEFINE "hasCamera". When including file "OpcodeDefinitions.h" in file "cameraIntrinsics.h" as shown below: Gives an entirely new set of Error Messages: Creating a new Header File, with just the Enumerations, "TSystemFunctions", "TSystemExternParms", and "TSystemParmTypes", causes a Error of Re-Definition of Enum "TSystemFunctions", "TSystemExternParms", and "TSystemParmTypes". This leading me to believe that the "precompiled header" has been compiler with an older Version of "OpcodeDefinitions.h", or more likely, the "Conditional Inclusion" for "hasCamera" was not DEFINED, thus giving an incomplete "precompiled header", and the failure of the Definition of Structure "TTrackingDataInts". There might be other optional DEFINES as Well, that need to be DEFINED for the creation of the "precompiled headers".
|
| Sun Jun 28, 2009 3:50 am |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2865 Location: Rotterdam, The Netherlands
|
 Re: CMUcam Sample Code in ROBOTC 1.52
Won't stop the compiler from barfing when you include a file twice, though. That is quite broken. I use this: with the appropriate defines in common.h, of course. Regards, Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Sun Jun 28, 2009 4:16 am |
|
 |
|
MarkO
Rookie
Joined: Fri Jun 12, 2009 6:38 pm Posts: 25 Location: Albany, Oregon, USA, North Western Hemisphere, Planet Tera
|
 Re: CMUcam Sample Code in ROBOTC 1.52
Yes, that is what "Conditional Inclusion" is all about.... The 3rd Paragraph of K_n_R, s4.11.3 explicitly describes the usage of "#defines" for this purpose. But even that does not help in this case, because the Enumerations of, "TSystemFunctions", "TSystemExternParms", and "TSystemParmTypes" in the Pre-Compiled Headers, don't have the "named constants" (See K_n_R, sa.8.4), that are in the "OpcodeDefinitions.h" header file. This is kind of a Catch-22. The program won't compile, because the Pre-Compiled Headers have the Enumerations of, "TSystemFunctions", "TSystemExternParms", and "TSystemParmTypes", but don't have the "named constants" 'sysFuncCameraFunctions', 'sysFuncSetCameraConfig', 'sysFuncGetCameraConfig', 'sysFuncGetTrackingParms', 'kExternCMUCAMTracking', 'kSystemStreamCameraIOToPC'. The Header File "OpcodeDefinitions.h" has the same Enumerations of, "TSystemFunctions", "TSystemExternParms", and "TSystemParmTypes", but do have the "named constants" 'sysFuncCameraFunctions', 'sysFuncSetCameraConfig', 'sysFuncGetCameraConfig', 'sysFuncGetTrackingParms', 'kExternCMUCAMTracking', 'kSystemStreamCameraIOToPC'. Since the Enumerations of, "TSystemFunctions", "TSystemExternParms", and "TSystemParmTypes" are different, the compiler will only accept the first Definition, which lacks the correct "named constants" to compile the Program. So we are "stuck", until the Pre-Compiled Headers are re-built, or the Compiler is told to forget about using the Pre-Compiled Headers, and "compile it the Old Way"! ( I guess that would be Old-School.)
|
| Sun Jun 28, 2009 5:38 am |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2865 Location: Rotterdam, The Netherlands
|
 Re: CMUcam Sample Code in ROBOTC 1.52
MarkO, I think you need to forget about what K'nR tell you is "The Right Way" when it comes to RobotC. RobotC is not ANSI compliant, nor does it claim to be. That means that some of the nice features and rules that the original founding fathers of C came up with don't apply here. It can be frustrating at times for experienced C programmers. I've banged my head on stuff like this a few times, trust me  Is there no work-around for your problem until it is fixed in a new build? Regards, Xander PS: I don't think you had nearly enough hyper links in your last post. C'mon, you can do better than that! Next post try to make at least every 3rd word hyper linked.
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Sun Jun 28, 2009 5:55 am |
|
 |
|
MarkO
Rookie
Joined: Fri Jun 12, 2009 6:38 pm Posts: 25 Location: Albany, Oregon, USA, North Western Hemisphere, Planet Tera
|
 Re: CMUcam Sample Code in ROBOTC 1.52
Kn'R is not the Right Way, it is just a way. You can follow the way or not. The more ways you must follow, the more variations you must remember, the harder it becomes to be proficient at all of the ways. It does not matter if RobotC follows the Kn'R way, or their own way. I can learn whatever.. So... In the matter "Conditional Inclusion", RobotC seems to support it (in the K_n_R way), because Include Files like "TCamera.h" and "cameraIntrinsics.h" implement it, but files like "cameraConfiguration.h" don't. In the mater of Pre-Compiled Headers, that is from the RobotC Compiler itself, "**FATAL**:Include file 'OpcodeDefinitions.h' has already been opened in precompiled header". In the matter of the definition of "named constants" for the Items within an Enum, I guess you can pick whatever "term" you want to call it, but then you will need to Describe it before usage, so that those following the conversation will be able to understand what ideas you are conveying. I am sure there is a work around... "Re-Build the Pre-Compiled Headers with the correct #include Files" or "Tell the Compiler to not use the Pre-Compiled Headers", unfortunately the RobotC documentation is very limited on Compiler Options for either of the above. It might be possible to Hard-Code the Values from the #include Files, but if the Compiler itself was built with a different version, you will get unpredictable results.  Every good researcher lists their references. Also, it is Polite to Introduce or Reference Terminology before using it in conversation. If you find the Hyper-Links "superfluous", you may skip them, others may want to use them to learn where the Information was obtained from or what that Colloquialism means. I am conversing with you, "mightor", but writing for everyone. "The problem with communication... Is the illusion that it has been accomplished." - G. Bernard Shaw
|
| Sun Jun 28, 2009 7:37 am |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2865 Location: Rotterdam, The Netherlands
|
 Re: CMUcam Sample Code in ROBOTC 1.52
I liked the fact that you hyper link so much. It shows you care enough that people understand what you're trying to say by clarifying the terms you're using. I try to do the same whenever I write an article for my blog. I did not think it was superfluous in any way, it just brought a smile to my face  As for documentation, I think you hit the nail on the head. There is a profound lack of documentation for the internals (and public interface) for RobotC. The stuff we do know has been gathered bit by bit but never really collated anywhere. Regards, Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Sun Jun 28, 2009 8:21 am |
|
 |
|
MarkO
Rookie
Joined: Fri Jun 12, 2009 6:38 pm Posts: 25 Location: Albany, Oregon, USA, North Western Hemisphere, Planet Tera
|
 Re: CMUcam Sample Code in ROBOTC 1.52
OK, I don't have the CMUCAM to work with, I have a Zip File with two modified files for you to try. I got this to compile, but I have no idea if it will download and work, or what. I recommend you backup your "Includes" and "sample programs\VEX" Subdirectories, but I did included the Unmodified versions of the files, the extensions renamed ".org", for Original. The file "CMUCAM_Simple_Test.c" has one line added, "#define hasCamera". The file "cameraIntrinsics.h" has the "named constants" from the Enumeration "TSystemFunctions" from the file "OpcodeDefinitions.h", HardCoded into it. They are: Remember, YMMV..... (File Attachment is not currently working, use this backup Link, ROBOTC for IFI.zip.)
|
| Tue Jun 30, 2009 12:41 am |
|
 |
|
lyncas
Rookie
Joined: Tue Mar 10, 2009 2:43 pm Posts: 21 Location: Houston, TX
|
 Re: CMUcam Sample Code in ROBOTC 1.52
Thanks for the help, I will try to test out this code soon.
I'm more interested in getting access to the serial port than testing CMUcam but this code will definitely be useful.
|
| Tue Jun 30, 2009 1:05 am |
|
|
|
Page 1 of 1
|
[ 10 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
|
|