Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@gzsdfparser.js parse white space incorrectly #166

Open
osrf-migration opened this issue Aug 22, 2019 · 3 comments
Open

@gzsdfparser.js parse white space incorrectly #166

osrf-migration opened this issue Aug 22, 2019 · 3 comments
Labels
bug Something isn't working major

Comments

@osrf-migration
Copy link

Original report (archived issue) by myungkeun Lee (Bitbucket: myungkeun Lee).


A Model who has box geometry link does not spawned, when tag’s value in geometry has white space at the front.

Example

<?xml version="1.0" ?>
<sdf version="1.4">
    <model name='a_model'>
        <link name='box_shape_linnk'>
            <pose> 0 0 0 0 0 0 </pose>
            <collision name='col_box'>
                <geometry>
                    <box>
                        <size> 1 1 1 </size>
                    </box>
                </geometry>
            </collision>
            <visual name='vis_box'>
                <geometry>
                    <box>
                        <size> 1 1 1 </size> <!-- size value has whitespace at the front-->
                    </box>
                </geometry>
            </visual>
        </link>
    </model>
</sdf>

Because before parse the value of tag, value string is splited to [“ “, size_x, size_y, size_z, “ “] when value string contain white space at front.

It occurs when parseSize function split ‘sizeStr’ with ‘\s+’regex.

So when trim() was added to remove the space, it was confirmed that the model with the box size containing front of white space could be spawned

---  var values = sizeStr.split(/\s+/); 
+++  var values = sizeStr.trim().split(/\s+/);  
@osrf-migration
Copy link
Author

Original comment by myungkeun Lee (Bitbucket: myungkeun Lee).


  • Edited issue description

2 similar comments
@osrf-migration
Copy link
Author

Original comment by myungkeun Lee (Bitbucket: myungkeun Lee).


  • Edited issue description

@osrf-migration
Copy link
Author

Original comment by myungkeun Lee (Bitbucket: myungkeun Lee).


  • Edited issue description

@osrf-migration osrf-migration added major bug Something isn't working labels Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant