How to determine the laser beam in Solution of Exercise 4.1?

Could you please tell me how you determine the laser beam index here?

// Get readings
  float right = rosbot.get_laser(121);
  float left = rosbot.get_laser(431);

It is hard to understand your point. Please provide more context.

The task is to call the get_laser(n) method, asking for the two readings that you think will delimite the wall from the left to the right.

I think the laser beam of left should be (360+180)=540
right should be 180 degree
or if we want to detect the laser beam of the wall edge, the left might be a number between 540 and 719; the right might be a number between 0 and 180.

These two lines of code from the solution of exercise 4.1.
Let me paste the code here:

#include "rosbot_control/rosbot_class.h"
#include <ros/ros.h>

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

  RosbotClass rosbot;


  // Get readings
  float right = rosbot.get_laser(121);
  float left = rosbot.get_laser(431);
  // Define and assign array values
  float array_laser[] = {left,right};
  // Print array
  ROS_INFO_STREAM("The wall is at " << array_laser[0] << " meters to the left, and at " << array_laser[1] << " meters to the right from the robot ");
  return 0;

I see.

Did you consider that the laser beam angles are with respect to the robot and not the wall? So, it depends on whether the robot is directly facing the wall as we have in the image, or not. Also, the robot’s distance from the wall would be a factor.

That, that does not mean what we have in the exercise is correct. What counts is that you are able to confirm that your reading in actually correct.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.