Home | Tutorials | Wiki | Issues
Ask Your Question
0

Moving a depth camera model in the world without a robot body

asked 2018-05-31 10:30:16 -0500

anna.sarp gravatar image

I have created a world in gazebo simulation. Next, want to capture images and depth images of the world with a depth camera model at different random positions and orientations. For that, I created a model with kinect plugin following the tutorials here. The model is a box of size 0.1 x 0.1 x 0.1 and weight 0.1.

I am able to launch gazebo and spawn the model model by drag and drop. I can also get the intensity and depth images just fine at the dropped position. When I try to move the model around to different positions (using GUI), the model keeps falling down due to gravity. When I turn the gravity off and move the model, the model flies away due to no gravity. Is there a way I can simply move a depth camera model around to different (X, Y, Z, R, P, Y) in the world and capture images ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-06-01 12:09:16 -0500

chapulina gravatar image

For the camera not to be affected by gravity, or any other forces, simply add

<static>true</static>

if it's an SDF file or

<gazebo>
    <static>true</static>
</gazebo>

if it's an URDF.

edit flag offensive delete link more

Comments

@chapulina, Thank you for your response, it helped. Now the camera stays in the position and doesn't just fly off but it is not moving either. I try to change the pose of the model on the UI but it doesn't change from the spawned initial position in the .world file. Strange thing is that when I spawn a camera model through UI (Insert tab) and then go to model editor and change the 'Static' to true, then I can move the model to any random pose. It modes around then. Any Idea why ?

anna.sarp gravatar imageanna.sarp ( 2018-06-03 19:00:49 -0500 )edit

Hmm, I am able to move any static models in my world using the UI no problem. The model also doesn't fall down when I increase it's coordinate on the z-axis. What Gazebo version are you using?

Raskkii gravatar imageRaskkii ( 2018-06-04 02:44:33 -0500 )edit

@Raskkii I am using 7.0

anna.sarp gravatar imageanna.sarp ( 2018-06-04 09:06:40 -0500 )edit

Is your model nested inside another one or attached with a joint? You're using URDF, right? After the world is loaded, while you can't move it, could you save the world and then check the resulting SDF to see if the static flag is correctly set?

chapulina gravatar imagechapulina ( 2018-06-04 10:11:20 -0500 )edit

@chapulina, The model is independent with a structure like this '<model> <link> <sensor><camera>....</camera><sensor><link></model>'. This model is inside <world></world>. I did exactly what you said, launch a model with guil, save the model to file and examine it, static is set to '1'. In fact, I copied the contents between <model></model> and replaced it. I am still facing the same issues. I can move a model spawned from the gui using gui but not the model spawn through world file.

anna.sarp gravatar imageanna.sarp ( 2018-06-04 10:27:32 -0500 )edit

Could you tell me how to spawn an model in SDF, URDF file after starting a gazebo instance with a default world. I am am new to this and I don't want to use ROS. I couldn't find any tutorials to spawn a model from file without ROS.

anna.sarp gravatar imageanna.sarp ( 2018-06-04 10:29:28 -0500 )edit

Try `gz model --spawn-file=model_file.sdf --model-name=model_name`. Could you add a link to your model to the question? Also, what Gazebo version are you using?

chapulina gravatar imagechapulina ( 2018-06-04 11:13:14 -0500 )edit

(links in comment below) Okay, I figured it out. It's a glitch with the UI. I launched the world without camera and spawned the camera model with the sdf below. In this screenshot_1, the camera is spawned at <0,0,0,0,0,0> and it visualizes the scene. The topic visualization of the camera data also sees the same, But however, when I move it around in the GUI, in this screenshot_2, the camera visual doesn't change but the topic visualization shows image corresponding to <3,1,2,0,.2,0>.

anna.sarp gravatar imageanna.sarp ( 2018-06-04 13:53:40 -0500 )edit

Glad you figured it out. That sounds like a bug, feel free to ticket it here: https://bitbucket.org/osrf/gazebo/issues

chapulina gravatar imagechapulina ( 2018-06-04 14:55:40 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-05-31 10:30:16 -0500

Seen: 364 times

Last updated: Jun 01 '18