Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pr2eus_tutorials] fix pr2_tabletop.launch for remote PC #459

Merged
merged 25 commits into from
Nov 19, 2021

Conversation

shmpwk
Copy link
Contributor

@shmpwk shmpwk commented May 18, 2021

This PR is intended to reduce the bandwidth.
It compresses prosilica image, rgb image, depth image and point cloud
in the pr2eus_tutorials.

@shmpwk shmpwk changed the title compress images and points [pr2eus_tutorials] add pr2_tabletop_remote.launch for remote PC Jun 17, 2021
Copy link
Member

@708yamaguchi 708yamaguchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shmpwk

Thank you very much for your work!

How about integrating pr2_tabletop_remote.launch into pr2_tabletop.launch?

<launch>
  <arg name="remote" default="false" />
  ...
</launch>

Then, write to README.md about the remote option.
https://github.com/jsk-ros-pkg/jsk_pr2eus/tree/master/pr2eus_tutorials#using-a-real-robot

Then, I will check this launch on real robot.

@shmpwk
Copy link
Contributor Author

shmpwk commented Jul 21, 2021

Thank you for your advice! So like this? I'm not sure the grammer "unless" and "if".

@708yamaguchi
Copy link
Member

Yes, nice.
You can see the overview of if and unless attributes here.
https://answers.ros.org/question/208696/conditional-remap/

I think we can use <group> tag for following lines.

<group if=$(arg remote)>
 ...
</group>

https://github.com/jsk-ros-pkg/jsk_pr2eus/pull/459/files#diff-36099b04ef7b0fe95ec8ace80185317d01dfa265f637614eb64819bb0f7baa57R51-R66

As another point, I found that we may need to prepare pr2_tabletop.rviz and pr2_tabletop_remote.rviz because image and pointcloud names are different if we use remote arg.

@shmpwk
Copy link
Contributor Author

shmpwk commented Jul 21, 2021

Thank you for your comment.
I add <group> tag and rviz for remote PC.
I don't confirm it works until end of this week, sorry.

@708yamaguchi
Copy link
Member

OK, at last, please update README.md and remove pr2_tabletop_remote.launch

@shmpwk
Copy link
Contributor Author

shmpwk commented Jul 21, 2021

OK done.

@708yamaguchi
Copy link
Member

Could you also write your remote usage here?

If you try using compressed topic from the real PR2,
\```
# on local machine
roslaunch pr2eus_tutorials pr2_tabletop.launch remote:=true
\```

https://github.com/jsk-ros-pkg/jsk_pr2eus/tree/master/pr2eus_tutorials#using-a-real-robot

Then, I think this PR is perfect.

I will check this PR today.

@@ -5,11 +5,25 @@
<arg name="manager" default="pr2_tabletop_object_detector_nodelet_manager"/>
<arg name="machine" default="c2" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use this launch file from remote, machine is localhost?

Copy link
Contributor Author

@shmpwk shmpwk Jul 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix with 791eb86

<arg name="PROSILICA_IMAGE" value="/prosilica/image_raw" />
<arg name="PROSILICA_IMAGE_REMOTE" value="/prosilica_remote/image_raw" />
<arg name="POINT_CLOUD" value="/kinect_head/depth_registered/throttled/points" />
<arg name="POINT_CLOUD_REMOTE" value="/kinect_head_remote/depth_registered/points" />

<include file="$(find pr2_machine)/$(env ROBOT).machine" unless="$(arg load_machine)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need this line if we use remote?

Copy link
Contributor Author

@shmpwk shmpwk Jul 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, you mean summing up remote topics and the other topics with <group> tag is more readable ?

Copy link
Contributor Author

@shmpwk shmpwk Jul 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you mention <include file="$(find pr2_machine)/$(env ROBOT).machine" unless="$(arg load_machine)" /> ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you mention ?

Yes, I mention this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fix by 791eb86

machine="$(arg machine)">
<remap from="~points" to="/kinect_head/depth_registered/throttled/points" />
<remap from="~point" to="/kinect_head/rgb/throttled/image_rect_color/screenpoint" />
<group if="$(arg remote)">
Copy link
Member

@708yamaguchi 708yamaguchi Jul 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think <group if="$(arg remote)"> should include xxx_decompress nodes and depth_image_proc nodes, not screenpoint.

Copy link
Contributor Author

@shmpwk shmpwk Jul 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a mess!!! Fix with 7fbc86e and 7fda6c2

</group>

<node name="prosilica_decompress" pkg="image_transport" type="republish"
args="compressed in:=$(arg PROSILICA_IMAGE) out:=$(arg PROSILICA_IMAGE_REMOTE)" />
Copy link
Member

@708yamaguchi 708yamaguchi Jul 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@shmpwk shmpwk Jul 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review. You mean using remap tag enables more readable ? Putting them together with args is not formal ?

Copy link
Member

@708yamaguchi 708yamaguchi Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean using remap tag enables more readable ? Putting them together with args is not formal ?

Yes, I think using remap tag is readable and easy to understand.

args can do many roles (e.g. rosparam, remap, special keys, ...).
So I think using specific tag is easy to understand.
https://wiki.ros.org/Remapping%20Arguments

Copy link
Contributor Author

@shmpwk shmpwk Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thank you for the reference. Fix with 78880de

<node name="prosilica_decompress" pkg="image_transport" type="republish"
args="compressed in:=$(arg PROSILICA_IMAGE) out:=$(arg PROSILICA_IMAGE_REMOTE)" />
<node name="rgb_decompress" pkg="image_transport" type="republish"
args="compressed in:=$(arg RGB_IMAGE) out:=$(arg RGB_IMAGE_REMOTE)" />
Copy link
Member

@708yamaguchi 708yamaguchi Jul 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix by 78880de

<node name="rgb_decompress" pkg="image_transport" type="republish"
args="compressed in:=$(arg RGB_IMAGE) out:=$(arg RGB_IMAGE_REMOTE)" />
<node name="depth_decompress" pkg="image_transport" type="republish"
args="compressedDepth in:=$(arg DEPTH_IMAGE) out:=$(arg DEPTH_IMAGE_REMOTE)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix by 78880de

<arg name="PROSILICA_IMAGE" value="/prosilica/image_raw" />
<arg name="PROSILICA_IMAGE_REMOTE" value="/prosilica_remote/image_raw" />
<arg name="POINT_CLOUD" value="/kinect_head/depth_registered/throttled/points" />
<arg name="POINT_CLOUD_REMOTE" value="/kinect_head_remote/depth_registered/points" />
Copy link
Member

@708yamaguchi 708yamaguchi Jul 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use kinect_head and kinect_head_remote many times, you can use tag
(If you do not like the group tag, I think it's ok not to use the group tag)

example:
https://github.com/jsk-ros-pkg/jsk_recognition/blob/master/jsk_pcl_ros/launch/openni2_remote.launch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you.

Copy link
Contributor Author

@shmpwk shmpwk Jul 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix with 8183683

@shmpwk
Copy link
Contributor Author

shmpwk commented Jul 26, 2021

Thank you for thorough review @708yamaguchi -san, I fixed code you mentioned. I will confirm it works with real PR2 this week end. Please wait for a while.

Comment on lines 7 to 10
<arg name="load_machine" default="false" unless="$(arg remote)" />
<arg name="load_machine" default="true" if="$(arg remote)" />
<arg name="machine" default="c2" unless="$(arg remote)" />
<arg name="machine" default="localhost" if="$(arg remote)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default -> value

Copy link
Contributor Author

@shmpwk shmpwk Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review.
Fix with 391e0bd

Copy link
Contributor Author

@shmpwk shmpwk Jul 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr2_tabletop.launch is called by pr2_tabletop_sim.launch which is gazebo simulator tabletop tutorial. So I've changed the code back from value to default. ( 408fcec )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is because you add remote arg in this PR.
in that case, you should change pr2_tabletop_sim.launch to use remote arg.
otherwise, machine arg and remote arg will conflict, which may be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect not.
When I execute pr2_tabletop_sim.launch, machine arg and remote arg aren't conflicted.
This is because machine arg in pr2_tabletop.launch is always overwritten by that in pr2_tabletop_sim.launch no matter which machine arg is.
Also, settingremote arg true in pr2_tabletop_sim.launch might makes users confused since remote access is not related to gazebo simulation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そういう意味ではなく,ややこしいのでremoteを追加するんだったら,そちらに統一,そうじゃないのであればmachineを使う,という風に統一してください.
あとの人がこんがらがるので.

Copy link
Contributor Author

@shmpwk shmpwk Aug 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr2_tabletop_sim.launch から pr2_tabletop.launch を呼び出すときに,remote arg を true にして良いということでしょうか.
その場合,procilica, rgb, depth をdecompress してpointcloudを再構成しますでしょうか.
私としては,pr2_tabletop_sim.launch では,machine arg を localhostに,load_machine arg を true にするという意味では,ご指摘なさった部分は,remote arg が true となるのですが,
procilica, rgb, depth をdecompress してpointcloudを再構成する必要性はないと思っており,この意味ではremote arg は false に相当すると考えています.
その場合,remote arg とは別に,use_sim arg を新たに作って場合分けするべきでしょうか.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knorth55 さんに修正して頂き,use_sim ではなくsim arg を新たに作って場合わけをすることになりました.

@shmpwk
Copy link
Contributor Author

shmpwk commented Jul 31, 2021

I confirmed it works with real PR2 both via ssh and on remote PC.
Following the pr2eus_tutorials, I also confirmed that by clicking object on rviz or on image_view2, PR2 tries to pick up an object.

<arg name="PROSILICA_IMAGE" value="/prosilica/image_raw" />
<arg name="PROSILICA_IMAGE_REMOTE" value="/prosilica_remote/image_raw" />
<arg name="POINT_CLOUD" value="/$(arg camera_name)/depth_registered/throttled/points" />
<arg name="POINT_CLOUD_REMOTE" value="/$(arg camera_name)_remote/depth_registered/points" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<arg name="DEPTH_IMAGE" value="/$(arg camera_name)/depth_registered/image_rect" />

should be

<arg name="DEPTH_IMAGE" value="/$(arg camera_name)/depth_registered/throttled/image_rect" />

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you.
Fix by bc63138 .

@708yamaguchi
Copy link
Member

I left 1 comment, but this PR works nicely with ssh mode and remote mode.

Thank you for your work!

@shmpwk
Copy link
Contributor Author

shmpwk commented Aug 2, 2021

Again I confirmed it works with gazebo mode, ssh mode and remote mode.

Comment on lines 7 to 10
<arg name="load_machine" default="false" unless="$(arg remote)" />
<arg name="load_machine" default="true" if="$(arg remote)" />
<arg name="machine" default="c2" unless="$(arg remote)" />
<arg name="machine" default="localhost" if="$(arg remote)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is because you add remote arg in this PR.
in that case, you should change pr2_tabletop_sim.launch to use remote arg.
otherwise, machine arg and remote arg will conflict, which may be confusing.

@shmpwk
Copy link
Contributor Author

shmpwk commented Aug 2, 2021

Thank you for the thorough revise @knorth55.
By 812bf41 , args have first been classified in detail.
I confirmed the revised program works well with gazebo mode, ssh mode and remote mode.

<arg name="PROSILICA_IMAGE_REMOTE" value="/prosilica_remote/image_raw" />
<arg name="POINT_CLOUD" value="/$(arg camera_name)/depth_registered/throttled/points" />
<arg name="POINT_CLOUD_REMOTE" value="/$(arg camera_name)_remote/depth_registered/points" />
<arg name="robot" value="$(optenv ROBOT sim)" if="$(eval arg('remote') or arg('sim'))" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use eval arg, but eval can be used in kinetic or newer.
http://wiki.ros.org/roslaunch/XML

Our PR2 is indigo, so I think we cannot use this launch file with SSH mode.
(I am sorry if my understanding is wrong)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution I only come up with is use if arg or unless arg instead of eval arg?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution I only come up with is use if arg or unless arg instead of eval arg?

I don't have any other ideas either....

By the way, do we really need load_machine arg?
If we need to use load_machine, please update README.md.

  <include file="$(find pr2_machine)/$(arg robot).machine" if="$(arg load_machine)" />

Copy link
Contributor Author

@shmpwk shmpwk Aug 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be late.

By the way, do we really need load_machine arg?

No need anymore. I deleted it by 557aa9b .

Copy link
Contributor Author

@shmpwk shmpwk Aug 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use eval arg, but eval can be used in kinetic or newer.

I change if arg or unless arg instead of eval arg by 5687bb5.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen this writing style before, but it's interesting.

I hope this PR works well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I confirmed it works well with gazebo mode, ssh mode and remote mode.

@shmpwk shmpwk changed the title [pr2eus_tutorials] add pr2_tabletop_remote.launch for remote PC [pr2eus_tutorials] fix pr2_tabletop.launch for remote PC Aug 11, 2021
@k-okada k-okada merged commit ca2d919 into jsk-ros-pkg:master Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants