[WiiC] Wiic returns invalid IR coordinates! (under ubuntu10.10 with wiic1.1)
Brought to you by:
gabriele82rm
From: Christian M. <chr...@sm...> - 2011-04-18 13:00:19
|
Hello everybody! First time here! I am working with wiic library. First: Thanks a lot for providing it. It works fine with the connection of multiple wii remotes and the tracking of Ir sources. However I have some little problem which I couldn't solve yet. For any help or suggestions I would be very happy. The setup looks like that: I need to track four IR lights which are mounted on a robot. The wii remote is positioned about 1m from the robot. But the wii remote is able to see all four lights on the robot. I am able to track them easily with cwii library. This is the code from an example which I found on the website. I also use it for getting the coordinates of the IR sources: std::vector<CIRDot>::iterator i; int x, y; std::vector<CIRDot>& dots = wm.IR.GetDots(); std::vector<CPoint2d> irLights; sprintf(prefixString, "Controller [%i]: ", wm.GetID()); printf("%s Num IR Dots: %i\n", prefixString, wm.IR.GetNumDots()); for (i = dots.begin(); i != dots.end(); ++i) { if ((*i).isVisible()) { (*i).GetCoordinate(x, y); printf("Fill Coords "); CPoint2d irLights; irLights.x = x; irLights.y = y; wiiRemoteListener.setIrLight(irLights); printf("%s IR source: (%i, %i)\n", prefixString, x, y); } } So if there are four IR sources I can the output like that.... Controller [1]: Num IR Dots: 4 Fill Coords Controller [1]: IR source: (343, 219) Fill Coords Controller [1]: IR source: (203, 123) Fill Coords Controller [1]: IR source: (475, 192) Fill Coords Controller [1]: IR source: (285, 792) ...everything is fine! NOW the error comes: If I remove one IR source... Controller [1]: Num IR Dots: 3 Fill Coords Controller [1]: IR source: (233, 239) Fill Coords Controller [1]: IR source: (483, 113) ..so the number of dots = 3 is correct but just coordinates of 2 sources are there! So just 2 times the if statment ( if ((*i).isVisible()) ) is entered. I checked out that the isVisible() method does not return true. So if I remove the if statement then I get the output like... Controller [1]: Num IR Dots: 3 Fill Coords Controller [1]: IR source: (343, 219) Fill Coords Controller [1]: IR source: (0, 1023) Fill Coords Controller [1]: IR source: (475, 192) ... there you can see that the number of dots is 3 and that is correct! and even 3 coordinates are available, but one is not correct -> (0, 1023). I tried it several time. The result is always the same. I output the data directly after the library function call. So I suppose that something is going wrong there. Maybe some vector is not correctly initialized? I tried to search for it, but with out success. Does anybody has observed the same behavior? For suggestion to find out what might be the cause for that I would be very thankful!!! Thanks in advanced! Christian |