Closed franmore-urjc closed 1 month ago
The size has already been changed to meters. We will consider the alternative functions
Nice improvement @franmore-urjc !. Definitely old parse_laser_data
function was outdated and now makes no sense, the same with laser_vector
. Let's go with the improved parse_laser_data
:-).
Fixed in #2733
The problem:
In the documentation for this exercise (and probably others, I didn't check them all), a couple of functions are proposed:
parse_laser_data(laser_data)
andlaser_vector(laser)
. However, there is zero documentation in that section about what they do. Also, the API says that the laser data is in millimeters, but it seems to be in meters (unless the house is ant-size). These are the snippets in question:and
Moreover, the code snippets make no sense, as in the first the conversion is not adjusting the angle offset (to center the angle at the front of the robot), and the second function is extracting the mean of all the laser values, instead of returning a list of (x,y) coordinates (assuming that is the purpose of the function, which is not clear because there is no text in that section and there are no comments in the function), so they are not usable as they are.
Possible solutions
It would be nice to provide a "parse" function that converts the raw LaserData object that is received by HAL into a list with more useful information, like a list of (distance, angle) tuples or a list of (x, y) values. I propose something like this, and then let the user choose or tweak the function to their needs, but hoping that he/she understands the format of the input data and the conversions that this function is doing:
Option 1:
This way, the laser's format and the reference system are documented, and it should be easier for the users to convert the laser data to whatever format they need. If you also want to put a small image with the reference system, then even better than my sad comment with the x,y axes.
Option 2:
Another alternative, if you wish to keep the previous
parse_laser_data
andlaser_vector
functions separated, is to at least improve them with these comments, and fixing the transformation.If you think this is a good idea, feel free to adjust the code and comments as much as you like and update the docs. If, however, this is providing too much info to the users and "solving" part of the exercise, at least please remove the current code snippets, because they are misleading.