amcl not refresh particle [closed]

asked 2013-09-25 22:37:09 -0500

katsumoto gravatar image

Hi, I am trying to implement amcl on laser sensör. However, car just can't localize itself. I created map with hector. Where is my fault?

thanks.

My launc file:

<launch>

<node pkg="map_server" type="map_server" name="map" args="/home/akay/launch_file/test.yaml" />

<node pkg="LMS1xx" type="LMS100" name="LIDAR" output="screen" args="_host:=192.168.0.113" />

<node pkg="test" type="encoder" name="odom" output="screen"/> 

    <node pkg="tf" type="static_transform_publisher" name="Laser_Car_Transform" args="0 0 0 0 0 0 /base_link /laser 100" />

<node pkg="tf" type="static_transform_publisher" name="Odom_Transform" args="0 0 0 0 0 0 /odom /base_link 100" />   

<node pkg="amcl" type="amcl" name="AMCL" output="screen">
           <!-- Overall filter parameters -->
    <param name="min_particles" value="500"/>
    <param name="max_particles" value="5000"/>
    <param name="kld_err" value="0.05"/>
    <param name="kld_z" value="0.99"/>
    <param name="update_min_d" value="0.2"/>
    <param name="update_min_a" value="0.2"/>
    <param name="resample_interval" value="1"/>
    <param name="transform_tolerance" value="0.2"/>
    <param name="recovery_alpha_slow" value="0.0"/>
    <param name="recovery_alpha_fast" value="0.0"/>
    <param name="gui_publish_rate" value="10.0"/>

    <param name="odom_frame_id" value="odom"/>
</node>

    <node pkg="rviz" type="rviz" name="RVIZ" output="screen" />

</launch>

My Odometry Class:

void odometre(ros::Publisher &odom_pub, geometry_msgs::Vector3 msg,
    ros::Time current_time, ros::Time last_time) {

//aracin hız ve heading bilgisi set ediliyor.
double vx = msg.x;
double vy = msg.y;
double vth = msg.z;

//  Odometry Transform Publisher
geometry_msgs::TransformStamped odom_trans;
tf::TransformBroadcaster odom_broadcaster;

//  Odometry Message
nav_msgs::Odometry odom;

//  Odometry Quaternion
geometry_msgs::Quaternion odom_quat;

current_time = ros::Time::now();

//compute odometry in a typical way given the velocities of the robot
double dt = (current_time - last_time).toSec();
//double delta_x = (vx * cos(th) - vy * sin(th)) ; //* dt;
//double delta_y = (vx * sin(th) + vy * cos(th)) ; // * dt;

double delta_x = vx * cos(th); //* dt;
double delta_y = vx * sin(th); // * dt;
double delta_th = vth; // * dt;

x += delta_x;
y += delta_y;
th += delta_th;

//since all odometry is 6DOF we'll need a quaternion created from yaw
odom_quat = tf::createQuaternionMsgFromYaw(th);

//***************************************************//
//  Odometri Transform Yayını

odom_trans.header.stamp = current_time;
odom_trans.header.frame_id = "odom";
odom_trans.child_frame_id = "base_link";

odom_trans.transform.translation.x = x;
odom_trans.transform.translation.y = y;
odom_trans.transform.translation.z = 0.0;
odom_trans.transform.rotation = odom_quat;

// Transformu yayınla
odom_broadcaster.sendTransform(odom_trans);

//***************************************************//
// Odometry Topic Yayını

odom.header.stamp = current_time;
odom.header.frame_id = "odom";

//set the position
odom.pose.pose.position.x = x;
odom.pose.pose.position.y = y;
odom.pose.pose.position.z = 0.0;
odom.pose.pose.orientation = odom_quat;

//set the velocity
odom.child_frame_id = "base_link";
odom.twist.twist.linear.x = vx;
odom.twist.twist.linear.y = vy;
odom.twist.twist.angular.z = vth;

//publish the message
odom_pub.publish(odom);

last_time = current_time;

}

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2016-08-08 00:33:19.713263