Skip to content

Commit

Permalink
Merge pull request #2724 from nakane11/virtual-camera
Browse files Browse the repository at this point in the history
[jsk_perception/VirtualCameraMono] Add queue_size param
  • Loading branch information
k-okada authored Sep 8, 2022
2 parents 0de1e9a + 6dadbfb commit 9332300
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions doc/jsk_perception/nodes/virtual_camera_mono.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ Calculate perspective transformation from TF frame and apply it to the input ima

Frame ID of virtual camera used in published topics.

* `~queue_size` (Int, default: `1`)

How many messages you allow about the subscriber to keep in the queue.
This should be big when there is much difference about delay between two topics.

* `~initial_pos` (List of Float, default: `[0.7, 0.0, 0.0]`)

Initial position of virtual camera relative to `~frame_id`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace jsk_perception
tf::StampedTransform trans_; // transform to virtual camera
geometry_msgs::PolygonStamped poly_; // target polygon to transform image
int interpolation_method_;
int queue_size_;

private:

Expand Down
4 changes: 2 additions & 2 deletions jsk_perception/src/virtual_camera_mono.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace jsk_perception
pnh_->param("frame_id", trans_.frame_id_, std::string("/elevator_inside_panel"));
pnh_->param("child_frame_id", trans_.child_frame_id_, std::string("/virtual_camera_frame"));
ROS_INFO("VirutalCmaeraMono(%s) frame_id: %s, chid_frame_id: %s", ros::this_node::getName().c_str(), trans_.frame_id_.c_str(), trans_.child_frame_id_.c_str());

pnh_->param("queue_size", queue_size_, 1);
std::vector<double> initial_pos, initial_rot;
if (jsk_topic_tools::readVectorParameter(*pnh_, "initial_pos", initial_pos)) {
trans_.setOrigin(tf::Vector3(initial_pos[0], initial_pos[1], initial_pos[2]));
Expand Down Expand Up @@ -80,7 +80,7 @@ namespace jsk_perception
{
ROS_INFO("Subscribing to image topic");
it_.reset(new image_transport::ImageTransport(*nh_));
sub_ = it_->subscribeCamera("image", 1, &VirtualCameraMono::imageCb, this);
sub_ = it_->subscribeCamera("image", queue_size_, &VirtualCameraMono::imageCb, this);
ros::V_string names = boost::assign::list_of("image");
jsk_topic_tools::warnNoRemap(names);
}
Expand Down

0 comments on commit 9332300

Please sign in to comment.