Home | Tutorials | Wiki | Issues
Ask Your Question
0

resize simple objects to specific sizes

asked 2017-07-17 12:21:31 -0600

Tonystark124 gravatar image

I am trying to load simple objects into the empty world of gazebo (box, cylinder and sphere.) and scale their sizes to specific values (say x = 2,y=1,z=3 for a box). The below image can give a better picture.

image description

Am able to scale using the scale tool available, but am not able to scale it to specific values, that can be reflected by the x,y and z from the properties on the left panel. Any direction on how I can scale it to specific values?

Note : When I scale the object using the scaling tool to any size, the properties values does not change at all from 1, for XYZ.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-07-17 12:29:26 -0600

Be sure you upgrade to a version of Gazebo which is currently supported, that's either Gazebo 7 or 8. Then you could do it like this:

  1. Insert a simple shape into simulation

  2. Right-click -> Edit model

  3. Double click -> Open the Visual tab

  4. Expand visual

  5. Under geometry, type in the desired values

  6. Repeat 3~5 for collision

  7. File -> Exit model editor

  8. Save and Exit

Voila :)

edit flag offensive delete link more

Comments

Thank you for your answer. am currently working with gazebo 2.2.6, and I was able to locate geometry, under the size tab, under visual in the properties on the left. That still doesn't change the size. It gets back to 1 each.

Tonystark124 gravatar imageTonystark124 ( 2017-07-17 12:39:53 -0600 )edit

as shown in the picture above, I did alter the values of x,y and z. But how do I get them to reflect on the object?

Tonystark124 gravatar imageTonystark124 ( 2017-07-17 12:41:15 -0600 )edit

in the properties, I can see 2 visual tabs. I tried editing both, but am not able to see them change permanently. The moment I click outside and view the values again, it's reset to default.

Tonystark124 gravatar imageTonystark124 ( 2017-07-17 12:49:09 -0600 )edit

am not in a state to upgrade, since am working with indigo and 14.04 trusty

Tonystark124 gravatar imageTonystark124 ( 2017-07-17 12:51:50 -0600 )edit
1

Gazebo 7 is supported on Trusty, this tutorial should help: http://gazebosim.org/tutorials?tut=ros_wrapper_versions&cat=connect_ros

chapulina gravatar imagechapulina ( 2017-07-17 14:11:13 -0600 )edit
1

The only option on Gazebo 2 is to manually write SDF files with the simple shapes in the sizes you want.

chapulina gravatar imagechapulina ( 2017-07-17 14:12:18 -0600 )edit

thank you for your help. It worked.! Gazebo7

Tonystark124 gravatar imageTonystark124 ( 2017-07-17 23:32:56 -0600 )edit

@chapulina I was not able to connect indigo and gazebo7, thus am working with gazebo 2 now. Can you please point me towards the right direction of writing sdf files for sizes and shapes?

Tonystark124 gravatar imageTonystark124 ( 2017-07-18 10:00:31 -0600 )edit

Sorry to hear that, Gazebo 7 would really be the best solution right now. I'm afraid you might run into many other problems with Gazebo 2. In any case, this tutorial should help you write the models: http://gazebosim.org/tutorials?tut=build_model

chapulina gravatar imagechapulina ( 2017-07-18 13:08:55 -0600 )edit
0

answered 2017-09-04 04:21:08 -0600

Duckfrost gravatar image

updated 2017-09-04 04:24:00 -0600

Another way of doing it is through code using ROS. There you can customise the simple geometry objects as you want and have finer control.

I've done it for Gazebo 7, but it will work for previous versions for sure. Here I leave you the video response: VideoResponse

image description

The code you need is: a urdf file (simple_box.urdf) with the object deffinition. Because its a simple geometry its really simple. You also need a launch file that spawns the object (spawn_robot_urdf.launch, spawn_simple_box.launch) into the scene. You will need also a script that calculates the inertias (inertial_calculator.py) of the object based on its geometry. Or you could also state the formulas in a XACRO file, and it will recalculate based on the dimensions ( but thats perhaps outside the scope here).

inertial_calculator.py

spawn_robot_urdf.launch

spawn_simple_box.launch

The file is an urdf, but the system doesnt allow these files, sorry for that, just remove the sdf extension. simple_box.urdf.sdf

Hope it helps.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-07-17 12:21:31 -0600

Seen: 266 times

Last updated: Sep 04