(none) hits in May 2012
 


CV
Contact
Media
My Links
Projects
  ConnectFour
  Differential
  Encryption
  IceCream
  LGUI
  LaserScannerURG
  Middleware
  MyDb
  NeuroKar
  NomadScout
  PThread
  ParticleFilter
  PathPlanner
  Pose
  Robosoccer
  RobosoccerSim
  RobotLocalization
  SonyEVI_370
  UVector
  UsarServer, labbook
  UsarSim, labbook
  V4l2 api
  Viz
  iCat Demo
Publications
Site Map

Search Google
UsarServer, labbook ***********************************
Analysis of User Commander as it is running behind the UnReal simulator after driving around for a long time with a robot.
***********************************
FIXES:
- useThumbnails=false in BufferedLayer.vb
- use Format32bppPArgb in the constructor of Bitmaps in BufferedLayer.vp: As New Bitmap(width,height,PixelFormat.Format32bppPArgb)
- set the Usar Commander window to a small size

2008-03-26

- Using a maximized Usar Commander window instead of the default size made gdiplus.dll activity go up 11%. Making the window smaller is a easy way to get rid of delays when they might occur in the future.
- Not suprisingly turning off the drawing of layers FreeSpace, SaveSpace and ClearedSpace gave a large speed up, gdiplus.ddl activity went down 15%.
- Looked into setting Graphics properties, but this didn't gave any speed up it only made the images look bad.
Fast rendering:

g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Low; // or NearestNeighbour
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;

Slow rendering:

g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
- It seems we are not the only ones experiencing slow painting with DrawImage(Unscaled): .Net247, GameDev.net
- Arnoud found a possible speed improvement similar to this report. I tested it and it made GdiPlus.dll be +-3% less active. This is an improvement but not as big as the report claims, so lets investigate a little further (the ControlStyles settings mentioned in the report were already present in the code).

2008-03-25

- Spent some time analyzing how the drawing machanism works. Turns out all derived classes of BufferedLayer, such as AgentsLayer, ClearSpaceLayer and ObstacleLayer, use its Graphics object (Gfx) to draw to its image (Img) as an intermediate step. Then when ManifoldImage draws itself it calls on all its layers, including these BufferedLayer subclasses, to in turn draw themself to the screen as the final step. This final step takes a long time some 35% which seems to be too much. However, an alpha channels is used to prevent later layers from completely drawing over the previous ones. The intermidiate step is nice so each layer can be saved seperatly but probably it would be faster to draw directly to the screen.

2008-03-24

- FINAL CONCLUSIONS: Problem solved by simply setting useThumbnails=false, but then the drawing of gdiplus.dll still takes alot of CPU cycles (+-44%) so this is the prime candidate for future optimalisation. Lets finish here with a table of items with more then 1% (exclusive) of the long path with useThumbnail=false:

Function NameInclusive Samples Exclusive Samples Inclusive Samples % Exclusive Samples %
[gdiplus.dll] 48,414 48,187 44.17 43.96
[mscorwks.dll] 109,348 18,098 99.76 16.51
UvARescue.Math.Vector.get_Item(int32) 7,808 7,808 7.12 7.12
UvARescue.Math.Vector.Equals(object) 15,976 7,179 14.58 6.55
UvARescue.Math.Matrix.get_Item(int32,int32) 3,577 3,577 3.26 3.26
UvARescue.Math.Vector.get_Length() 2,518 2,518 2.30 2.30
[MSVCR80.dll] 1,945 1,945 1.77 1.77
UvARescue.Math.Vector..ctor(class UvARescue.Math.Vector) 3,305 1,438 3.02 1.31
CLRStubOrUnknownAddress 50,387 1,112 45.97 1.01

- For comparison I did the same thing with useThumbnails=true. The longest path was 9 minutes at which time I experienced a delay of about 8 seconds. The gdiplus.dll now takes even more samples when the path get larger. Do note that those entries with negative percentages are not running faster, they only decrease as the gdiplus.ddl is taking a bigger part of the 100% for itself.
---- short => middle
gdiplus.dll +3.05%

---- short => long
gdiplus.dll +14.88
UvARescue.Math.Matrix.get_Item(int32,int32)	-1.61%
UvARescue.Math.Vector.Equals(object)	-1.71%
UvARescue.Math.Vector.get_Item(int32)	-1.97%
[mscorwks.dll]	-2.98%

---- middle => long
[gdiplus.dll]	+11.83%
UvARescue.Math.Vector.Equals(object)	-1.75%
UvARescue.Math.Vector.get_Item(int32)	-2.08%
[mscorwks.dll]	-2.25%
- After two modifications (useThumbnails=false and setting the sleep to 100ms at lowest part of LiveDriver::Run) I ran the profiler while driving a short, middle and long path. The long path was more then 10 minutes from top to bottom back to top of the Street map. Even with the long path I didn't noticed delays. Below are the differences between the paths according to the profiler. The gdiplus.dll takes more samples with longer paths because a larger manifold needs to be drawn.
---- short => middle
all differences are less than 1%

---- short => long
gdiplus.dll +2.31% (+5.53% for another long path that resulted in a crash)
mscorwks.dll -1.48% (-1.5%  for another long path that resulted in a crash)

---- middle => long
gdiplus.dll +1.72%
- Tried some things to increase the processing of messages:
  - MAX_RESOLUTION in Constants.vb to 5 (instead of 15) only gave an 8% speed up in drawing
  - EXTEND_MAXTRANSLATION in ManifoldScan.vb to 300 (instead of 200) had no effect
  - useThumbnails in BufferedLayer.vb to false gave a 7% speed up in drawing
- Here are some profiler results of the current version:
 The gdiplus.dll (used for drawing) takes 48% of the profiler samples (exclusive), seems a bit much
 The UVARescue.Math.ddl takes 26% of the profiler samples
 The mscorwks.dll (Microsoft .NET Runtime Common Language Runtime) takes 16% of the profiler samples
 The UVARescue.Tools.ddl takes 3% of the profiler samples
 The UVARescue.Slam.ddl takes  1.7% of the profiler samples
 The rest takes less then 1% each
- When setting some print statements when the LiveDriver doesn't receives messages from UnReal I found that these print statements were no longer executed when the delay between Unreal and UsarCommander occured. So the problem seems to be caused by LiveDriver being too busy processing messages so it is unable to keep up with the incomming messages send by UnReal.

2008-03-23

- As can be seen in the profiling data of various profilers the gdiplus.dll is the part of the software that in a long run takes the most time (+-46% exclusive). This is the part responsible for drawing so now I think I should stop playing with tools and take a closer look at that part of the code. These profilers and UML reverse enginering tools are helpfull but no substitute for getting among the many lines of source code, atleast now I somewhat know where to search.
- tried an evalutation version of Visual Studio Team System 2008 Team Suite. This is a nice profiler see manual but it seems I was mistaken in thinking it would seperate the profiling data into threads. See XML profiling data for the resulting profiling data of a run of +- 10 minutes with the robot (the data in XML format is much harder to read then the original data in Visual Studio).

2008-03-18

- tried an evalutation version of Intel Thread Profiler which promisses to seperate the profiling data into threads, however it requires recompiling with an Intel compiler which does not exist for Visual Basic

2008-03-17

- tried the free EQATEC profiler, also a nice tool for VB but not seperating into threads
- used an evalutation version of ALTOVA UModel to generate some UML models to get an overview of the code. See uml diagrams where the "Content of DOAS" gives the inheritance relations and the others show the interaction between classes caused be receiving laser range data.

2008-03-16

- reading code

2008-03-12

- The plan is to see where the bottleneck is, which means finding out which threads there are and seeing which is most busy. Alternatively the problem might be caused by locked mutexes (used for thread safety), or other unknown causes.
- installed the free CodeAnalyst which is a usefull profiler, however it only gives profiling information for each seperate thread when using an AMD CPU, apperently.





***********************************
The effort to hook up a real Nomad Scout2 robot with the USAR server to do real world experiments.
***********************************

2008-02-26

- CameraUsarServer will for now not support the U[x][y][width][height] command.
- Now CameraUsarServer is reading the 'OK' command requesting an new image without newline.
- After temporarely adding a newline to the 'OK' command of the Camera client and (after alot of trouble) converting the omnicam images to JPG format (RAW images are NOT displayed) I now see the real omnicam image showing up in the Usar Commander. As Arnoud loves images:
real OmniCam in Usar Commander

2008-02-23

- Found hard coded resolution that is different from my OmniCam.
- Created conversion for encountered problem with the Endianness of data send between C++ linux program and Visual Basic Windows program.
- Around added GETCONF requests from the UASAR commander to the NomadUSAR server:
received command:DRIVE {Left 0} {Right 0} {Light False}
received command:INIT {ClassName USARBot.Nomad} {Name Hercules} {Location 1,1,0} {Rotation 0,0,0} 
reply:NFO {Gametype BotDeathMatch} {Level DM-Mapping_250} {TimeLimit 0}
received command:DRIVE {Left 2} {Right 2} {Light False}
received command:GETGEO {Type Robot} {Name Hercules}
reply:GEO {Type GroundVehicle} {Name USARBot.Nomad} {Dimensions 0.4,0.4,1.5} {COG 0,0,-0.2} {WheelRadius 0.1016} {WheelSeparation 0.31} {WheelBase 0.0}
received command:GETCONF {Type Robot} {Name Hercules}
reply:CONF {Type GroundVehicle} {Name USARBot.Nomad} {SteeringType SkidSteered} {Mass 30} {MaxSpeed 9.84252} {MaxTorque 20} {MaxFrontSteer 0} {MaxRearSteer 0}
received command:GETGEO {Type Sonar} {Name }
reply:GEO {Type Sonar} {Name Sonar0 Location 0.19,-0,-0.26 Orientation 0,0,-0 Mount HARD} {Name Sonar1 Location 0.175537,-0.0727099,-0.26 Orientation 0,0,-0.392699 Mount HARD} {Name Sonar2 Location 0.13435,-0.13435,-0.26 Orientation 0,0,-0.785398 Mount HARD} {Name Sonar3 Location 0.0727099,-0.175537,-0.26 Orientation 0,0,-1.1781 Mount HARD} {Name Sonar4 Location 1.16338e-17,-0.19,-0.26 Orientation 0,0,-1.5708 Mount HARD} {Name Sonar5 Location -0.0727099,-0.175537,-0.26 Orientation 0,0,-1.9635 Mount HARD} {Name Sonar6 Location -0.13435,-0.13435,-0.26 Orientation 0,0,-2.35619 Mount HARD} {Name Sonar7 Location -0.175537,-0.0727099,-0.26 Orientation 0,0,-2.74889 Mount HARD} {Name Sonar8 Location -0.19,-2.32675e-17,-0.26 Orientation 0,0,-3.14159 Mount HARD} {Name Sonar9 Location -0.175537,0.0727099,-0.26 Orientation 0,0,2.74889 Mount HARD} {Name Sonar10 Location -0.13435,0.13435,-0.26 Orientation 0,0,2.35619 Mount HARD} {Name Sonar11 Location -0.0727099,0.175537,-0.26 Orientation 0,0,1.9635 Mount HARD} {Name Sonar12 Location 1.16338e-17,0.19,-0.26 Orientation 0,0,1.5708 Mount HARD} {Name Sonar13 Location 0.0727099,0.175537,-0.26 Orientation 0,0,1.1781 Mount HARD} {Name Sonar14 Location 0.13435,0.13435,-0.26 Orientation 0,0,0.785398 Mount HARD} {Name Sonar15 Location 0.175537,0.0727099,-0.26 Orientation 0,0,0.392699 Mount HARD}
received command:GETCONF {Type Sonar} {Name }
reply:CONF {Type Sonar} {Name Sonar0} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar1} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar2} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar3} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar4} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar5} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar6} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar7} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar8} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar9} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar10} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar11} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar12} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar13} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar14} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar15} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066}
received command:GETGEO {Type RangeScanner} {Name LaserScannerURG}
reply:GEO {Type RangeScanner} {Name RangeScanner Location 0.115,0,-0.5665 Orientation 0,0,0 Mount HARD}
received command:GETCONF {Type RangeScanner} {Name LaserScannerURG}
reply:CONF {Type RangeScanner} {Name LaserScannerURG} {Resolution 0.0061359} {Fov 4.7131392} {Pawing 0} {Tilting 0}
received command:GETGEO {Type Camera} {Name }
reply:GEO {Type Camera} {Name Camera Location 0,0,-0.94 Orientation 0,1.5708,-3.14159 Mount HARD}
received command:GETCONF {Type Camera} {Name }
reply:CONF {Type Camera} {Name Camera} {DefFov 1.5708} {MinFov 0.349066} {MaxFov 2.0944}

2008-02-18

-Recieving all relevant GETGEO and replying GEO messages
-Recieving all relevant GETCONF and replying CONF messages
grep GEO log.txt:
---------------------------------------------------------------------------------
received command:GETGEO {Type Robot} {Name Hercules}
reply:GEO {Type GroundVehicle} {Name USARBot.Nomad} {Dimensions 0.4,0.4,1.5} {COG 0,0,-0.2} {WheelRadius 0.1016} {WheelSeparation 0.31} {WheelBase 0.0}
received command:GETGEO {Type Sonar} {Name }
reply:GEO {Type Sonar} {Name Sonar0 Location 0.19,-0,-0.26 Orientation 0,0,-0 Mount HARD} {Name Sonar1 Location 0.175537,-0.0727099,-0.26 Orientation 0,0,-0.392699 Mount HARD} {Name Sonar2 Location 0.13435,-0.13435,-0.26 Orientation 0,0,-0.785398 Mount HARD} {Name Sonar3 Location 0.0727099,-0.175537,-0.26 Orientation 0,0,-1.1781 Mount HARD} {Name Sonar4 Location 1.16338e-17,-0.19,-0.26 Orientation 0,0,-1.5708 Mount HARD} {Name Sonar5 Location -0.0727099,-0.175537,-0.26 Orientation 0,0,-1.9635 Mount HARD} {Name Sonar6 Location -0.13435,-0.13435,-0.26 Orientation 0,0,-2.35619 Mount HARD} {Name Sonar7 Location -0.175537,-0.0727099,-0.26 Orientation 0,0,-2.74889 Mount HARD} {Name Sonar8 Location -0.19,-2.32675e-17,-0.26 Orientation 0,0,-3.14159 Mount HARD} {Name Sonar9 Location -0.175537,0.0727099,-0.26 Orientation 0,0,2.74889 Mount HARD} {Name Sonar10 Location -0.13435,0.13435,-0.26 Orientation 0,0,2.35619 Mount HARD} {Name Sonar11 Location -0.0727099,0.175537,-0.26 Orientation 0,0,1.9635 Mount HARD} {Name Sonar12 Location 1.16338e-17,0.19,-0.26 Orientation 0,0,1.5708 Mount HARD} {Name Sonar13 Location 0.0727099,0.175537,-0.26 Orientation 0,0,1.1781 Mount HARD} {Name Sonar14 Location 0.13435,0.13435,-0.26 Orientation 0,0,0.785398 Mount HARD} {Name Sonar15 Location 0.175537,0.0727099,-0.26 Orientation 0,0,0.392699 Mount HARD}
received command:GETGEO {Type RangeScanner} {Name LaserScannerURG}
reply:GEO {Type RangeScanner} {Name RangeScanner Location 0.115,0,-0.5665 Orientation 0,0,0 Mount HARD}
received command:GETGEO {Type Camera} {Name }
reply:GEO {Type Camera} {Name Camera Location 0,0,-0.94 Orientation 0,1.5708,-3.14159 Mount HARD}
---------------------------------------------------------------------------------

grep CONF log.txt:
---------------------------------------------------------------------------------
received command:GETCONF {Type Robot} {Name Zeus}
reply:CONF {Type GroundVehicle} {Name USARBot.Nomad} {SteeringType SkidSteered} {Mass 30} {MaxSpeed 9.84252} {MaxTorque 20} {MaxFrontSteer 0} {MaxRearSteer 0}
received command:GETCONF {Type Sonar} {Name }
reply:CONF {Type Sonar}  {Name Sonar0} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar1} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar2} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar3} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar4} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar5} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar6} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar7} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar8} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar9} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar10} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar11} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar12} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar13} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar14} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066} {Name Sonar15} {MaxRange 10.668} {MinRange 0.1524} {BeamAngle 0.349066}
---------------------------------------------------------------------------------

2008-02-18

-Nomad wheel radius is 4 inches (4*0.0254 meters), corrected steering command which now takes rad/sec.
-After the clients send an INIT message it expects a replay (this is undocumented). I now send 'NFO {Gametype BotDeathMatch} {Level DM-Mapping_250} {TimeLimit 0}' as a reply.
-Arnoud helped me to add the Nomad robot to the client and to get acceptable laser resolution and FOV, as a result the client made its first map with data send by the Nomad, see Arnoud's labbook for graphics.

2008-02-17

-Parsing commands now with the CommandParser.
-Reading and setting initial Location and Rotation of the robot done.
-Reading Sonar data and sending to the client, however all the sonars seem to be broken. We had problems with the sonars before. Edwin will probably take a look at it tomorrow. Probably some mechanical/electrical problem.
-Reading LaserRangeURG data and sending to the client, however I was promissed thinks would be plotted after sending this data but I don't see anything, maybe something is missing still.
-TODO: Maybe have to search for a termination signal from the client so the server can shut down gracefully thereby shutting down the laser scanner and nomad.
-Nomad robot has no Tick or Encoder info, only reference in the manual is on encoder by which they seem to mean odometry. So this info will not be provided.

2008-02-16

-Got documentation and code from Arnoud Visser to start connecting the Nomad robot with the USAR-simulator.

Image server
UsarSim manual
Visual Studio 2005 Visual Basic en C#: svn://u013154.science.uva.nl/Roboresc/experimental
Arnoud's intial implemenation: staff:/home/arnoud/projects/roboresc/NomadUsarServer">
Labbook
FAQ
Building and Spawing manual

-The intial implementation seems to work on nb-zoran with Nserver on arena.
-Created empty project in repository: svn://u013154.science.uva.nl/Roboresc/experimental/Tools/NomadUsarServer
-Changed to C++ project and now succesfully getting odometry from the real robot (NomadUsarServer on nb-zoran and Nserver on nomadu1).
-Also able to move the robot forward using the UsarCommander.