-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,16 @@ namespace depthimage_to_laserscan | |
* | ||
*/ | ||
void set_scan_height(const int scan_height); | ||
|
||
/** | ||
* Sets the row to use as a center in the output LaserScan. | ||
* | ||
* SKIP IT FIRST, WILL WRITE IT LATER | ||
This comment has been minimized.
Sorry, something went wrong.
damienjadeduff
|
||
* | ||
* @param scan_offset I WILL WRITE IT LATER | ||
* | ||
*/ | ||
void set_scan_offset(const float scan_offset); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
imaduddinamajid
Author
Owner
|
||
|
||
/** | ||
* Sets the frame_id for the output LaserScan. | ||
|
@@ -168,7 +178,7 @@ namespace depthimage_to_laserscan | |
*/ | ||
template<typename T> | ||
void convert(const sensor_msgs::ImageConstPtr& depth_msg, const image_geometry::PinholeCameraModel& cam_model, | ||
const sensor_msgs::LaserScanPtr& scan_msg, const int& scan_height) const{ | ||
const sensor_msgs::LaserScanPtr& scan_msg, const int& scan_height, const double& scan_offset) const{ | ||
This comment has been minimized.
Sorry, something went wrong.
damienjadeduff
|
||
// Use correct principal point from calibration | ||
float center_x = cam_model.cx(); | ||
float center_y = cam_model.cy(); | ||
|
@@ -181,7 +191,8 @@ namespace depthimage_to_laserscan | |
const T* depth_row = reinterpret_cast<const T*>(&depth_msg->data[0]); | ||
int row_step = depth_msg->step / sizeof(T); | ||
|
||
int offset = (int)(cam_model.cy()-scan_height/2); | ||
int offset = (int)((cam_model.cy()*2*scan_offset)-scan_height/2); | ||
fprintf(stderr, "offset, cam_model.cy(), scan offset, scan height: %d, %f, %f, %d\n", offset, cam_model.cy(), scan_offset, scan_height); | ||
This comment has been minimized.
Sorry, something went wrong.
damienjadeduff
|
||
depth_row += offset*row_step; // Offset to center of image | ||
|
||
for(int v = offset; v < offset+scan_height_; v++, depth_row += row_step){ | ||
|
@@ -216,6 +227,7 @@ namespace depthimage_to_laserscan | |
float range_min_; ///< Stores the current minimum range to use. | ||
float range_max_; ///< Stores the current maximum range to use. | ||
int scan_height_; ///< Number of pixel rows to use when producing a laserscan from an area. | ||
float scan_offset_; ///< Number of row being set as center of a laserscan. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
imaduddinamajid
Author
Owner
|
||
std::string output_frame_id_; ///< Output frame_id for each laserscan. This is likely NOT the camera's frame_id. | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,5 +87,6 @@ void DepthImageToLaserScanROS::reconfigureCb(depthimage_to_laserscan::DepthConfi | |
dtl_.set_scan_time(config.scan_time); | ||
dtl_.set_range_limits(config.range_min, config.range_max); | ||
dtl_.set_scan_height(config.scan_height); | ||
dtl_.set_scan_offset(config.scan_offset); | ||
This comment has been minimized.
Sorry, something went wrong.
damienjadeduff
|
||
dtl_.set_output_frame(config.output_frame_id); | ||
} |
5 comments
on commit 44320c3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My review is done. Good job. I agree with you using a float is a good idea. With a little bit of a clean up it will be ready to make a PR from but let's use it a bit first. Could you run the unit test by the way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the test using the test launch file. Am I correct?
imad@imad-Lenovo-ideapad-310-15IKB:~/robot_ws/src/depthimage_to_laserscan$ roslaunch depthimage_to_laserscan depthimage_to_laserscan.test
... logging to /home/imad/.ros/log/c8187fb0-2cc4-11e8-99ee-701ce768b8f7/roslaunch-imad-Lenovo-ideapad-310-15IKB-3659.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/imad/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.
started roslaunch server http://imad-Lenovo-ideapad-310-15IKB:43086/
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.7
NODES
/
depthimage_to_laserscan (depthimage_to_laserscan/depthimage_to_laserscan)
auto-starting new master
process[master]: started with pid [3672]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to c8187fb0-2cc4-11e8-99ee-701ce768b8f7
process[rosout-1]: started with pid [3685]
started core service [/rosout]
process[depthimage_to_laserscan-2]: started with pid [3688]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - TBH I don't know much about gtest or how it is used in ROS. I think go with that. By the way, there are PRs waiting since 2014! https://github.com/ros-perception/depthimage_to_laserscan/pulls
Also I think our method will help this guy if he does some math to figure out the exact offset necessary: ros-perception#16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I saw that issue before I started working yesterday. It made me feel more motivated since I might help him with this. :)
I have opened a PR from this branch to my indigo-devel. After you review and approve it, I will open a PR to their indigo-devel. I hope they are still active working on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes refer to the issue when you open the final PR. I will look for your PR now.
Make the whitespace consistent. It is important in big projects with lots of parameters.