-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
The kinematics simulator takes around 50% of my CPU even when the program is idle (waiting at the top-level prompt).
This is because the *timer-job*
is still publishing joint states and updating the viewport at around 100Hz.
https://github.com/jsk-ros-pkg/jsk_pr2eus/blob/master/pr2eus/robot-interface.l#L257-L270
https://github.com/jsk-ros-pkg/jsk_pr2eus/blob/master/pr2eus/robot-interface.l#L351-L353
But do we need this kind of frequency when the simulator is not processing any commands?
Can we throttle this or just stop updating when there are no awaiting commands?
ref. 6192514
Activity
pazeshun commentedon Dec 22, 2022
I think publishing joint_states enables us to test some ROS nodes.
For example, when you launch kinematic simulator and play rosbag of fixed camera, you may be able to test recognition-based motion code.
If you throttle or stop publishing, you will break this feature, won't you?
Affonso-Gui commentedon Dec 22, 2022
@pazeshun
ros::spin
is needed. Since the*timer-job*
does not run when spinning (or any other form of evaluation), the idle callback can be safely throttled / removed.pazeshun commentedon Dec 23, 2022
I don't think so (at least, I'm against removing).
As you pointed out, when we type
ros::spin
or execute loop includingros::spin-once
, updating joint_states is stopped.Due to this, updating TF is also stopped and recognition nodes may come to publish no new message.
However, old messages were already published, and they can be stored in roseus subscriber queue.
So we can test the callback of these messages by typing
ros::spin*
.Also, if that callback stores the message in a variable, we can test further functions using that variable.
I think we should become careful about this.
Currently, grippers of many robots are not moved by
:angle-vector
, so we change the robot model in the kinematics simulator directly when we want to move the gripper.PR2 explicitly updates xwindow after moving its gripper but Fetch doesn't.
If we skip xwindow update in the idle callback, Fetch (and maybe many other robots) apparently cannot move its gripper in kinematics simulator.
And this type of bug (?) may exist in other than grippers.
Does what we can get by skipping the xwindow update really balance with our effort to find and fix these bugs?
Affonso-Gui commentedon Dec 23, 2022
Ultimately there likely is some kind of edge case in which this function is strictly needed (e.g. adding
ros::spin-once
to*timer-job*
), so I agree that this may not be worth changing.However, it is still sad that we are using so much computing resources to do so little.