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

keizo's profile - activity

2012-04-08 10:36:44 -0500 received badge  Teacher (source)
2012-03-11 04:27:00 -0500 answered a question Challenges with headless turtlebot_gazebo on remote machine

Hi. I hope this information helps you.

The problem you see may be the same problem that I found last week.

I found "using variables without initialize" bug in "simulator_gazebo_plugins". That cause the very large value of odometry {x, y}.

[problem] When you try to use turtlebot simulator (gazebo), sometimes the node "/gazebo" publishes the topic "/odom" with very large initial position {x, y} like 1e+31 or so.

[cause] In turtlebot_gazebo_plugins/src/gazebo_ros_create.cpp, variables below are used without being initialized.

  • prev_update_time
  • odom_pose[0]
  • odom_pose[1]
  • odom_pose[2]

I know that recentry turtlebot_gazebo_plugins/src/gazebo_ros_create.cpp was patched about NaN value (in GazeboRosCreate::UpdateChild()) . The patch didn't fix the problem I found.

I don't know how to report bug-report and patch, so I'm glad if someone does.

[environment]

  • ubuntu 11.10 32bit
  • ros-electric (updated with apt-get)

[how to reproduce] (not 100%. because that is caused with "using uninitialized variable" in C++.)

Start 3 terminals separately and type it.

$ roscore
$ roslaunch turtlebot_gazebo turtlebot_empty_world.launch
$ rostopic echo /odom

Check values of pose.pose.position.x and y. If it shows like below, you successed to reproduce.

pose:
  pose:
    position:
      x: 1.86493744726e+31
      y: 4.86171422416e+30

[how to fix] initialize variables.

[patch] keizo@soi:~/ros_workspace/turtlebot_gazebo_plugins.keizo/src$ diff -c /opt/ros/electric/stacks /turtlebot_simulator/turtlebot_gazebo_plugins/src/gazebo_ros_create.cpp .

*** /opt/ros/electric/stacks/turtlebot_simulator/turtlebot_gazebo_plugins/src/gazebo_ros_create.cpp 2012-02-29 07:52:33.000000000 +0900
--- ./gazebo_ros_create.cpp 2012-03-11 22:59:59.026536682 +0900
***************
*** 153,158 ****
--- 153,159 ----
    js_.velocity.push_back(0);
    js_.effort.push_back(0);

+   prev_update_time_ = 0;
    last_cmd_vel_time_ = 0;
  }

***************
*** 172,177 ****
--- 173,184 ----
    if (joints_[FRONT]) set_joints_[FRONT] = true;
    if (joints_[REAR]) set_joints_[REAR] = true;

+   //initialize time and odometry position
+   prev_update_time_ = last_cmd_vel_time_ =
+     Simulator::Instance()->GetSimTime();
+   odom_pose_[0] = 0.0;
+   odom_pose_[1] = 0.0;
+   odom_pose_[2] = 0.0;
  }

  void GazeboRosCreate::FiniChild()

[[[ Unnecessary additional information ]]] [indirect problem] When you try to use turtlebot simulator (gazebo) and slam_gmapping, the node slam_gmapping downs with a message "bad_alloc" exception.

[cause] Ordinary, the initial value of odometory's {x, y} should be nearly equal to zero. but it shows sometimes very large like 1e+31 or so.

When the node "slam_gmapping" receives that large value, it try to enlarge map too much. And it cause a "not enough memory" situation and "bad_alloc" exception.

If you want to reproduce, you need to add "output_frame" param described blelow to turtlebot_gazebo/launch/robot.launch .

 <node pkg="robot_pose_ekf parameter" .... >
    ....
    <param name="output_frame" value="odom"/>
 </node>

[comment] I'm not good at English, I apologize about my poor English. I hope this information helps you. and also me.