Gazebo | Ignition | Community
Ask Your Question
0

Set pose of model programmatically with higher frequency (using ign transport)

asked 2022-06-22 09:02:34 -0500

marc-marc gravatar image

I was able to spawn models in the gazebo scene by using terminal commands. See my last post: https://answers.gazebosim.org/questio...

I wanted to simulate moving items on a conveyor belt. In order for this to work I spawn all the items. Then I want to update the position of the items programmatically. This works by using the /set_pose service in the terminal. See my comment in the following github issue

However, calling terminal commands in a loop is really slow and the simulation runs with a 1% real time factor.

image description

I also found this python library to interact with the ignition transport C++ library but without success so far. https://github.com/srmainwaring/pytho...

Does anyone have an idea on how to run these position updates with a higher frequency (e.g. 30Hz or more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-06-23 04:00:24 -0500

marc-marc gravatar image

Edit: I found that there is a thing called Actors which can be animated but don't collide with the environment.

However, the path is predefined and cannot be changed during runtime.

https://gazebosim.org/docs/citadel/ac...

image description

edit flag offensive delete link more

Comments

I don't think animation would collide with anything. I don't know how to increase the Hz :(

Question, why don't you use ros2 bridge to control the object? ROS2 uses python3

kakcalu13 gravatar imagekakcalu13 ( 2022-06-23 08:03:00 -0500 )edit

Good idea! I will try to bridge the topic /set_pose from ROS2 to ign and then send a message.

marc-marc gravatar imagemarc-marc ( 2022-06-23 09:12:05 -0500 )edit

I think /set_pose is just like you grab the object and move it manually on GUI. If you want the robot to move itself, use the ros2 bridge. I've been using Foxy and it worked well. Soon I will hop into Humble Hawksbill for Citadel, Fortress and Garden

kakcalu13 gravatar imagekakcalu13 ( 2022-06-23 11:38:37 -0500 )edit

I found a way to set the pose of objects in the scene with a high frequency using a C++ script using the gazebo transport library. https://github.com/gazebosim/gz-trans...

marc-marc gravatar imagemarc-marc ( 2022-06-30 09:10:01 -0500 )edit

The ROS bridge for galactic is currently not working with services. I will just spawn a C++ ROS node that calls the set pose service.

marc-marc gravatar imagemarc-marc ( 2022-06-30 09:12:42 -0500 )edit

I saw your code of c++ in github! Nicely done!! Are you willing to share your secret with people like me who doesn't know how to use C++?

kakcalu13 gravatar imagekakcalu13 ( 2022-06-30 09:37:32 -0500 )edit

As a starting point these tutorials are really helpful. https://gazebosim.org/api/transport/1... Here is the rest of the transport repo: https://github.com/gazebosim/gz-trans... Where exactly can I help you? If gazebo is running you can use ign service -l in the terminal to list all the available services. ign service -h shows the help section.

marc-marc gravatar imagemarc-marc ( 2022-06-30 10:00:03 -0500 )edit

Ah I learnt this info from your post: https://answers.gazebosim.org/questio...

marc-marc gravatar imagemarc-marc ( 2022-06-30 10:09:43 -0500 )edit

Oh, I'm so glad you found my post helpful! It means a lot to me! This post is about the command line. I am not familiar with the C++ nor have I ever used it once. You know what, I will just look into C++ tutorials and use your C++ above to see how things work. Thank you for sharing your code!

kakcalu13 gravatar imagekakcalu13 ( 2022-06-30 10:52:24 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-06-22 09:02:34 -0500

Seen: 360 times

Last updated: Jun 23 '22