Set pose of model programmatically with higher frequency (using ign transport)
I was able to spawn models in the gazebo scene by using terminal commands. See my last post: https://answers.gazebosim.org/question/28196/add-urdf-to-world-using-a-python-script-while-gazebo-is-running-worldmy_worldcreate-service-entityfactory-message/
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.
I also found this python library to interact with the ignition transport C++ library but without success so far. https://github.com/srmainwaring/python-ignition
Does anyone have an idea on how to run these position updates with a higher frequency (e.g. 30Hz or more)
Asked by marc-marc on 2022-06-22 09:02:34 UTC
Answers
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/actors
Asked by marc-marc on 2022-06-23 04:00:24 UTC
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
Asked by kakcalu13 on 2022-06-23 08:03:00 UTC
Good idea! I will try to bridge the topic /set_pose from ROS2 to ign and then send a message.
Asked by marc-marc on 2022-06-23 09:12:05 UTC
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
Asked by kakcalu13 on 2022-06-23 11:38:37 UTC
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-transport/issues/323#issuecomment-1171263362
Asked by marc-marc on 2022-06-30 09:10:01 UTC
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.
Asked by marc-marc on 2022-06-30 09:12:42 UTC
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++?
Asked by kakcalu13 on 2022-06-30 09:37:32 UTC
As a starting point these tutorials are really helpful.
https://gazebosim.org/api/transport/11.0/tutorials.html
Here is the rest of the transport repo: https://github.com/gazebosim/gz-transport/tree/ign-transport11/tutorials
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.
Asked by marc-marc on 2022-06-30 10:00:03 UTC
Ah I learnt this info from your post: https://answers.gazebosim.org/question/28128/how-to-use-ig
Asked by marc-marc on 2022-06-30 10:09:43 UTC
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!
Asked by kakcalu13 on 2022-06-30 10:52:24 UTC
Comments