Gazebo - gui camera fails due to bad array length + FIX

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Gazebo - gui camera fails due to bad array length + FIX

Mathias Broxvall
Hi,
 
I just submitted this bug report on the sourceforge system but perhaps it
should rather be mentioned on the mailing list.... Anyway, when running
Gazebo 0.5.2 on a Gentoo system with the  latest (2.6.10) version of WxPython
i got the follow error on  the wxpython side of things when running the
 example.world script (after modifying it to use the correct  rendering).
 
 Traceback (most recent call last):
 File
 "/usr/local/lib/python2.3/site-packages/wxgazebo/main.py",
 line 170, in OnTimer
 win.OnUpdate()
 File
 "/usr/local/lib/python2.3/site-packages/wxgazebo/panels/sim.py",
 line 159, in OnUpdate
 h.panel.OnUpdate()
 File
 "/usr/local/lib/python2.3/site-packages/wxgazebo/panels/guicam.py",
 line 130, in OnUpdate
 self.imagePanel.SetData(data.image)
 File
 "/usr/local/lib/python2.3/site-packages/wxgazebo/image.py",
 line 30, in SetData
 self.image.SetData(image)
 File
 "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/_core.py",
 line 2652, in SetData
 return _core_.Image_SetData(*args, **kwargs)
 ValueError: Invalid data buffer size.
 
 
 After investigating the error and adding some debugging
 printouts to guicam.py and to image.py i found that the
 error was caused by getting a bad length of the
 self.iface.data.image array. This array was interpreted as a
 string by Python (probably as a C-string) and consitently
 got the size 2359296 bytes while it should be 640x480x3
 = 921600 bytes. Maybe this was caused by not beeing
 null terminated at the end (after all, it's just a RGB array.
 nothing on the C-side guarantees it's null terminated).
 
 I made a tiny patch which fixes this problem and that is to
 change line 130 of guicam.py which used to be:
 
 self.imagePanel.SetData(data.image)
 
 and instead change it to be:
 
 self.imagePanel.SetData(data.image[0:self.iface.data.image_size])
 
 
 Perhaps someone can commit this patch, or maybe find a
 better explanation for the bug...
 
Thanks

 / Mathias Broxvall


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
Reply | Threaded
Open this post in threaded view
|

Re: Gazebo - gui camera fails due to bad array length + FIX

Nate Koenig
Hi Mathias,

Thanks for the info, but the problem was solved months ago. Just get
the CVS version of Gazebo.

You might want to search the mailing lists in the future before
spending a lot of time debugging a problem.

-nate

On 10/2/05, Mathias Broxvall <[hidden email]> wrote:

> Hi,
>
> I just submitted this bug report on the sourceforge system but perhaps it
> should rather be mentioned on the mailing list.... Anyway, when running
> Gazebo 0.5.2 on a Gentoo system with the  latest (2.6.10) version of WxPython
> i got the follow error on  the wxpython side of things when running the
>  example.world script (after modifying it to use the correct  rendering).
>
>  Traceback (most recent call last):
>  File
>  "/usr/local/lib/python2.3/site-packages/wxgazebo/main.py",
>  line 170, in OnTimer
>  win.OnUpdate()
>  File
>  "/usr/local/lib/python2.3/site-packages/wxgazebo/panels/sim.py",
>  line 159, in OnUpdate
>  h.panel.OnUpdate()
>  File
>  "/usr/local/lib/python2.3/site-packages/wxgazebo/panels/guicam.py",
>  line 130, in OnUpdate
>  self.imagePanel.SetData(data.image)
>  File
>  "/usr/local/lib/python2.3/site-packages/wxgazebo/image.py",
>  line 30, in SetData
>  self.image.SetData(image)
>  File
>  "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/_core.py",
>  line 2652, in SetData
>  return _core_.Image_SetData(*args, **kwargs)
>  ValueError: Invalid data buffer size.
>
>
>  After investigating the error and adding some debugging
>  printouts to guicam.py and to image.py i found that the
>  error was caused by getting a bad length of the
>  self.iface.data.image array. This array was interpreted as a
>  string by Python (probably as a C-string) and consitently
>  got the size 2359296 bytes while it should be 640x480x3
>  = 921600 bytes. Maybe this was caused by not beeing
>  null terminated at the end (after all, it's just a RGB array.
>  nothing on the C-side guarantees it's null terminated).
>
>  I made a tiny patch which fixes this problem and that is to
>  change line 130 of guicam.py which used to be:
>
>  self.imagePanel.SetData(data.image)
>
>  and instead change it to be:
>
>  self.imagePanel.SetData(data.image[0:self.iface.data.image_size])
>
>
>  Perhaps someone can commit this patch, or maybe find a
>  better explanation for the bug...
>
> Thanks
>
>  / Mathias Broxvall
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Playerstage-gazebo mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo