From: Marques, H. G <hg...@es...> - 2006-03-27 17:16:11
|
Hi Radu... first of all thank's for the quick implementation of the interface... I = really needed it in order to continue my experiments... I tryed to run your code and it works perfectly... but if I try to use = an PlayerGraphics2dCmdPolyline object with the number of lines smaller = than 64 it simply does not show anything... I tryed to show a simple = line on Stage with only 2 points using the same idea you used in the = example and it did not work... Then I hacked slightly your code (see = bellow) in order to print only part of the circles and it did not worked = as well... I then tried to solve the issue with the class = PlayerGraphics2dCmdPolygon but I had the same problem. I tried to went = through the source code of playerclient and the graphics2DInterface and = it seemed fine to me...=20 Another thing that you might want to have a look in the class = PlayerGraphics2dCmdPolygon is that if you do not setFill_color it gives = an exception, when it could probably use a default (transparent?) = value... Thank you very much=20 Regards... Hugo ************************************* CODE ******************* PlayerClient robot; Graphics2DInterface graphicsInterface; robot =3D new PlayerClient ("localhost", 6665); graphicsInterface =3D robot.requestInterfaceGraphics2D(0, 1); robot.runThreaded(-1, -1); graphicsInterface.clearScreen (); PlayerGraphics2dCmdPolyline p =3D new PlayerGraphics2dCmdPolyline (); PlayerColor color =3D new PlayerColor (); color.setAlpha (0); color.setRed (0); color.setGreen (0); color.setBlue (0xff); int lineSize =3D 32; p.setCount (lineSize); for (double r =3D 0; r < 1.0; r +=3D 0.05) { PlayerPoint2d[] points =3D new PlayerPoint2d[lineSize]; =20 for (int j =3D 0; j < lineSize; j++) { points[j] =3D new PlayerPoint2d (); points[j].setPx ((float)(r * Math.cos (j * Math.PI / 32))); points[j].setPy ((float)(r * Math.sin (j * Math.PI / 32))); System.out.println(" Point: "+points[j].getPx()+", = "+points[j].getPy()); } p.setPoints (points); p.setColor (color); graphicsInterface.drawPolyline (p); try { Thread.sleep (100); } catch (Exception e) { e.printStackTrace(); } ************************************* END CODE ******************* ---------------------------------------------------- Hugo Gravato Marques, University of Essex, PhD Student PHONE: +44 (0)7854917241, England or +351 962482416, Portugal ADDRESS: University of Essex, Department of Computer Science, Wivenhoe Park, Colchester Essex, CO4 3SQ, UK WEB: http://privatewww.essex.ac.uk/~hgmarq/ =20 -----Original Message----- From: jav...@li... on behalf of Radu = Bogdan Rusu Sent: Sun 26/03/2006 23:20 To: jav...@li... Subject: Re: [Java-player-users] Graphics2D interface =20 Hi Hugo, Sorry I'm only delivering now, but I've been busy with other things=20 during the weekend. :( Hope it's not too late for your project. Anyway, I just committed the code to CVS, so it should be available for=20 you in the morning. Please ignore the WSNInterface for now, as I'm still = working on committing the new wsn interface and drivers to the Player=20 repository first. I haven't had time to test it properly, but here's a "quickie" :)... - Player/Stage 2.x from CVS - started with everything.cfg - and the following code compiled into Javaclient: PlayerClient robot =3D null; Graphics2DInterface g2di =3D null; robot =3D new PlayerClient ("localhost", 6665); g2di =3D robot.requestInterfaceGraphics2D (0,=20 PlayerConstants.PLAYER_OPEN_MODE); robot.runThreaded (-1, -1); g2di.clearScreen (); PlayerGraphics2dCmdPolyline p =3D new = PlayerGraphics2dCmdPolyline (); =20 PlayerColor color =3D new PlayerColor (); color.setAlpha (0); color.setRed (0); color.setGreen (0); color.setBlue (0xff); p.setCount (64); =20 for (double r =3D 0; r < 1.0; r +=3D 0.05) { PlayerPoint2d[] points =3D new PlayerPoint2d[64]; for (int j =3D 0; j < 64; j++) { points[j] =3D new PlayerPoint2d (); points[j].setPx ((float)(r * Math.cos (j * Math.PI / = 32))); points[j].setPy ((float)(r * Math.sin (j * Math.PI / = 32))); } p.setPoints (points); p.setColor (color); g2di.drawPolyline (p); try { Thread.sleep (100); } catch (Exception e) {=20 e.printStackTrace(); } } --- Please tell me if it works and if you encounter any errors. Cheers, Radu. Hugo Gravato Marques wrote: >Thank you Radu... I really appreciate it... > > > >On 23/3/06 8:42 pm, "Radu Bogdan Rusu" <ru...@cs...> wrote: > > =20 > >>Hi Hugo, >> >>I just returned from Linz/Austria, and will get some free time = tomorrow >>afternoon to do it. I will e-mail back tomorrow with more details and >>hopefully an implementation of it. >> >>Best, >>Radu. >> >>Hugo Gravato Marques wrote: >> >> =20 >> >>>Hi Radu... >>> >>>Do you have any idea on when can you implement the Graphics2D = interface? It >>>would come really handy if I could use it by the weekend... >>> >>>Thanks... >>>Hugo >>> >>> >>>On 14/3/06 3:42 pm, "Hugo Gravato Marques" <hg...@es...> = wrote: >>> >>>=20 >>> >>> =20 >>> >>>>Hi Radu >>>> >>>>Yes... Toby told me they are in the stage side. The interface as far = as I >>>>understand is just a visualization... If you could do it next week = that >>>>would be wonderful since I don't expect to have things ready until = then >>>>anyway... >>>> >>>>I added my email with Toby bellow... >>>> >>>>Thank you very much... >>>> >>>>Regards, >>>>Hugo >>>> >>>>I pasted bellow my email and his reply... >>>> >>>>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D EMAILS >>>> >>>>I dont think this would be particularly easy to do, however if you = want >>>>to you can create visualisation in stage using the graphics2d = interface. >>>>Have a look at the examples in the source and docs on the. i believe >>>>this will be the easiest method for achieving what you want. >>>> >>>>Toby >>>> >>>>Hugo Gravato Marques wrote: >>>> >>>> =20 >>>> >>>> =20 >>>> >>>>>Hello... >>>>> >>>>>I was wondering if I could set the values in the laser sensor in a = way that >>>>>I could visualize in stage the values of a given laser array I = define? If >>>>>not how difficult would be to make something like that? >>>>> >>>>>Thanks... >>>>>Hugo >>>>> >>>>> >>>>> =20 >>>>> >>>>> =20 >>>>> >>>>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D END OF EMAILS >>>> >>>>On 14/3/06 8:32 am, "Radu Bogdan Rusu" <ru...@cs...> wrote: >>>> >>>> =20 >>>> >>>> =20 >>>> >>>>>Hi Hugo, >>>>> >>>>>Unfortunately, I have no time this week (or I might during the = weekend, >>>>>but I will be away in .nl). >>>>> >>>>>Last time I checked there was no data structures defined in player = for >>>>>graphics2d. Are they all on Stage's side? >>>>> >>>>>Radu. >>>>> >>>>>Hugo Gravato Marques wrote: >>>>> >>>>> =20 >>>>> >>>>> =20 >>>>> >>>>>>Hello... >>>>>> >>>>>>I was wondering when do you think you will add the Graphics2D = interface to >>>>>>the javaclient2? >>>>>> >>>>>>Cheers, >>>>>>Hugo >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>------------------------------------------------------- >>>>>>This SF.Net email is sponsored by xPML, a groundbreaking scripting >>>>>>language >>>>>>that extends applications into web and mobile media. Attend the = live >>>>>>webcast >>>>>>and join the prime developer group breaking into this new coding >>>>>>territory! >>>>>>http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720= &dat=3D121642 >>>>>>_______________________________________________ >>>>>>Java-player-users mailing list >>>>>>Jav...@li... >>>>>>https://lists.sourceforge.net/lists/listinfo/java-player-users >>>>>> >>>>>> >>>>>> =20 >>>>>> >>>>>> =20 >>>>>> >>>>------------------------------------------------------- >>>>This SF.Net email is sponsored by xPML, a groundbreaking scripting = language >>>>that extends applications into web and mobile media. Attend the live = webcast >>>>and join the prime developer group breaking into this new coding = territory! >>>>http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&d= at=3D121642 >>>>_______________________________________________ >>>>Java-player-users mailing list >>>>Jav...@li... >>>>https://lists.sourceforge.net/lists/listinfo/java-player-users >>>> =20 >>>> >>>> =20 >>>> >>> >>> >>>------------------------------------------------------- >>>This SF.Net email is sponsored by xPML, a groundbreaking scripting = language >>>that extends applications into web and mobile media. Attend the live = webcast >>>and join the prime developer group breaking into this new coding = territory! >>>http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&da= t=3D121642 >>>_______________________________________________ >>>Java-player-users mailing list >>>Jav...@li... >>>https://lists.sourceforge.net/lists/listinfo/java-player-users >>>=20 >>> >>> =20 >>> > > > > >------------------------------------------------------- >This SF.Net email is sponsored by xPML, a groundbreaking scripting = language >that extends applications into web and mobile media. Attend the live = webcast >and join the prime developer group breaking into this new coding = territory! >http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=3D= 121642 >_______________________________________________ >Java-player-users mailing list >Jav...@li... >https://lists.sourceforge.net/lists/listinfo/java-player-users > =20 > --=20 | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |
From: Marques, H. G <hg...@es...> - 2006-03-28 14:37:54
|
Hi Radu... I downloaded the changes you made to the CVS but now I have a = javaclient2.xdr.OncRpcException (see bellow). I tried the new code in my = yesterday's example (lineSize =3D 32, if you remember) and I also made a = simpler example (see code bellow) but I keep having the exception. The = example you sent me in the weekend works fine, but that is because the = number of points you used is >=3D 64. I tried to see what was the = problem in the Graphics2DInterface but the manipulation of the bytes you = used for encoding the information is a bit confusing for me as I'm not = familiar with the neither the xdr encoding nor the format of the = messages exchanged with player/stage. =20 sorry about the insistence man... :( cheers, hugo ******************************************** BEGINNING OF CODE = ********************************* robot =3D new PlayerClient (host,port); graphicsInterface =3D robot.requestInterfaceGraphics2D(0, 1); robot.runThreaded(-1, -1); =20 graphicsInterface.clearScreen (); PlayerGraphics2dCmdPolyline p =3D new PlayerGraphics2dCmdPolyline (); PlayerColor color =3D new PlayerColor (); color.setAlpha (0); color.setRed (0); color.setGreen (0); color.setBlue (0xff); p.setCount (2); PlayerPoint2d[] points =3D new PlayerPoint2d[2]; points[0] =3D new PlayerPoint2d (); points[0].setPx (-1.0f); points[0].setPy (-1.0f); points[1] =3D new PlayerPoint2d (); points[1].setPx (1.0f); points[1].setPy (1.0f); p.setPoints (points); p.setColor (color); graphicsInterface.drawPolyline (p); try { Thread.sleep (100); } catch (Exception e) { e.printStackTrace(); } ******************************************** END CODE ***** BEGINNING OF = EXCEPTION ********************************* Exception in thread "main" javaclient2.PlayerException: [Graphics2D] : = Error while XDR-encoding draw command: javaclient2.xdr.OncRpcException: = ONC/RPC buffer overflow at = javaclient2.Graphics2DInterface.drawPolyline(Graphics2DInterface.java:181= ) at Agent.testGraphics(Agent.java:368) at Agent.initRobot(Agent.java:305) at Agent.initialize(Agent.java:136) at Agent.main(Agent.java:441) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at = sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :39) at = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) Caused by: javaclient2.xdr.OncRpcException: ONC/RPC buffer overflow at = javaclient2.xdr.XdrBufferEncodingStream.xdrEncodeInt(XdrBufferEncodingStr= eam.java:181) at = javaclient2.xdr.XdrEncodingStream.xdrEncodeFloat(XdrEncodingStream.java:3= 34) at = javaclient2.Graphics2DInterface.drawPolyline(Graphics2DInterface.java:156= ) ... 9 more ******************************************** END OF EXCEPTION = ********************************* ---------------------------------------------------- Hugo Gravato Marques, University of Essex, PhD Student PHONE: +44 (0)7854917241, England or +351 962482416, Portugal ADDRESS: University of Essex, Department of Computer Science, Wivenhoe Park, Colchester Essex, CO4 3SQ, UK WEB: http://privatewww.essex.ac.uk/~hgmarq/ =20 -----Original Message----- From: jav...@li... on behalf of Radu = Bogdan Rusu Sent: Mon 27/03/2006 23:12 To: jav...@li... Subject: Re: [Java-player-users] Graphics2D interface =20 Ok, since the fix seems to affect more than one file (Player-wise),=20 ignore changing your player distribution for now, and use the latest=20 Javaclient2 CVS version. I just commited the latest changes which should = work with the *current* Player version (CVS). Once Player 2.1 is out, I=20 will change it. Best, Radu. Radu Bogdan Rusu wrote: > Aham!!! Evrika! ;) > > We just found another Player bug. The fix for this one is trivial=20 > though. I envision Player in a few months being 99.99% bug free at=20 > this rate! :) > > Unfortunately I don't have commit rights to that part of the=20 > repository (libplayercore)... so I'll ask Brian to do it for us now. > > If you don't want to "cvs" Player... go into player.h yourself, search = > for the player_graphics2d_cmd_points_t,=20 > player_graphics2d_cmd_polyline_t and player_graphics2d_cmd_polygon_t=20 > structures, and modify the first member from "uint16_t count;" to=20 > "uint16_t points_count;". Then recompile Player, and that should be = it. > > There is one small fix for Javaclient2 as well... I am committing it=20 > now, and then waiting for Brian to patch Player, and probably test=20 > again in the morning. > > Cheers, > Radu. > > Marques, Hugo G wrote: > >> Hi Radu... >> >> first of all thank's for the quick implementation of the interface... = >> I really needed it in order to continue my experiments... >> >> I tryed to run your code and it works perfectly... but if I try to=20 >> use an PlayerGraphics2dCmdPolyline object with the number of lines=20 >> smaller than 64 it simply does not show anything... I tryed to show a = >> simple line on Stage with only 2 points using the same idea you used=20 >> in the example and it did not work... Then I hacked slightly your=20 >> code (see bellow) in order to print only part of the circles and it=20 >> did not worked as well... >> >> I then tried to solve the issue with the class=20 >> PlayerGraphics2dCmdPolygon but I had the same problem. I tried to=20 >> went through the source code of playerclient and the=20 >> graphics2DInterface and it seemed fine to me... >> Another thing that you might want to have a look in the class=20 >> PlayerGraphics2dCmdPolygon is that if you do not setFill_color it=20 >> gives an exception, when it could probably use a default=20 >> (transparent?) value... >> >> Thank you very much Regards... >> Hugo >> >> ************************************* CODE ******************* >> >> PlayerClient robot; >> Graphics2DInterface graphicsInterface; >> >> robot =3D new PlayerClient ("localhost", 6665); >> graphicsInterface =3D robot.requestInterfaceGraphics2D(0, 1); >> robot.runThreaded(-1, -1); >> >> graphicsInterface.clearScreen (); >> >> PlayerGraphics2dCmdPolyline p =3D new PlayerGraphics2dCmdPolyline (); >> >> PlayerColor color =3D new PlayerColor (); >> color.setAlpha (0); >> color.setRed (0); color.setGreen (0); color.setBlue (0xff); >> int lineSize =3D 32; >> p.setCount (lineSize); >> >> for (double r =3D 0; r < 1.0; r +=3D 0.05) { >> PlayerPoint2d[] points =3D new PlayerPoint2d[lineSize]; >> for (int j =3D 0; j < lineSize; j++) { >> points[j] =3D new PlayerPoint2d (); >> points[j].setPx ((float)(r * Math.cos (j * Math.PI / 32))); >> points[j].setPy ((float)(r * Math.sin (j * Math.PI / 32))); >> System.out.println(" Point: "+points[j].getPx()+",=20 >> "+points[j].getPy()); >> } >> >> p.setPoints (points); >> p.setColor (color); >> >> graphicsInterface.drawPolyline (p); >> >> try { Thread.sleep (100); } catch (Exception e) { >> e.printStackTrace(); } >> >> ************************************* END CODE ******************* >> >> >> >> ---------------------------------------------------- >> Hugo Gravato Marques, University of Essex, PhD Student >> PHONE: +44 (0)7854917241, England or +351 962482416, Portugal >> ADDRESS: University of Essex, Department of Computer Science, >> Wivenhoe Park, Colchester Essex, CO4 3SQ, UK >> WEB: http://privatewww.essex.ac.uk/~hgmarq/ >> =20 >> > --=20 | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |
From: Radu B. R. <ru...@cs...> - 2006-03-28 14:58:17
Attachments:
smime.p7s
|
No problem Hugo... :) Hmm, it is directly related to your Player version. Let me try with 2.0.1 (stock) now and get back to you. Radu. Marques, Hugo G wrote: >Hi Radu... > >I downloaded the changes you made to the CVS but now I have a javaclient2.xdr.OncRpcException (see bellow). I tried the new code in my yesterday's example (lineSize = 32, if you remember) and I also made a simpler example (see code bellow) but I keep having the exception. The example you sent me in the weekend works fine, but that is because the number of points you used is >= 64. I tried to see what was the problem in the Graphics2DInterface but the manipulation of the bytes you used for encoding the information is a bit confusing for me as I'm not familiar with the neither the xdr encoding nor the format of the messages exchanged with player/stage. > >sorry about the insistence man... :( > >cheers, >hugo > > >******************************************** BEGINNING OF CODE ********************************* > >robot = new PlayerClient (host,port); >graphicsInterface = robot.requestInterfaceGraphics2D(0, 1); >robot.runThreaded(-1, -1); > >graphicsInterface.clearScreen (); >PlayerGraphics2dCmdPolyline p = new PlayerGraphics2dCmdPolyline (); >PlayerColor color = new PlayerColor (); >color.setAlpha (0); >color.setRed (0); color.setGreen (0); color.setBlue (0xff); > >p.setCount (2); > >PlayerPoint2d[] points = new PlayerPoint2d[2]; >points[0] = new PlayerPoint2d (); >points[0].setPx (-1.0f); >points[0].setPy (-1.0f); > >points[1] = new PlayerPoint2d (); >points[1].setPx (1.0f); >points[1].setPy (1.0f); > >p.setPoints (points); >p.setColor (color); >graphicsInterface.drawPolyline (p); > >try { Thread.sleep (100); } catch (Exception e) { >e.printStackTrace(); } > > >******************************************** END CODE ***** BEGINNING OF EXCEPTION ********************************* > > >Exception in thread "main" javaclient2.PlayerException: [Graphics2D] : Error while XDR-encoding draw command: javaclient2.xdr.OncRpcException: ONC/RPC buffer overflow > at javaclient2.Graphics2DInterface.drawPolyline(Graphics2DInterface.java:181) > at Agent.testGraphics(Agent.java:368) > at Agent.initRobot(Agent.java:305) > at Agent.initialize(Agent.java:136) > at Agent.main(Agent.java:441) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >Caused by: javaclient2.xdr.OncRpcException: ONC/RPC buffer overflow > at javaclient2.xdr.XdrBufferEncodingStream.xdrEncodeInt(XdrBufferEncodingStream.java:181) > at javaclient2.xdr.XdrEncodingStream.xdrEncodeFloat(XdrEncodingStream.java:334) > at javaclient2.Graphics2DInterface.drawPolyline(Graphics2DInterface.java:156) > ... 9 more > > >******************************************** END OF EXCEPTION ********************************* > > > > > >---------------------------------------------------- >Hugo Gravato Marques, University of Essex, PhD Student >PHONE: +44 (0)7854917241, England or +351 962482416, Portugal >ADDRESS: University of Essex, Department of Computer Science, >Wivenhoe Park, Colchester Essex, CO4 3SQ, UK >WEB: http://privatewww.essex.ac.uk/~hgmarq/ > > > > > > > >-----Original Message----- >From: jav...@li... on behalf of Radu Bogdan Rusu >Sent: Mon 27/03/2006 23:12 >To: jav...@li... >Subject: Re: [Java-player-users] Graphics2D interface > >Ok, since the fix seems to affect more than one file (Player-wise), >ignore changing your player distribution for now, and use the latest >Javaclient2 CVS version. I just commited the latest changes which should >work with the *current* Player version (CVS). Once Player 2.1 is out, I >will change it. > >Best, >Radu. > >Radu Bogdan Rusu wrote: > > > >>Aham!!! Evrika! ;) >> >>We just found another Player bug. The fix for this one is trivial >>though. I envision Player in a few months being 99.99% bug free at >>this rate! :) >> >>Unfortunately I don't have commit rights to that part of the >>repository (libplayercore)... so I'll ask Brian to do it for us now. >> >>If you don't want to "cvs" Player... go into player.h yourself, search >>for the player_graphics2d_cmd_points_t, >>player_graphics2d_cmd_polyline_t and player_graphics2d_cmd_polygon_t >>structures, and modify the first member from "uint16_t count;" to >>"uint16_t points_count;". Then recompile Player, and that should be it. >> >>There is one small fix for Javaclient2 as well... I am committing it >>now, and then waiting for Brian to patch Player, and probably test >>again in the morning. >> >>Cheers, >>Radu. >> >>Marques, Hugo G wrote: >> >> >> >>>Hi Radu... >>> >>>first of all thank's for the quick implementation of the interface... >>>I really needed it in order to continue my experiments... >>> >>>I tryed to run your code and it works perfectly... but if I try to >>>use an PlayerGraphics2dCmdPolyline object with the number of lines >>>smaller than 64 it simply does not show anything... I tryed to show a >>>simple line on Stage with only 2 points using the same idea you used >>>in the example and it did not work... Then I hacked slightly your >>>code (see bellow) in order to print only part of the circles and it >>>did not worked as well... >>> >>>I then tried to solve the issue with the class >>>PlayerGraphics2dCmdPolygon but I had the same problem. I tried to >>>went through the source code of playerclient and the >>>graphics2DInterface and it seemed fine to me... >>>Another thing that you might want to have a look in the class >>>PlayerGraphics2dCmdPolygon is that if you do not setFill_color it >>>gives an exception, when it could probably use a default >>>(transparent?) value... >>> >>>Thank you very much Regards... >>>Hugo >>> >>>************************************* CODE ******************* >>> >>>PlayerClient robot; >>>Graphics2DInterface graphicsInterface; >>> >>>robot = new PlayerClient ("localhost", 6665); >>>graphicsInterface = robot.requestInterfaceGraphics2D(0, 1); >>>robot.runThreaded(-1, -1); >>> >>>graphicsInterface.clearScreen (); >>> >>>PlayerGraphics2dCmdPolyline p = new PlayerGraphics2dCmdPolyline (); >>> >>>PlayerColor color = new PlayerColor (); >>>color.setAlpha (0); >>>color.setRed (0); color.setGreen (0); color.setBlue (0xff); >>>int lineSize = 32; >>>p.setCount (lineSize); >>> >>>for (double r = 0; r < 1.0; r += 0.05) { >>> PlayerPoint2d[] points = new PlayerPoint2d[lineSize]; >>> for (int j = 0; j < lineSize; j++) { >>> points[j] = new PlayerPoint2d (); >>> points[j].setPx ((float)(r * Math.cos (j * Math.PI / 32))); >>> points[j].setPy ((float)(r * Math.sin (j * Math.PI / 32))); >>> System.out.println(" Point: "+points[j].getPx()+", >>>"+points[j].getPy()); >>> } >>> >>>p.setPoints (points); >>>p.setColor (color); >>> >>>graphicsInterface.drawPolyline (p); >>> >>>try { Thread.sleep (100); } catch (Exception e) { >>> e.printStackTrace(); } >>> >>>************************************* END CODE ******************* >>> >>> >>> >>>---------------------------------------------------- >>>Hugo Gravato Marques, University of Essex, PhD Student >>>PHONE: +44 (0)7854917241, England or +351 962482416, Portugal >>>ADDRESS: University of Essex, Department of Computer Science, >>>Wivenhoe Park, Colchester Essex, CO4 3SQ, UK >>>WEB: http://privatewww.essex.ac.uk/~hgmarq/ >>> >>> >>> >>> > > > -- | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |
From: Radu B. R. <ru...@cs...> - 2006-03-28 15:34:33
Attachments:
smime.p7s
Graphics2DInterface.java
|
Okie dokes... You were right, I forgot to modify something. I just committed the changes to CVS and tested with 2.0.1. I am attaching Graphics2DInterface.java to this e-mail so you don't have to wait until anonymous CVS gets a shot at it. Please tell me if you encounter any more problems. Best, Radu. Marques, Hugo G wrote: >Hi Radu... > >I downloaded the changes you made to the CVS but now I have a javaclient2.xdr.OncRpcException (see bellow). I tried the new code in my yesterday's example (lineSize = 32, if you remember) and I also made a simpler example (see code bellow) but I keep having the exception. The example you sent me in the weekend works fine, but that is because the number of points you used is >= 64. I tried to see what was the problem in the Graphics2DInterface but the manipulation of the bytes you used for encoding the information is a bit confusing for me as I'm not familiar with the neither the xdr encoding nor the format of the messages exchanged with player/stage. > >sorry about the insistence man... :( > >cheers, >hugo > > >******************************************** BEGINNING OF CODE ********************************* > >robot = new PlayerClient (host,port); >graphicsInterface = robot.requestInterfaceGraphics2D(0, 1); >robot.runThreaded(-1, -1); > >graphicsInterface.clearScreen (); >PlayerGraphics2dCmdPolyline p = new PlayerGraphics2dCmdPolyline (); >PlayerColor color = new PlayerColor (); >color.setAlpha (0); >color.setRed (0); color.setGreen (0); color.setBlue (0xff); > >p.setCount (2); > >PlayerPoint2d[] points = new PlayerPoint2d[2]; >points[0] = new PlayerPoint2d (); >points[0].setPx (-1.0f); >points[0].setPy (-1.0f); > >points[1] = new PlayerPoint2d (); >points[1].setPx (1.0f); >points[1].setPy (1.0f); > >p.setPoints (points); >p.setColor (color); >graphicsInterface.drawPolyline (p); > >try { Thread.sleep (100); } catch (Exception e) { >e.printStackTrace(); } > > >******************************************** END CODE ***** BEGINNING OF EXCEPTION ********************************* > > >Exception in thread "main" javaclient2.PlayerException: [Graphics2D] : Error while XDR-encoding draw command: javaclient2.xdr.OncRpcException: ONC/RPC buffer overflow > at javaclient2.Graphics2DInterface.drawPolyline(Graphics2DInterface.java:181) > at Agent.testGraphics(Agent.java:368) > at Agent.initRobot(Agent.java:305) > at Agent.initialize(Agent.java:136) > at Agent.main(Agent.java:441) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >Caused by: javaclient2.xdr.OncRpcException: ONC/RPC buffer overflow > at javaclient2.xdr.XdrBufferEncodingStream.xdrEncodeInt(XdrBufferEncodingStream.java:181) > at javaclient2.xdr.XdrEncodingStream.xdrEncodeFloat(XdrEncodingStream.java:334) > at javaclient2.Graphics2DInterface.drawPolyline(Graphics2DInterface.java:156) > ... 9 more > > >******************************************** END OF EXCEPTION ********************************* > > > > > >---------------------------------------------------- >Hugo Gravato Marques, University of Essex, PhD Student >PHONE: +44 (0)7854917241, England or +351 962482416, Portugal >ADDRESS: University of Essex, Department of Computer Science, >Wivenhoe Park, Colchester Essex, CO4 3SQ, UK >WEB: http://privatewww.essex.ac.uk/~hgmarq/ > > > > > > > >-----Original Message----- >From: jav...@li... on behalf of Radu Bogdan Rusu >Sent: Mon 27/03/2006 23:12 >To: jav...@li... >Subject: Re: [Java-player-users] Graphics2D interface > >Ok, since the fix seems to affect more than one file (Player-wise), >ignore changing your player distribution for now, and use the latest >Javaclient2 CVS version. I just commited the latest changes which should >work with the *current* Player version (CVS). Once Player 2.1 is out, I >will change it. > >Best, >Radu. > >Radu Bogdan Rusu wrote: > > > >>Aham!!! Evrika! ;) >> >>We just found another Player bug. The fix for this one is trivial >>though. I envision Player in a few months being 99.99% bug free at >>this rate! :) >> >>Unfortunately I don't have commit rights to that part of the >>repository (libplayercore)... so I'll ask Brian to do it for us now. >> >>If you don't want to "cvs" Player... go into player.h yourself, search >>for the player_graphics2d_cmd_points_t, >>player_graphics2d_cmd_polyline_t and player_graphics2d_cmd_polygon_t >>structures, and modify the first member from "uint16_t count;" to >>"uint16_t points_count;". Then recompile Player, and that should be it. >> >>There is one small fix for Javaclient2 as well... I am committing it >>now, and then waiting for Brian to patch Player, and probably test >>again in the morning. >> >>Cheers, >>Radu. >> >>Marques, Hugo G wrote: >> >> >> >>>Hi Radu... >>> >>>first of all thank's for the quick implementation of the interface... >>>I really needed it in order to continue my experiments... >>> >>>I tryed to run your code and it works perfectly... but if I try to >>>use an PlayerGraphics2dCmdPolyline object with the number of lines >>>smaller than 64 it simply does not show anything... I tryed to show a >>>simple line on Stage with only 2 points using the same idea you used >>>in the example and it did not work... Then I hacked slightly your >>>code (see bellow) in order to print only part of the circles and it >>>did not worked as well... >>> >>>I then tried to solve the issue with the class >>>PlayerGraphics2dCmdPolygon but I had the same problem. I tried to >>>went through the source code of playerclient and the >>>graphics2DInterface and it seemed fine to me... >>>Another thing that you might want to have a look in the class >>>PlayerGraphics2dCmdPolygon is that if you do not setFill_color it >>>gives an exception, when it could probably use a default >>>(transparent?) value... >>> >>>Thank you very much Regards... >>>Hugo >>> >>>************************************* CODE ******************* >>> >>>PlayerClient robot; >>>Graphics2DInterface graphicsInterface; >>> >>>robot = new PlayerClient ("localhost", 6665); >>>graphicsInterface = robot.requestInterfaceGraphics2D(0, 1); >>>robot.runThreaded(-1, -1); >>> >>>graphicsInterface.clearScreen (); >>> >>>PlayerGraphics2dCmdPolyline p = new PlayerGraphics2dCmdPolyline (); >>> >>>PlayerColor color = new PlayerColor (); >>>color.setAlpha (0); >>>color.setRed (0); color.setGreen (0); color.setBlue (0xff); >>>int lineSize = 32; >>>p.setCount (lineSize); >>> >>>for (double r = 0; r < 1.0; r += 0.05) { >>> PlayerPoint2d[] points = new PlayerPoint2d[lineSize]; >>> for (int j = 0; j < lineSize; j++) { >>> points[j] = new PlayerPoint2d (); >>> points[j].setPx ((float)(r * Math.cos (j * Math.PI / 32))); >>> points[j].setPy ((float)(r * Math.sin (j * Math.PI / 32))); >>> System.out.println(" Point: "+points[j].getPx()+", >>>"+points[j].getPy()); >>> } >>> >>>p.setPoints (points); >>>p.setColor (color); >>> >>>graphicsInterface.drawPolyline (p); >>> >>>try { Thread.sleep (100); } catch (Exception e) { >>> e.printStackTrace(); } >>> >>>************************************* END CODE ******************* >>> >>> >>> >>>---------------------------------------------------- >>>Hugo Gravato Marques, University of Essex, PhD Student >>>PHONE: +44 (0)7854917241, England or +351 962482416, Portugal >>>ADDRESS: University of Essex, Department of Computer Science, >>>Wivenhoe Park, Colchester Essex, CO4 3SQ, UK >>>WEB: http://privatewww.essex.ac.uk/~hgmarq/ >>> >>> >>> >>> > > > -- | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |
From: Marques, H. G <hg...@es...> - 2006-03-28 22:15:17
|
Hi Radu... I solved the issue for the current version of player; everything was = fine in your code apart from the fact that you were using the number of = points to fix the size, when in the "dirty fix" your proposed the number = of points is always 64 (see code bellow). I think it would be a good = idea for now to extend the change to the other methods drawPoligon and = drawPoints and leave it like that until the new version of player comes = out... hope this helps... Cheers... Hugo ************************************ BEGIN OF CODE = ************************ public void drawPolyline (PlayerGraphics2dCmdPolyline pgcp) { try { short points =3D pgcp.getCount (); // int size =3D 4 + 4 + (points * 8) + 16; int size =3D 4 + (64 * 8) + 16; // ADDED BY HGM // int size =3D 4 + (points * 8) + 16; // COMENTED BY HGM sendHeader (PLAYER_MSGTYPE_CMD, PLAYER_GRAPHICS2D_CMD_POLYLINE, size); XdrBufferEncodingStream xdr =3D new XdrBufferEncodingStream (size); xdr.beginEncoding (null, 0); xdr.xdrEncodeShort (points); // xdr.xdrEncodeInt (points); =20 for (int i =3D 0; i < points; i++) { xdr.xdrEncodeFloat (pgcp.getPoints ()[i].getPx ()); xdr.xdrEncodeFloat (pgcp.getPoints ()[i].getPy ()); } =20 for (int i =3D points; i < 64; i++) { xdr.xdrEncodeFloat (0); xdr.xdrEncodeFloat (0); } xdr.xdrEncodeByte ((byte)(pgcp.getColor ().getAlpha () & 0x000000FF)); xdr.xdrEncodeByte ((byte)(pgcp.getColor ().getRed () & 0x000000FF)); xdr.xdrEncodeByte ((byte)(pgcp.getColor ().getGreen () & 0x000000FF)); xdr.xdrEncodeByte ((byte)(pgcp.getColor ().getBlue () & 0x000000FF)); xdr.endEncoding (); os.write (xdr.getXdrData (), 0, xdr.getXdrLength ()); xdr.close (); os.flush (); } catch (IOException e) { throw new PlayerException ("[Graphics2D] : Couldn't send draw command: " + e.toString(), e); } catch (OncRpcException e) { throw new PlayerException ("[Graphics2D] : Error while XDR-encoding draw command: " + e.toString(), e); } } =09 ****************************************** END OF CODE = ***************************************** ---------------------------------------------------- Hugo Gravato Marques, University of Essex, PhD Student PHONE: +44 (0)7854917241, England or +351 962482416, Portugal ADDRESS: University of Essex, Department of Computer Science, Wivenhoe Park, Colchester Essex, CO4 3SQ, UK WEB: http://privatewww.essex.ac.uk/~hgmarq/ =20 -----Original Message----- From: jav...@li... on behalf of = Marques, Hugo G Sent: Tue 28/03/2006 15:37 To: jav...@li... Subject: RE: [Java-player-users] Graphics2D interface =20 Hi Radu... I downloaded the changes you made to the CVS but now I have a = javaclient2.xdr.OncRpcException (see bellow). I tried the new code in my = yesterday's example (lineSize =3D 32, if you remember) and I also made a = simpler example (see code bellow) but I keep having the exception. The = example you sent me in the weekend works fine, but that is because the = number of points you used is >=3D 64. I tried to see what was the = problem in the Graphics2DInterface but the manipulation of the bytes you = used for encoding the information is a bit confusing for me as I'm not = familiar with the neither the xdr encoding nor the format of the = messages exchanged with player/stage. =20 sorry about the insistence man... :( cheers, hugo ******************************************** BEGINNING OF CODE = ********************************* robot =3D new PlayerClient (host,port); graphicsInterface =3D robot.requestInterfaceGraphics2D(0, 1); robot.runThreaded(-1, -1); =20 graphicsInterface.clearScreen (); PlayerGraphics2dCmdPolyline p =3D new PlayerGraphics2dCmdPolyline (); PlayerColor color =3D new PlayerColor (); color.setAlpha (0); color.setRed (0); color.setGreen (0); color.setBlue (0xff); p.setCount (2); PlayerPoint2d[] points =3D new PlayerPoint2d[2]; points[0] =3D new PlayerPoint2d (); points[0].setPx (-1.0f); points[0].setPy (-1.0f); points[1] =3D new PlayerPoint2d (); points[1].setPx (1.0f); points[1].setPy (1.0f); p.setPoints (points); p.setColor (color); graphicsInterface.drawPolyline (p); try { Thread.sleep (100); } catch (Exception e) { e.printStackTrace(); } ******************************************** END CODE ***** BEGINNING OF = EXCEPTION ********************************* Exception in thread "main" javaclient2.PlayerException: [Graphics2D] : = Error while XDR-encoding draw command: javaclient2.xdr.OncRpcException: = ONC/RPC buffer overflow at = javaclient2.Graphics2DInterface.drawPolyline(Graphics2DInterface.java:181= ) at Agent.testGraphics(Agent.java:368) at Agent.initRobot(Agent.java:305) at Agent.initialize(Agent.java:136) at Agent.main(Agent.java:441) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at = sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :39) at = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) Caused by: javaclient2.xdr.OncRpcException: ONC/RPC buffer overflow at = javaclient2.xdr.XdrBufferEncodingStream.xdrEncodeInt(XdrBufferEncodingStr= eam.java:181) at = javaclient2.xdr.XdrEncodingStream.xdrEncodeFloat(XdrEncodingStream.java:3= 34) at = javaclient2.Graphics2DInterface.drawPolyline(Graphics2DInterface.java:156= ) ... 9 more ******************************************** END OF EXCEPTION = ********************************* ---------------------------------------------------- Hugo Gravato Marques, University of Essex, PhD Student PHONE: +44 (0)7854917241, England or +351 962482416, Portugal ADDRESS: University of Essex, Department of Computer Science, Wivenhoe Park, Colchester Essex, CO4 3SQ, UK WEB: http://privatewww.essex.ac.uk/~hgmarq/ =20 -----Original Message----- From: jav...@li... on behalf of Radu = Bogdan Rusu Sent: Mon 27/03/2006 23:12 To: jav...@li... Subject: Re: [Java-player-users] Graphics2D interface =20 Ok, since the fix seems to affect more than one file (Player-wise),=20 ignore changing your player distribution for now, and use the latest=20 Javaclient2 CVS version. I just commited the latest changes which should = work with the *current* Player version (CVS). Once Player 2.1 is out, I=20 will change it. Best, Radu. Radu Bogdan Rusu wrote: > Aham!!! Evrika! ;) > > We just found another Player bug. The fix for this one is trivial=20 > though. I envision Player in a few months being 99.99% bug free at=20 > this rate! :) > > Unfortunately I don't have commit rights to that part of the=20 > repository (libplayercore)... so I'll ask Brian to do it for us now. > > If you don't want to "cvs" Player... go into player.h yourself, search = > for the player_graphics2d_cmd_points_t,=20 > player_graphics2d_cmd_polyline_t and player_graphics2d_cmd_polygon_t=20 > structures, and modify the first member from "uint16_t count;" to=20 > "uint16_t points_count;". Then recompile Player, and that should be = it. > > There is one small fix for Javaclient2 as well... I am committing it=20 > now, and then waiting for Brian to patch Player, and probably test=20 > again in the morning. > > Cheers, > Radu. > > Marques, Hugo G wrote: > >> Hi Radu... >> >> first of all thank's for the quick implementation of the interface... = >> I really needed it in order to continue my experiments... >> >> I tryed to run your code and it works perfectly... but if I try to=20 >> use an PlayerGraphics2dCmdPolyline object with the number of lines=20 >> smaller than 64 it simply does not show anything... I tryed to show a = >> simple line on Stage with only 2 points using the same idea you used=20 >> in the example and it did not work... Then I hacked slightly your=20 >> code (see bellow) in order to print only part of the circles and it=20 >> did not worked as well... >> >> I then tried to solve the issue with the class=20 >> PlayerGraphics2dCmdPolygon but I had the same problem. I tried to=20 >> went through the source code of playerclient and the=20 >> graphics2DInterface and it seemed fine to me... >> Another thing that you might want to have a look in the class=20 >> PlayerGraphics2dCmdPolygon is that if you do not setFill_color it=20 >> gives an exception, when it could probably use a default=20 >> (transparent?) value... >> >> Thank you very much Regards... >> Hugo >> >> ************************************* CODE ******************* >> >> PlayerClient robot; >> Graphics2DInterface graphicsInterface; >> >> robot =3D new PlayerClient ("localhost", 6665); >> graphicsInterface =3D robot.requestInterfaceGraphics2D(0, 1); >> robot.runThreaded(-1, -1); >> >> graphicsInterface.clearScreen (); >> >> PlayerGraphics2dCmdPolyline p =3D new PlayerGraphics2dCmdPolyline (); >> >> PlayerColor color =3D new PlayerColor (); >> color.setAlpha (0); >> color.setRed (0); color.setGreen (0); color.setBlue (0xff); >> int lineSize =3D 32; >> p.setCount (lineSize); >> >> for (double r =3D 0; r < 1.0; r +=3D 0.05) { >> PlayerPoint2d[] points =3D new PlayerPoint2d[lineSize]; >> for (int j =3D 0; j < lineSize; j++) { >> points[j] =3D new PlayerPoint2d (); >> points[j].setPx ((float)(r * Math.cos (j * Math.PI / 32))); >> points[j].setPy ((float)(r * Math.sin (j * Math.PI / 32))); >> System.out.println(" Point: "+points[j].getPx()+",=20 >> "+points[j].getPy()); >> } >> >> p.setPoints (points); >> p.setColor (color); >> >> graphicsInterface.drawPolyline (p); >> >> try { Thread.sleep (100); } catch (Exception e) { >> e.printStackTrace(); } >> >> ************************************* END CODE ******************* >> >> >> >> ---------------------------------------------------- >> Hugo Gravato Marques, University of Essex, PhD Student >> PHONE: +44 (0)7854917241, England or +351 962482416, Portugal >> ADDRESS: University of Essex, Department of Computer Science, >> Wivenhoe Park, Colchester Essex, CO4 3SQ, UK >> WEB: http://privatewww.essex.ac.uk/~hgmarq/ >> =20 >> > --=20 | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting = language that extends applications into web and mobile media. Attend the live = webcast and join the prime developer group breaking into this new coding = territory! http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=110944&bid$1720&dat=121642 _______________________________________________ Java-player-users mailing list Jav...@li... https://lists.sourceforge.net/lists/listinfo/java-player-users |
From: Radu B. R. <ru...@cs...> - 2006-03-27 20:48:14
Attachments:
smime.p7s
|
Aham!!! Evrika! ;) We just found another Player bug. The fix for this one is trivial though. I envision Player in a few months being 99.99% bug free at this rate! :) Unfortunately I don't have commit rights to that part of the repository (libplayercore)... so I'll ask Brian to do it for us now. If you don't want to "cvs" Player... go into player.h yourself, search for the player_graphics2d_cmd_points_t, player_graphics2d_cmd_polyline_t and player_graphics2d_cmd_polygon_t structures, and modify the first member from "uint16_t count;" to "uint16_t points_count;". Then recompile Player, and that should be it. There is one small fix for Javaclient2 as well... I am committing it now, and then waiting for Brian to patch Player, and probably test again in the morning. Cheers, Radu. Marques, Hugo G wrote: >Hi Radu... > >first of all thank's for the quick implementation of the interface... I really needed it in order to continue my experiments... > >I tryed to run your code and it works perfectly... but if I try to use an PlayerGraphics2dCmdPolyline object with the number of lines smaller than 64 it simply does not show anything... I tryed to show a simple line on Stage with only 2 points using the same idea you used in the example and it did not work... Then I hacked slightly your code (see bellow) in order to print only part of the circles and it did not worked as well... > >I then tried to solve the issue with the class PlayerGraphics2dCmdPolygon but I had the same problem. I tried to went through the source code of playerclient and the graphics2DInterface and it seemed fine to me... > >Another thing that you might want to have a look in the class PlayerGraphics2dCmdPolygon is that if you do not setFill_color it gives an exception, when it could probably use a default (transparent?) value... > >Thank you very much >Regards... >Hugo > >************************************* CODE ******************* > >PlayerClient robot; >Graphics2DInterface graphicsInterface; > >robot = new PlayerClient ("localhost", 6665); >graphicsInterface = robot.requestInterfaceGraphics2D(0, 1); >robot.runThreaded(-1, -1); > >graphicsInterface.clearScreen (); > >PlayerGraphics2dCmdPolyline p = new PlayerGraphics2dCmdPolyline (); > >PlayerColor color = new PlayerColor (); >color.setAlpha (0); >color.setRed (0); color.setGreen (0); color.setBlue (0xff); >int lineSize = 32; >p.setCount (lineSize); > >for (double r = 0; r < 1.0; r += 0.05) { > PlayerPoint2d[] points = new PlayerPoint2d[lineSize]; > > for (int j = 0; j < lineSize; j++) { > points[j] = new PlayerPoint2d (); > points[j].setPx ((float)(r * Math.cos (j * Math.PI / 32))); > points[j].setPy ((float)(r * Math.sin (j * Math.PI / 32))); > System.out.println(" Point: "+points[j].getPx()+", "+points[j].getPy()); > } > >p.setPoints (points); >p.setColor (color); > >graphicsInterface.drawPolyline (p); > >try { Thread.sleep (100); } catch (Exception e) { > e.printStackTrace(); } > >************************************* END CODE ******************* > > > >---------------------------------------------------- >Hugo Gravato Marques, University of Essex, PhD Student >PHONE: +44 (0)7854917241, England or +351 962482416, Portugal >ADDRESS: University of Essex, Department of Computer Science, >Wivenhoe Park, Colchester Essex, CO4 3SQ, UK >WEB: http://privatewww.essex.ac.uk/~hgmarq/ > > -- | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |
From: Radu B. R. <ru...@cs...> - 2006-03-27 22:13:01
Attachments:
smime.p7s
|
Ok, since the fix seems to affect more than one file (Player-wise), ignore changing your player distribution for now, and use the latest Javaclient2 CVS version. I just commited the latest changes which should work with the *current* Player version (CVS). Once Player 2.1 is out, I will change it. Best, Radu. Radu Bogdan Rusu wrote: > Aham!!! Evrika! ;) > > We just found another Player bug. The fix for this one is trivial > though. I envision Player in a few months being 99.99% bug free at > this rate! :) > > Unfortunately I don't have commit rights to that part of the > repository (libplayercore)... so I'll ask Brian to do it for us now. > > If you don't want to "cvs" Player... go into player.h yourself, search > for the player_graphics2d_cmd_points_t, > player_graphics2d_cmd_polyline_t and player_graphics2d_cmd_polygon_t > structures, and modify the first member from "uint16_t count;" to > "uint16_t points_count;". Then recompile Player, and that should be it. > > There is one small fix for Javaclient2 as well... I am committing it > now, and then waiting for Brian to patch Player, and probably test > again in the morning. > > Cheers, > Radu. > > Marques, Hugo G wrote: > >> Hi Radu... >> >> first of all thank's for the quick implementation of the interface... >> I really needed it in order to continue my experiments... >> >> I tryed to run your code and it works perfectly... but if I try to >> use an PlayerGraphics2dCmdPolyline object with the number of lines >> smaller than 64 it simply does not show anything... I tryed to show a >> simple line on Stage with only 2 points using the same idea you used >> in the example and it did not work... Then I hacked slightly your >> code (see bellow) in order to print only part of the circles and it >> did not worked as well... >> >> I then tried to solve the issue with the class >> PlayerGraphics2dCmdPolygon but I had the same problem. I tried to >> went through the source code of playerclient and the >> graphics2DInterface and it seemed fine to me... >> Another thing that you might want to have a look in the class >> PlayerGraphics2dCmdPolygon is that if you do not setFill_color it >> gives an exception, when it could probably use a default >> (transparent?) value... >> >> Thank you very much Regards... >> Hugo >> >> ************************************* CODE ******************* >> >> PlayerClient robot; >> Graphics2DInterface graphicsInterface; >> >> robot = new PlayerClient ("localhost", 6665); >> graphicsInterface = robot.requestInterfaceGraphics2D(0, 1); >> robot.runThreaded(-1, -1); >> >> graphicsInterface.clearScreen (); >> >> PlayerGraphics2dCmdPolyline p = new PlayerGraphics2dCmdPolyline (); >> >> PlayerColor color = new PlayerColor (); >> color.setAlpha (0); >> color.setRed (0); color.setGreen (0); color.setBlue (0xff); >> int lineSize = 32; >> p.setCount (lineSize); >> >> for (double r = 0; r < 1.0; r += 0.05) { >> PlayerPoint2d[] points = new PlayerPoint2d[lineSize]; >> for (int j = 0; j < lineSize; j++) { >> points[j] = new PlayerPoint2d (); >> points[j].setPx ((float)(r * Math.cos (j * Math.PI / 32))); >> points[j].setPy ((float)(r * Math.sin (j * Math.PI / 32))); >> System.out.println(" Point: "+points[j].getPx()+", >> "+points[j].getPy()); >> } >> >> p.setPoints (points); >> p.setColor (color); >> >> graphicsInterface.drawPolyline (p); >> >> try { Thread.sleep (100); } catch (Exception e) { >> e.printStackTrace(); } >> >> ************************************* END CODE ******************* >> >> >> >> ---------------------------------------------------- >> Hugo Gravato Marques, University of Essex, PhD Student >> PHONE: +44 (0)7854917241, England or +351 962482416, Portugal >> ADDRESS: University of Essex, Department of Computer Science, >> Wivenhoe Park, Colchester Essex, CO4 3SQ, UK >> WEB: http://privatewww.essex.ac.uk/~hgmarq/ >> >> > -- | Radu Bogdan Rusu | http://rbrusu.com/ | http://www9.cs.tum.edu/people/rusu/ | Intelligent Autonomous Systems | Technische Universitaet Muenchen |