kth-ros-pkg / yumi

ROS packages pertaining to the ABB YuMi (IRB 14000) robot
BSD 2-Clause "Simplified" License
43 stars 37 forks source link

Question: Control rate of yumi_hw (RWS) interface #18

Closed lz89 closed 6 years ago

lz89 commented 6 years ago

I wonder where I can set the control rate of the RWS interface? I know the maximum is 10Hz based on the wiki. I read through the code in yumi_hw package, and find the following. The following function is called in a thread:

The sampling_rate_ is set to 0.1, but it is not being set anywhere. https://github.com/kth-ros-pkg/yumi/blob/cb56067ea661670af179c179a02dd2197442be58/yumi_hw/include/yumi_hw/yumi_hw_rws.h#L258

However, the control period in the yumi_hw_ifce_node.cpp is set to 1.0 second as shown:

https://github.com/kth-ros-pkg/yumi/blob/cb56067ea661670af179c179a02dd2197442be58/yumi_hw/src/yumi_hw_ifce_node.cpp#L129

I also saw that in the YumiRapidInterface, the spinOnce() of industrial::message_manager::MessageManager is called in each loop, as shown:

https://github.com/kth-ros-pkg/yumi/blob/cb56067ea661670af179c179a02dd2197442be58/yumi_hw/include/yumi_hw/yumi_hw_rws.h#L180

The document of industrial::message_manager::MessageManager states that:

The message manager can be run in two ways. spin(), similar to ROS this executes a blocking execution indefinitely or spinOnce(), where a single execution of the manager is performed. In spinOnce mode, other server operations can be made, but the server application must make certain to execute the spinOnce() function at a minimum rate so as not to loose connection data.

So where this minimum rate is defined/configured for YuMi, and is it 10Hz in this case?

Thank you.

diogoalmeida commented 6 years ago

@lz89 , did you find an answer to this?

lz89 commented 6 years ago

@diogoalmeida Hi, I haven't found the answer yet. Hope Yoshua could give some hints. Thanks!

diogoalmeida commented 6 years ago

Ok, @YoshuaNava is informed. Issue is that since we actually don't use RWS in our systems, it might be hard to come up with a straightforward answer. Maybe @jontje can help?

jontje commented 6 years ago

Unfortunately I am not familiar with how the RWS interaction has been set up in this code. The sampling_rate_ appears to have more to do with the ROS side of things, rather than the robot controller side.

YoshuaNava commented 6 years ago

@diogoalmeida, @lz89, @jontje

Period declaration: This variable is there for the sake of having a ROS duration object that we can use for estimating the time that has passed between loops. https://github.com/kth-ros-pkg/yumi/blob/cb56067ea661670af179c179a02dd2197442be58/yumi_hw/src/yumi_hw_ifce_node.cpp#L129

We end up using that inter-loop duration to estimate the joint velocities (which are not given by EGM), with exponential smoothing in: https://github.com/kth-ros-pkg/yumi/blob/cb56067ea661670af179c179a02dd2197442be58/yumi_hw/src/yumi_hw_egm.cpp#L473 https://github.com/kth-ros-pkg/yumi/blob/cb56067ea661670af179c179a02dd2197442be58/yumi_hw/include/yumi_hw/yumi_hw_rws.h#L316

Sampling rate This part of the code comes from the original Orebro branch. I think it's there just for consistency, so that the assumed sampling time can always be retrieved in the program. https://github.com/kth-ros-pkg/yumi/blob/cb56067ea661670af179c179a02dd2197442be58/yumi_hw/include/yumi_hw/yumi_hw_rws.h#L258

RWS or EGM control period If at any moment you want to check the duration of the control loop, just subscribe to the topic /yumi/egm_control_period (As this works for both RWS and EGM, we will rename the topic as '/yumi/control_period' in our next update)

diogoalmeida commented 6 years ago

Closing this as it seems dead.