ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Setting robot initial position

asked 2015-06-30 06:56:29 -0500

Leontes gravatar image

updated 2015-07-01 05:46:29 -0500

Hi, maybe thats a trivial or silly question, but I've been looking for the answer without results...

I'm using move_base and ArbotiX to show the behaviour of a simple robot in Rviz, and I need to set the initial position of him in the map. When I start the simulation move_base sets the position of the robot always in [0,0,0] but I want to change that in the robot's code.

When I publish in the initial_pose topic of fake_localization the robot does nothing but change the global and local planner behaviour. It remains in the same position of the simulator.

If anybody can guide me, I'll be very gratefull. Thanks!!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-07-01 02:21:54 -0500

F.Brosseau gravatar image

Hi, I am not using fake_localization but the following may help you.

I am using move_base with rtabmap for visual odometry and map building. I am using Gazebo and I can change the initial position of the robot with this :

<!-- Spawn a robot into Gazebo -->
    -file $(find robot_package)/robotDescription/robot.urdf
    -x 1.890696     
    -y 0.883094 
    -z 1.607973 
    -model robot"

And then I modify the odometry node with the initial_pose param:

<node pkg="rtabmap_ros" type="stereo_odometry" name="stereo_odometry" output="screen">
    <remap from="left/image_rect"       to="$(arg cameraOdo)/left/image_rect"/>
    <remap from="right/image_rect"      to="$(arg cameraOdo)/right/image_rect"/>
    <remap from="left/camera_info"      to="$(arg cameraOdo)/left/camera_info"/>
    <remap from="right/camera_info"     to="$(arg cameraOdo)/right/camera_info"/>
    <remap from="odom"                  to="$(arg cameraOdo)/odom"/>

    <param name="publish_tf" type="bool" value="true"/>
    <param name="frame_id" type="string" value="base_frame"/>
    <param name="odom_frame_id" type="string" value="odom"/>
    <param name="initial_pose" type="string" value="1.890696 0.883094 1.607973 0 0 0" />
    <param name="Odom/InlierDistance" type="string" value="0.1"/>
    <param name="Odom/MinInliers" type="string" value="10"/>
    <param name="Odom/RoiRatios" type="string" value="0.03 0.03 0.04 0.04"/>
    <param name="Odom/MaxDepth" type="string" value="10"/>
    <param name="OdomBow/NNDR" type="string" value="0.8"/>
    <param name="GFTT/MaxCorners" type="string" value="500"/>
    <param name="GFTT/MinDistance" type="string" value="5"/>

I know it's not what you are exactly looking for but I hope it can help.

edit flag offensive delete link more


I've been working on the problem, but the only thing that I've achieved is to set the robot's position to a given location [X,Y]. When I starts the simulation the robot works like if it's already in that position, but Rviz always displays the robot at [0,0]

Leontes gravatar image Leontes  ( 2015-07-01 05:10:50 -0500 )edit

You have this problem even if you set the robot's initial position to your odometry frame ?

F.Brosseau gravatar image F.Brosseau  ( 2015-07-01 06:13:38 -0500 )edit

Yes, I publish in Initial_pose and in Odom the same pose. I think that the real position of the robot never changes. If I set [2,1] as the initial position and send a goal to reach that position, the robot does nothing. But if I send a goal to go to [2,2] the robot makes a plan from [0,0] to [2,2]

Leontes gravatar image Leontes  ( 2015-07-01 06:37:21 -0500 )edit

And your TF tree is ok ? Something like this : map -> odom -> base_link -> ...

F.Brosseau gravatar image F.Brosseau  ( 2015-07-01 08:25:43 -0500 )edit

Yes... The only solution I see its to leave the ArbotiX&Rviz combo and use Gazebo. Gazebo's spawn_model service can be call as a normal service?

Leontes gravatar image Leontes  ( 2015-07-01 09:11:25 -0500 )edit

Yes you can call it as a normal service. You have examples here : ( You can also launch rqt and use the /gazebo/spawn_urdf_model service thanks to the service caller plugin.

F.Brosseau gravatar image F.Brosseau  ( 2015-07-02 02:58:27 -0500 )edit

Question Tools



Asked: 2015-06-30 06:56:29 -0500

Seen: 5,758 times

Last updated: Jul 01 '15