"Unexpected line" exception when using component load rules for RTC Jazz build engine - build

I have a component named MyComponent with the following folder structure in RTC:
/MyProject
/MyProject/TestFile.txt
/MyProject/Folder1
/MyProject/Folder1/loadrules.txt
/MyProject/Folder1/TestFile2.txt
And this is what I have in my loadrules.txt file::
versionableName=/MyProject/TestFile.txt
I've specified the loadrules.txt file in my build definition for this component as the component load rule, but when the build runs, I'm getting the following exception when it tries to fetch the files:
com.ibm.team.repository.common.TeamRepositoryException: Unexpected line "versionableName=/MyProject/TestFile.txt" encountered in build load rules for component "MyComponent"
at com.ibm.team.filesystem.client.internal.load.LoadRule.getRules(LoadRule.java:176)
at com.ibm.team.filesystem.client.internal.load.LoadRule.addLoadRules(LoadRule.java:101)
at com.ibm.team.build.internal.scm.ComponentLoadRules.getLoadRules(ComponentLoadRules.java:134)
at com.ibm.team.build.internal.engine.JazzScmPreBuildParticipant.preBuild(JazzScmPreBuildParticipant.java:235)
at com.ibm.team.build.internal.engine.BuildLoop.invokePreBuildParticipants(BuildLoop.java:844)
at com.ibm.team.build.internal.engine.BuildLoop$2.run(BuildLoop.java:650)
at java.lang.Thread.run(Thread.java:662)
Any idea what I'm doing wrong? I've tried following the example here but I can't figure why it's not working for me. Regardless of what I put in the loadrules.txt file (nothing/empty string, random garbage text, etc.), I still get this exception for the first line of the file.
This is in RTC 3.0

This kind of error is likely to be an encoding issue.
One way to test that is to create the loadrules.txt through the scm command-line interface, as detailed in "Reference > Source control command line reference > scm > create"
scm create loadrules [options]
The OP holic87 confirms:
I just used Notepad++ to recreate the text file and it's working as expected now.

Related

(ROS) Failed to create global planner

My setup is: ROS melodic, Ubuntu: 18.04
I want simulate turtlebot3 moving with my own global planner and have been following this tutorial to get started: http://wiki.ros.org/navigation/Tutorials/Writing%20A%20Global%20Path%20Planner%20As%20Plugin%20in%20ROS#Running_the_Plugin_on_the_Turtlebot. The tutorial seem to be made for ROS hydro, but as it was the best source of guidance I could find I hoped it would work.
The error I'm having is:
Failed to create the global_planner/GlobalPlanner planner, are you sure it is properly registered and that the containing library is built? Exception: MultiLibraryClassLoader: Could not create object of class type global_planner::GlobalPlanner as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary()
To my knowledge I've followed the tutorial as much as possible with a only a few things done differently because I wanted to test it, couldn't do as the tutorial asked, or because I thought it wouldn't impact the results. What I have done differently is:
I use the carrot_planner.h and carrot_planner.cpp files in the tutorial section 1 to test that it works before trying with my own code to avoid confusion about where possible errors come from. It's not 'different' from the tutorial to my knowledge, but figured I'd mention it. They are placed in catkin_ws/src/carrot_planner/src/global_planner/
The ros package I'm working from is in catkin_ws/src and is called the carrot_planner. In the tutorial step 1.3 I use add_library(global_planner_lib src/global_planner/carrot_planner.cpp). Would not imagine it affects the results either.
In section 3 of the tutorial it mentions that 'First, you need to copy the package that contains your global planner (in our case global_planner) into the catkin workspace of your Turtlebot (e.g. catkin_ws).' Since my package was already in catkin_ws/src/ I haven't moved it since I guess I didn't need to.
I've altered the 'move_base.launch' file in '/opt/ros/melodic/share/turtlebot3_navigation/launch/' instead of the 'move_base.launch.xml' in '/opt/ros/hydro/share/turtlebot_navigation/launch/includes/' as there doesn't seem to be a destination '...turtlebot3_navigation/launch/includes/'. There are files in launch, but no includes folder. Maybe that a difference from Hydro to Melodic, I don't know. There may be a whole lot of things that need to be done differently from the tutorial when using Melodic, or with turtlebot3, but I don't know.
I haven't made my own launch file for bringup of the turtlebot, but have instead followed this tutorial (https://emanual.robotis.com/docs/en/platform/turtlebot3/nav_simulation/) to guide me with turtlebot3. After finishing this step in the global planner tutorial 'Save and close the move_base.launch.xml. Note that the name of the planner is global_planner/GlobalPlanner the same specified in global_planner_plugin.xml. Now, you are ready to use your new planner' I tested whether it worked by running: 'roslaunch turtlebot3_gazebo turtlebot3_world.launch' and then I tried running: 'roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml' which led to the error I showed above. I have created the map-yaml, so there's no misunderstanding whether that's missing.
I would be very glad for any help, thank you ^^
Edit: My system only had 'navfn' on it, not 'global_planner' or 'carrot_planner', if that makes a difference.
After looking over the code I found a solution. It doesn't make everything work perfectly yet, but seems to solve the immediate problem.
The problem was that in my 'global_planner_plugin.xml' I just used the code provided in the tutorial:
<library path="lib/libglobal_planner_lib">
<class name="global_planner/GlobalPlanner" type="global_planner::GlobalPlanner" base_class_type="nav_core::BaseGlobalPlanner">
<description>This is a global planner plugin by iroboapp project.</description>
</class>
</library>
But in the carrot_planner.cpp file it says:
PLUGINLIB_EXPORT_CLASS(carrot_planner::CarrotPlanner, nav_core::BaseGlobalPlanner)
Changing type="global_planner::GlobalPlanner to type="carrot_planner::CarrotPlanner and then launching turtlebot3 doesn't give the same error anymore.

How to load PNG file into my custom component? Cannot get correct instance

I want to create a custom control (from TPanel) that holds some TImages.
I want to display PNG (with transparency) into those mages. Therefore, I am TRYING to attach the PNG via IDE's "Resource and Images" to the package.
The problem is that when I put the component into a test application it will fail on MyPng->LoadFromResourceName line with "resource not found". Interestingly, if I add the PNG as a resource to the test application, it will work.
This means that the component is looking into the wrong module for the PNG resource.
I print the instance with ShowMessage it shows indeed "ComponentTester.exe".
__fastcall TVolumeCtrl::TVolumeCtrl(TComponent* Owner)
: TPanel(Owner)
{
HINST h = FindClassHInstance(__classid(TVolumeCtrl));
ShowMessage(GetModuleName(h));
TPngImage *Png3 = new TPngImage();
MyPng->LoadFromResourceName(h, "Btn1");
How to get the correct instance?
Note: The PNG files ARE compiled into the RES file generated. I looked inside with a Hex viewer.
The only explanation that makes sense is that you are not using runtime packages. So you aren't loading the module that contains the resource.
The right way to link the resource for the component is to use a $R directive in the source file that declares the type, TVolumeCtrl in this case. That way the resource will be linked to whichever module contains the implementation of TVolumeCtrl. That's going to be a package when you are compiling the runtime package (which is used at designtime by your designtime package), and it will be the executable when you compile an executable that does not use runtime packages.

opencv\modules\core\src\persistence.cpp:2697: error: (-27) NULL or empty buffer in function cvOpenFileStorage

I am trying to run a facedetection application and I get the following error:
Unexpected Standard exception from MEX file.
What() is:..\..\..\..\opencv\modules\core\src\persistence.cpp:2697: error: (-27)
NULL or empty buffer in function cvOpenFileStorage
If you're using haarcascade_frontalface_default.xml, check the xml file content.
The first 3 lines should be:
<?xml version="1.0"?>
<!--
Stump-based 24x24 discrete(?) adaboost frontal face detector.
I inadvertently downloaded the html that linked to the haarcascade_frontalface_default.xml file instead of the xml itself and got the same error you did.
You should provide some code and information.Nevertheless the error indicates that it can not access the haarcascade file. I suggest you make sure you have the "xml" in the same folder as your code (e.g. "ViewController.mm") and check permissions. additionally Assuming you are using Objective-c or swift:
1-check the file is in your Xcode project; and, if it is,
2-check it's included in the 'Copy Bundle Resources' phase underneath your selected Target (in the project tree view on the left in the normal Xcode window layout) and, if it is,
3-look inside the generated application bundle (find your product, right click, select 'Reveal in Finder', from Finder right click on the app and select 'Show Package Contents', then look for your file in there) to make sure that it's there.
I've got the same problem, and then I figure out what's the problem
First
Add file haarcascade_frontalface_default.xml to xcode project
make sure when you add the xml file with option below:
Destination: Copy items if need [check]
Added Folder: Create Folder References [check]
Add to targets: Your Project target [check]
Second
in you Wrapper.mm file add this code to your obj-c function:
const NSString* cascadePath = [[NSBundle mainBundle]pathForResource:#"haarcascade_frontalface_default" ofType:#"xml"];
or in case you wanna load the xml file, use this code:
cv::CascadeClassifier classifier;
const NSString* cascadePath = [[NSBundle mainBundle]pathForResource:#"haarcascade_frontalface_default" ofType:#"xml"];
classifier.load([cascadePath UTF8String]);
this actually fixes my problem, anywaythis question has been questioned for a long time but I hope someone face this problem can come to this answer and help them solve their problem like mine, cheer.

RestKit entity mapping for UnitTests does not work

I'm trying to create my RKEntityMapping outside of my UnitTest. The problem I have is it only works if I create it inside my test. For example, this works:
RKEntityMapping *accountListMapping = [RKEntityMapping mappingForEntityForName:#"CustomerListResponse" inManagedObjectStore:_sut.managedObjectStore];
[accountListMapping addAttributeMappingsFromDictionary:#{#"count": #"pageCount",
#"page": #"currentPage",
#"pages": #"pages"}];
While the following does now work. The all to accoutListMapping returns exactly what is shown above using the same managed object store:
RKEntityMapping *accountListMapping = [_sut accountListMapping];
When the RKEntityMapping is created in _sut I get this error:
<unknown>:0: error: -[SBAccountTests testAccountListFetch] : 0x9e9cd10: failed with error:
Error Domain=org.restkit.RestKit.ErrorDomain Code=1007 "Cannot perform a mapping operation
with a nil destination object." UserInfo=0x8c64490 {NSLocalizedDescription=Cannot perform
a mapping operation with a nil destination object.}
I'm assuming the nil destination object it is referring to is destinationObject:nil.
RKMappingTest *maptest = [RKMappingTest testForMapping:accountListMapping
sourceObject:_parsedJSON
destinationObject:nil];
Make sure that the file you have created has a target membership of both your main target, and your test target. You can find this by:
clicking on the .m file of your class
open the utilities toolbar (the one on the right)
in the target membership section tick both targets.
This is because if your class does not have target membership to your test target, the test target actually creates a copy of the class that you have created, meaning it has a different binary file to the main target. This leads to that class using the test's version of the RestKit binary, rather than the main projects RestKit. This will lead to the isKindOfClass method failing when it tries to see if the mapping you have passed is of type RKObjectMapping from the main project, because it is of type RKObjectMapping from the test projects version of RestKit, so your mapping doesn't get used, and you get your crash.
At least this is my understanding of how the LLVM compiler works. I'm new to iOS dev so please feel free to correct if I got something wrong.
This problem may also be caused by duplicated class definitions, when including RestKit components for multiple targets individually when using Cocoapods.
For more information on this have a look at this answer.
I used a category on the Mapped object for example
RestKitMappings+SomeClass
+ (RKObjectMapping*)responsemappings {
return mappings;
}
now this category has to be included in the test target as well otherwise the mapping will not be passed.
When you're running a test you aren't using the entire mapping infrastructure, so RestKit isn't going to create a destination object for you. It's only going to test the mapping itself. So you need to provide all three pieces of information to the test method or it can't work.

Visual C++ - Throwing unhandled exception from setting forms icon?

I can compile the solution with no errors, but when I'll try to run it, I get a crash window:
An unhandled exception of type
'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "<myformname>.resources" was corerctly embedded or linked into assembly "<myprojectname>" at compile time, or that all the satellite assemblies required are loaded and fully signed.
And after I press Break it throws me to the line:
this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));
If I comment this line out, everything works just fine, but my program doesn't have icon.
Anyone else had this problem? Found a solution? I couldn't find anything clear enough for me to understand, problem is really annoying me, only solution I found was to declare my form class before any other classes, but I don't even have any other classes in my solution?
I also have only one project in this solution, ms support said something about having multiple projects, which I don't have, so it was no use either.
Take a look here :
http://www.mztools.com/articles/2005/MZ2005007.aspx
The exception is thrown because your icon cannot be located. You will probably need to compiles your resources under one .dll and put this under en-US subfolder on your project output. It did the trick for me at least. There are probably other solutions to your problem too.
Do not panic like I did. The root cause of the problem is that the compiled resource file is different from the one that is asked to load at runtime. This happens because the underlying build-script cannot detect the filename or namespace changes made after the form is created.
For example, At first we started a project named x . And our $(RootNamespace) becomes x. And we created a form named y. So our XML resource file y.resx gets compiled into x.y.resource . At this point the icon change works.
Now somehow we changed the project name or the namespace to z. But our $(RootNamespace) remains the x. While at compile-time it wrongly generates old x.y.resource, but at links-time it links z.y.resource. And at this point the icon change does not work.
It can also happen if the form is under some nested namespace which is not known in the project file.
It can be fixed by changing the compilation output of the y.resx file . It can be done by right-clicking the resource and changing the Resource Logical Name to $(RootNamespace).%(Filename).resources .
I will also make sure that ProjectName,AssemblyName and RootNamespace are the same in the .vcxproj file. Somehow if the form is declared under a nested namespace like RootNamespace.gui , then the output file of the resource should be $(RootNamespace).gui.%(Filename).resources .