Ask Your Question

gavindvs's profile - activity

2019-03-01 16:28:21 -0500 marked best answer [Kinetic] mapping is inaccurate

Hi all I created my own launch file for gmapping however the map generated in RVIZ is really inaccurate compared to the Gazebo world. Is there any solution to this? My robot's speed was at 10 on the keyboard teleop and rotation was done in slow movements. My launch file codes are as follows:

File: my_gmapping_launch.launch

<launch>
  <arg name="scan_topic"  default="scan" />

  <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">

    <rosparam file="$(find my_mapping_launcher)/params/gmapping_params.yaml" command="load" />

    <remap from="scan" to="$(arg scan_topic)"/>
  </node>
</launch>

File: gmapping_params.yaml

base_frame: base_footprint
odom_frame: odom
map_update_interval: 5.0
maxUrange: 6.0
maxRange: 8.0

minimumScore: 200

linearUpdate: 0.1
angularUpdate: 0.1
temporalUpdate: -1.0
resampleThreshold: 0.5
particles: 80
lskip: 10
xmin: -10
ymin: -10
xmax: 10
ymax: 10

delta: 0.05
llsamplerange: 0.01
llsamplestep: 0.01
lasamplerange: 0.005
lasamplestep: 0.005

RVIZ mapping result and RVIZ settings -

image description image description image description

Gazebo world -

image description

After creating my map I'll be running my amcl launch file to localize my robot in the map.


Edit: My map result after changing to a more defined world for my turtlebot.

image description image description

2019-03-01 16:28:15 -0500 marked best answer Setting up your robot using tf, migration to tf2

Hi all,

I am following the tutorial from this link here: http://wiki.ros.org/navigation/Tutori... Noticed that it is using tf, however I would like to code it in tf2 seeing I have gone through the tf2 tutorials.

For the broadcaster file I had converted the original tf version which is this:

#include <ros/ros.h>
#include <tf/transform_broadcaster.h>

int main(int argc, char** argv){
  ros::init(argc, argv, "robot_tf_publisher");
  ros::NodeHandle n;

  ros::Rate r(100);

  tf::TransformBroadcaster broadcaster;

  while(n.ok()){
    broadcaster.sendTransform(
      tf::StampedTransform(
        tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.1, 0.0, 0.2)),
        ros::Time::now(),"base_link", "base_laser"));
    r.sleep();
  }
}

To the tf2 version which I did up here (not sure if I did it correctly):

#include <ros/ros.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2_ros/transform_broadcaster.h>
#include <geometry_msgs/TransformStamped.h>

int main(int argc, char** argv){
  ros::init(argc, argv, "robot_tf2_ros_publisher");
  ros::NodeHandle n;

  ros::Rate r(100);

  tf2_ros::TransformBroadcaster broadcaster;
  geometry_msgs::TransformStamped transformStamped;

  while(n.ok()){
    transformStamped.header.stamp = ros::Time::now();
    transformStamped.header.frame_id = "base_link";
    transformStamped.child_frame_id = "base_laser";
    transformStamped.transform.translation.x = 0.1;
    transformStamped.transform.translation.y = 0.0;
    transformStamped.transform.translation.z = 0.2;
    transformStamped.transform.rotation.x = 0;
    transformStamped.transform.rotation.y = 0;
    transformStamped.transform.rotation.z = 0;
    transformStamped.transform.rotation.w = 1;
    broadcaster.sendTransform(transformStamped);
    r.sleep();
  }
}

As for the listener file, I'm not sure how to convert it into the tf2 version :(

The original tf version of the listener file is as follows:

#include <ros/ros.h>
#include <geometry_msgs/PointStamped.h>
#include <tf/transform_listener.h>

void transformPoint(const tf::TransformListener& listener){
  //we'll create a point in the base_laser frame that we'd like to transform to the base_link frame
  geometry_msgs::PointStamped laser_point;
  laser_point.header.frame_id = "base_laser";

  //we'll just use the most recent transform available for our simple example
  laser_point.header.stamp = ros::Time();

  //just an arbitrary point in space
  laser_point.point.x = 1.0;
  laser_point.point.y = 0.2;
  laser_point.point.z = 0.0;

  try{
    geometry_msgs::PointStamped base_point;
    listener.transformPoint("base_link", laser_point, base_point);

    ROS_INFO("base_laser: (%.2f, %.2f. %.2f) -----> base_link: (%.2f, %.2f, %.2f) at time %.2f",
        laser_point.point.x, laser_point.point.y, laser_point.point.z,
        base_point.point.x, base_point.point.y, base_point.point.z, base_point.header.stamp.toSec());
  }
  catch(tf::TransformException& ex){
    ROS_ERROR("Received an exception trying to transform a point from \"base_laser\" to \"base_link\": %s", ex.what());
  }
}

int main(int argc, char** argv){
  ros::init(argc, argv, "robot_tf_listener");
  ros::NodeHandle n;

  tf::TransformListener listener(ros::Duration(10));

  //we'll transform a point once every second
  ros::Timer timer = n.createTimer(ros::Duration(1.0), boost::bind(&transformPoint, boost::ref(listener)));

  ros::spin();

}

If anyone would be able to help it would be very much appreciated.


Edit: Followed ur suggestions and changed the code. However I am getting errors :(

Listed the errors below -

/home/gavin/catkin_ws/src/robot_setup_tf/src/tf_listener.cpp: In function ‘void transformPoint(const tf2_ros::TransformListener&)’:
/home/gavin/catkin_ws/src/robot_setup_tf/src/tf_listener ...
(more)
2019-03-01 16:27:44 -0500 received badge  Famous Question (source)
2018-08-29 09:25:33 -0500 received badge  Notable Question (source)
2018-08-28 10:18:42 -0500 received badge  Famous Question (source)
2018-08-28 06:02:39 -0500 edited question Setting up your robot using tf, migration to tf2

Setting up your robot using tf, migration to tf2 Hi all, I am following the tutorial from this link here: http://wiki.

2018-08-28 06:01:38 -0500 commented question Setting up your robot using tf, migration to tf2

That's great! have added my CMakeLists.txt file above @gvdhoorn

2018-08-28 06:01:01 -0500 commented question Setting up your robot using tf, migration to tf2

That's great! below is my CMakeLists.txt file @gvdhoorn cmake_minimum_required(VERSION 2.8.3) project(robot_setup_tf)

2018-08-28 05:18:22 -0500 edited question Setting up your robot using tf, migration to tf2

Setting up your robot using tf, migration to tf2 Hi all, I am following the tutorial from this link here: http://wiki.

2018-08-28 05:14:29 -0500 commented question Setting up your robot using tf, migration to tf2

@PeteBlackerThe3rd changed the parameters tho got a whole string of errors :\ listed them in my latest edit.

2018-08-28 05:13:15 -0500 edited question [Kinetic] mapping is inaccurate

[Kinetic] mapping is inaccurate Hi all I created my own launch file for gmapping however the map generated in RVIZ is re

2018-08-28 05:11:29 -0500 commented answer [Kinetic] mapping is inaccurate

Tho the jumping still remained, it was just reduced :(

2018-08-28 05:10:39 -0500 commented answer [Kinetic] mapping is inaccurate

My latest edit contains my latest map. When I had used /map as the fixed frame under RViz, to lower the amount of jumpin

2018-08-28 05:07:53 -0500 commented answer [Kinetic] mapping is inaccurate

Tried changing to a more defined environment tho still getting poor mapping results :( also my robot keeps jumping from

2018-08-28 02:04:12 -0500 received badge  Enthusiast
2018-08-27 23:19:07 -0500 received badge  Popular Question (source)
2018-08-27 09:30:52 -0500 asked a question [Kinetic] mapping is inaccurate

[Kinetic] mapping is inaccurate Hi all I created my own launch file for gmapping however the map generated in RVIZ is re

2018-08-26 23:30:01 -0500 received badge  Student (source)
2018-08-25 22:07:49 -0500 edited question Setting up your robot using tf, migration to tf2

Setting up your robot using tf, migration to tf2 Hi all, I am following the tutorial from this link here: http://wiki.

2018-08-25 22:05:15 -0500 commented question Setting up your robot using tf, migration to tf2

@PeteBlackerThe3rd: made the edit you suggested though got a set of errors, as listed in my latest edit :(

2018-08-25 01:59:08 -0500 received badge  Notable Question (source)
2018-08-24 22:18:11 -0500 edited question Setting up your robot using tf, migration to tf2

Setting up your robot using tf, migration to tf2 Hi all, I am following the tutorial from this link here: http://wiki.

2018-08-24 22:18:11 -0500 received badge  Editor (source)
2018-08-24 22:13:21 -0500 commented question Setting up your robot using tf, migration to tf2

@PeteBlackerThe3rd: did the updates you suggested tho am still getting an error :\ Not sure what I'm doing wrong. Edited

2018-08-24 22:11:57 -0500 commented question Setting up your robot using tf, migration to tf2

@gvdhoorn: ah ok sorry about that

2018-08-24 03:07:04 -0500 received badge  Popular Question (source)
2018-08-23 21:19:20 -0500 edited answer Setting up your robot using tf, migration to tf2

Followed ur suggestions and changed the code. However I am getting errors :( Listed the errors below - /home/gavin/ca

2018-08-23 21:10:36 -0500 answered a question Setting up your robot using tf, migration to tf2

Followed ur suggestions and changed the code. However I am getting errors :( Listed the errors below - /home/gavin/ca

2018-08-23 06:14:02 -0500 asked a question Setting up your robot using tf, migration to tf2

Setting up your robot using tf, migration to tf2 Hi all, I am following the tutorial from this link here: http://wiki.