How to get access to a robot's position relative to the world[Python]
I have a multi robot simulation in Gazebo and RViz and I would like to create four functions, which would allow the robot to move 1 meter in north, south, east and west direction(depending on our input). For that, I plan to access the robot's position relative to the map in which it is present and give it commands using nav2 accordingly. However, I am having problems accessing the pose of the robot. Any ideas on how I could access the pose of the robot in python would be helpful.
Some further clarification:
I would like to send goToPose()
command to each robot(as present in the Simple Commander API. Let us assume that we tell the robot to move "up/north", I plan to send the goal pose in the following manner:
goal_pose.pose.position.y = (current y coordinate) + 1
Hence, I need a way to access the current coordinates of the robot with respect to the map so that I can send such commands. At the same time, I am also open to suggestions or feedback on other ways to do this.
NOTE: I am using ROS2 Iron on Ubuntu 22.04. I am using two TURTLEBOT3 waffle robots for my simulation.