Robotics StackExchange | Archived questions

I need your advice, please (planar laser to 3D using encoder)

Hello everyone,

I am using Neato XV-11 Lidar with getSurreal Lidar Controller v1.2 (Teensy 2.0). I have an Intel Edison (Flashed with Emutex's Ubilinux), and I am trying (unsuccessfully, but that's not the issue. though, tips are appreciated) to install roscomm using http://wiki.jigsawrenaissance.org/ROSon_RaspberryPi .I want to have the laser spinning (2D), have a motor spin the laser on another axis to get 3D reading and use an encoder to read the angle on the second axis which the laster is spinning.

I want to connect the encoder directly to the teensy (Should it go directly to Edison? my concern is latency) and use this Encoder library https://www.pjrc.com/teensy/td_libs_Encoder.html to grab the information from the encoder, then implement odometry using tf in order to create a point cloud.

I already have laserassembler working, and have the laserscan put into a buffer for 5 seconds, then have a point cloud published for rviz to read (done via a tutorial, don't have a link. you might know of it). But, of course, this just shows a point cloud of the "same" map stacked onto itself a few different times because I have no rotation being published (terminology problem?).

What do I need in order to get the information from the second axis of rotation into the point cloud? I envision the laser taking about 5 seconds to make a full turn on the second axis, then having the 3D point cloud published every 5 seconds.

I am sure there are a million holes in my plan, but that's why I come to the experts here at ROS. I'm new (+- 4 weeks) to ROS but have been studying ~40 hours a week to get this thing going. I have done the tf, catkin, and other tutorials from ROS so I do have a Beginner-Intermediate understanding of what's going on. I appreciate any tips, suggestions as to any part of my plan, or idea in general. Thank you in advance

EDIT (6/20/2016): After a lot of struggling, I am not much further. I have been messing with lasergeometry, and laserassembler all day, trying to figure out how to even get a transform that can modify my point cloud Z values. I haven't figured it out. I've tried to create a TF, but didn't fully understand how. Here is my current launch file:

    <launch>
  <node pkg="xv_11_laser_driver" type="neato_laser_publisher" name="xv_11_node">
    <param name="port" value="/dev/ttyACM0"/>
    <param name="firmware_version" value="2"/>
    <param name="frame_id" value="laser"/>
  </node>
  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0 0 0.0 /map /odom 10"/>
  <node pkg="tf" type="static_transform_publisher" name="odom_to_baselink" args="0.0 0.0 0.0 0 0 0.0 /odom /base_link 10"/>
  <node pkg="tf" type="static_transform_publisher" name="baselink_to_laser" args="0 0 0 0 0 0 /base_link /laser 10"/>




 <node pkg="laser_assembler" type="laser_scan_assembler" output="screen"  name="laser_scan_assembler">
    <param name="max_scans" type="int" value="900" />
    <param name="fixed_frame" type="string" value="laser" />
    <param name="ignore_laser_skew" type="string" value="false" />
  </node>



 <node pkg="laser_assembler" type="periodic_snapshotter" output="screen" name="periodic_snapshotter" />
<node pkg="laser_assembler" type="3dtilt" output="screen" name="tiltme" />

</launch>

It does allow me yo see odometry in rviz, and at one point I had modified the file 3dtilt.cpp to change the odometry values. I saw the odometry arrow move around, but it didnt affect the laser scan data in any way. Here is the 3dtilt.cpp, its from a tutorial:

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

int main(int argc, char** argv){
  ros::init(argc, argv, "odometry_publisher");

  ros::NodeHandle n;
  ros::Publisher odom_pub = n.advertise<nav_msgs::Odometry>("odom", 50);
  tf::TransformBroadcaster odom_broadcaster;

  double x = 1.0;
  double y = 0.0;
  double th = 0.0;

  double vx = 1.0;
  double vy = 0.0;
  double vth = 0.5;

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

  ros::Rate r(1.0);
  while(n.ok()){

    ros::spinOnce();               // check for incoming messages
    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_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
    geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(th);

    //first, we'll publish the transform over tf
    geometry_msgs::TransformStamped odom_trans;
    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;

    //send the transform
    odom_broadcaster.sendTransform(odom_trans);

    //next, we'll publish the odometry message over ROS
    nav_msgs::Odometry odom;
    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 = 2.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;
    r.sleep();
  }
}

Please help me :(

Asked by ateator on 2016-06-17 10:26:50 UTC

Comments

have now successfully used odometry_publisher to add and simulate odometry changes (movement) in X Y and Z planes. Unfortunately, this does not affect my periodic_snapshotter, thus the point cloud and laserscan data stays the same. Please help!

Asked by ateator on 2016-06-21 15:19:15 UTC

So, sometimes I can see the points that are being updated being rotated for just second and then erased again. I am wondering if this is due to a frame issue. I've read about the fixed world frame vs the moving base_frame (base_link?). I thought it could be an rviz issue, but it is un-recreateable

Asked by ateator on 2016-06-21 15:38:11 UTC

Answers