Robotics StackExchange | Archived questions

Setting robot initial position

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

I'm using movebase 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 movebase 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 initialpose topic of fakelocalization 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!!

Asked by Leontes on 2015-06-30 06:56:29 UTC

Comments

Answers

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 -->
<node
    name="spawn_urdf"
    pkg="gazebo_ros"
    type="spawn_model"
    output="screen"
    args="
    -file $(find robot_package)/robotDescription/robot.urdf
    -x 1.890696     
    -y 0.883094 
    -z 1.607973 
    -urdf 
    -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"/>
</node>

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

Asked by F.Brosseau on 2015-07-01 02:21:54 UTC

Comments

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]

Asked by Leontes on 2015-07-01 05:10:50 UTC

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

Asked by F.Brosseau on 2015-07-01 06:13:38 UTC

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]

Asked by Leontes on 2015-07-01 06:37:21 UTC

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

Asked by F.Brosseau on 2015-07-01 08:25:43 UTC

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?

Asked by Leontes on 2015-07-01 09:11:25 UTC

Yes you can call it as a normal service. You have examples here : (http://gazebosim.org/tutorials/?tut=ros_roslaunch) You can also launch rqt and use the /gazebo/spawn_urdf_model service thanks to the service caller plugin.

Asked by F.Brosseau on 2015-07-02 02:58:27 UTC