ros / ros_tutorials

Code used in tutorials found on ROS wiki
http://wiki.ros.org/ros_tutorials
787 stars 537 forks source link

Crop galactic.png and rolling.png to 45x45. #157

Closed jokane closed 11 months ago

jokane commented 11 months ago

This PR crops the images in turtlesim/images for galactic and rolling to be 45x45, from their current 48x48 size. This is relevant because the image size apparently plays a role in how the internal coordinates are mapped to specific places on the turtlesim window.

Here's an example of what happens when I spawn 100 turtles, all at x=5.544444, y=5.544444, theta=0.0, without moving any of them. Screenshot from 2023-09-22 00-44-45 The result is incorrect because some of the turtles --always those shown with galactic.png or rolling.png-- appear further down and to the right.

This offset persists when the turtles move, which causes coordinated drawings by multiple turtles to be out-of-sync. Here's an example where top part of the "A", drawn by the galactic turtle, is shifted down and to the right of where it should be: image

The issue seems to be related to differing sizes of the turtle images:

root@donatello:/opt/ros/humble/share/turtlesim/images# file *
ardent.png:       PNG image data, 45 x 45, 8-bit/color RGBA, non-interlaced
bouncy.png:       PNG image data, 45 x 45, 8-bit/color RGBA, non-interlaced
crystal.png:      PNG image data, 45 x 45, 8-bit/color RGBA, non-interlaced
dashing.png:      PNG image data, 45 x 45, 8-bit/color RGBA, non-interlaced
eloquent.png:     PNG image data, 45 x 45, 8-bit/color RGBA, non-interlaced
foxy.png:         PNG image data, 45 x 45, 8-bit/color RGBA, non-interlaced
galactic.png:     PNG image data, 48 x 48, 8-bit/color RGBA, non-interlaced
humble.png:       PNG image data, 45 x 45, 8-bit/color RGBA, non-interlaced
rolling.png:      PNG image data, 48 x 48, 8-bit/color RGBA, non-interlaced

By cropping a few pixels of transparent border from these two images, down to 45x45 to match the other turtles, the problem is resolved: image

(Submitted, as first-time contributor to ROS, with my apologies if I've not formed the PR correctly.)

Yadunund commented 11 months ago

Thanks for making the icons consistent! The recommend workflow is to target fixes to the rolling branch. Once merged, changes will be backported to other distro branches if needed.

jokane commented 11 months ago

Replacing with #158, which targets rolling as requested.