Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Mapping with Sonar Data?

Hi All,

Had anyone had any success creating a reasonable map in ROS with just sonar and odometry data?

If so I'd like to know what map type; setup etc you used.

Currently the map is a mess (An only home brew solution works just fine) so I'm sure it must be possible.

FYI the Sonar data is being published as both Range and laser_scan message types.

Many Thanks

Mark

Mapping with Sonar Data?

Hi All,

Had anyone had any success creating a reasonable map in ROS with just sonar and odometry data?

If so I'd like to know what map type; setup etc you used.

Currently the map is a mess (An only home brew solution works just fine) so I'm sure it must be possible.

FYI the Sonar data is being published as both Range and laser_scan message types.

EDIT - Sonar Laser Code for benefit of others:

bool ToeminatorROSBridge::publishSonarAsLaserData(ros::Time time, RobotData* pRobotData) { tf::TransformBroadcaster laser_broadcaster; ros::NodeHandle n;

// Laser/Sonar Range Test
bool publish_laser = true;
n.param("publish_laser", publish_laser, publish_laser);
ros::Publisher laser_pub;

if(publish_laser) 
{
     laser_pub = n.advertise<sensor_msgs::LaserScan>("sonar_laser_scan", 1000);
}

unsigned int num_readings = 7;
double laser_frequency = 2;
//populate the LaserScan message
sensor_msgs::LaserScan scan;
   scan.header.stamp = time;
   scan.header.frame_id = "base_laser";
   scan.angle_min = -1.57;
   scan.angle_max = 1.57;
   scan.angle_increment = 3.14 / num_readings;
   scan.time_increment = (1 / laser_frequency) / (num_readings);
   scan.range_min = 0.0;
   scan.range_max = 10.0;

   scan.ranges.resize(num_readings+1);
   scan.intensities.resize(num_readings+1);

   for(int i=1; i<=7; i++)
{
    scan.ranges[i] = pRobotData->SonarMeasurements[i-1]/100.0; // Convert to Meters             
}

laser_pub.publish(scan);

laser_broadcaster.sendTransform(tf::StampedTransform(tf::Transform(tf::createQuaternionFromRPY(0, 0, degree_to_radian(ROS_FrontSonarAngle)), 
                                                                    tf::Vector3(0.0, 0.15, 0.0)),
                                                                    scan.header.stamp,
                                                                    "base_link", 
                                                                    "base_laser"));
return true;
}

Many Thanks

Mark

Mapping with Sonar Data?

Hi All,

Had anyone had any success creating a reasonable map in ROS with just sonar and odometry data?

If so I'd like to know what map type; setup etc you used.

Currently the map is a mess (An only home brew solution works just fine) so I'm sure it must be possible.

FYI the Sonar data is being published as both Range and laser_scan message types.

EDIT - Sonar Laser Code for benefit of others:

bool ToeminatorROSBridge::publishSonarAsLaserData(ros::Time time, RobotData* pRobotData)
{
 tf::TransformBroadcaster laser_broadcaster;
 ros::NodeHandle n;

n;

// Laser/Sonar Range Test
bool publish_laser = true;
n.param("publish_laser", publish_laser, publish_laser);
ros::Publisher laser_pub;

if(publish_laser) 
{
     laser_pub = n.advertise<sensor_msgs::LaserScan>("sonar_laser_scan", 1000);
}

unsigned int num_readings = 7;
double laser_frequency = 2;
//populate the LaserScan message
sensor_msgs::LaserScan scan;
   scan.header.stamp = time;
   scan.header.frame_id = "base_laser";
   scan.angle_min = -1.57;
   scan.angle_max = 1.57;
   scan.angle_increment = 3.14 / num_readings;
   scan.time_increment = (1 / laser_frequency) / (num_readings);
   scan.range_min = 0.0;
   scan.range_max = 10.0;

   scan.ranges.resize(num_readings+1);
   scan.intensities.resize(num_readings+1);

   for(int i=1; i<=7; i++)
{
    scan.ranges[i] = pRobotData->SonarMeasurements[i-1]/100.0; // Convert to Meters             
}

laser_pub.publish(scan);

laser_broadcaster.sendTransform(tf::StampedTransform(tf::Transform(tf::createQuaternionFromRPY(0, 0, degree_to_radian(ROS_FrontSonarAngle)), 
                                                                    tf::Vector3(0.0, 0.15, 0.0)),
                                                                    scan.header.stamp,
                                                                    "base_link", 
                                                                    "base_laser"));
return true;
}

Many Thanks

Mark