-
Notifications
You must be signed in to change notification settings - Fork 89
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
Enable usage of GenericHWInterfaces inside a combined_robot_hw #49
base: noetic-devel
Are you sure you want to change the base?
Enable usage of GenericHWInterfaces inside a combined_robot_hw #49
Conversation
The new class is a pure adapter which forwards the whole RobotHW interface to an internal GenericHWInterface. It provides the interface required for combind_robot_hw usage, in particular: - A parameterless constructor, needed for dynamicly loading the HW interface - An init function with the correct RobotHW signature, which does the full GenericHWInterface initialization
This will use a combined_robot_hw to simulate an rrbot using two seperate SimHWInterfaces.
There were two issues from the discussion in #42 remaining:
|
Correctly export plugin description and sort TARGET list
|
I just added some small debug output to these functions in [...]
Loaded 'joint_state_controller'
Loaded 'position_trajectory_controller'
[ INFO] [1607972663.230785821]: prepareSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_1_hw):
[ INFO] [1607972663.230828164]: prepareSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_2_hw):
[ INFO] [1607972663.234206317]: doSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_1_hw):
[ INFO] [1607972663.234236261]: doSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_2_hw):
Started ['joint_state_controller'] successfully
[ INFO] [1607972663.237278510]: prepareSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_1_hw):
[ INFO] [1607972663.237313109]: prepareSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_2_hw):
[ INFO] [1607972663.237519892]: doSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_1_hw):
[ INFO] [1607972663.237551139]: doSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_2_hw):
Started ['position_trajectory_controller'] successfully
[...] , but building [...]
Loaded 'joint_state_controller'
Loaded 'position_trajectory_controller'
[ INFO] [1607972580.227317489]: prepareSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_1_hw):
[ INFO] [1607972580.227387877]: prepareSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_2_hw):
[ INFO] [1607972580.230209118]: doSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_1_hw):
[ INFO] [1607972580.230268160]: doSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_2_hw):
Started ['joint_state_controller'] successfully
[ INFO] [1607972580.234556711]: prepareSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_1_hw):
[ INFO] [1607972580.234610032]: + position_trajectory_controller
[ INFO] [1607972580.234680437]: prepareSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_2_hw):
[ INFO] [1607972580.234709043]: + position_trajectory_controller
[ INFO] [1607972580.236852555]: doSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_1_hw):
[ INFO] [1607972580.236889973]: + position_trajectory_controller
[ INFO] [1607972580.236938568]: doSwitch (nh: /rrbot/rrbot_combined_hardware_interface/joint_2_hw):
[ INFO] [1607972580.236963784]: + position_trajectory_controller
Started ['position_trajectory_controller'] successfully
[...] can you verify again that
I don't doubt you did this correctly, i am just really confused as to what else could cause this problem. If this problem persists, there should be a workaround: Changing the registerInterface(adapted_hw_interface_->get<hardware_interface::JointStateInterface>());
registerInterface(adapted_hw_interface_->get<hardware_interface::PositionJointInterface>());
registerInterface(adapted_hw_interface_->get<hardware_interface::VelocityJointInterface>());
registerInterface(adapted_hw_interface_->get<hardware_interface::EffortJointInterface>()); does this work for you? As for the naming: That's kind of clever, i might just steal that in future projects... |
Maybe there is a bit of an misunderstanding here as my results are similar to yours. The funcitons <node name="ros_control_controller_manager" pkg="controller_manager" type="controller_manager" respawn="false" output="screen"
args="spawn position_trajectory_controller joint_state_controller" /> Gives: Loaded 'position_trajectory_controller'
Loaded 'joint_state_controller'
[ INFO] [1608049123.583915146]: prepareSwitch start_list size: 1
[ INFO] [1608049123.584019505]: prepareSwitch start_list size: 0
[ INFO] [1608049123.584666694]: doSwitch start_list size: 1
[ INFO] [1608049123.584742755]: doSwitch start_list size: 0
Started ['position_trajectory_controller'] successfully
[ INFO] [1608049123.592145302]: prepareSwitch start_list size: 0
[ INFO] [1608049123.592213115]: prepareSwitch start_list size: 0
[ INFO] [1608049123.594641366]: doSwitch start_list size: 0
[ INFO] [1608049123.594706177]: doSwitch start_list size: 0
Started ['joint_state_controller'] successfully Swapping the order as: <node name="ros_control_controller_manager" pkg="controller_manager" type="controller_manager" respawn="false" output="screen"
args="spawn joint_state_controller position_trajectory_controller" /> leads to: Loaded 'joint_state_controller'
Loaded 'position_trajectory_controller'
[ INFO] [1608049530.806072379]: prepareSwitch start_list size: 0
[ INFO] [1608049530.806140649]: prepareSwitch start_list size: 0
[ INFO] [1608049530.809190649]: doSwitch start_list size: 0
[ INFO] [1608049530.809245116]: doSwitch start_list size: 0
Started ['joint_state_controller'] successfully
[ INFO] [1608049530.812512765]: prepareSwitch start_list size: 1
[ INFO] [1608049530.812562018]: prepareSwitch start_list size: 0
[ INFO] [1608049530.815827487]: doSwitch start_list size: 1
[ INFO] [1608049530.815880670]: doSwitch start_list size: 0 In my setup I have stored the controller yamls separately for the robots. Thus, I multiple controllers instead of a single one. Splitting up the controller for the rrbot and spawning them via: <node name="ros_control_controller_manager" pkg="controller_manager" type="controller_manager" respawn="false" output="screen"
args="spawn position_trajectory_controller_1 position_trajectory_controller_2 joint_state_controller" /> leads to: Loaded 'position_trajectory_controller_1'
Loaded 'position_trajectory_controller_2'
Loaded 'joint_state_controller'
[ INFO] [1608049761.242010679]: prepareSwitch start_list size: 1
[ INFO] [1608049761.242089090]: prepareSwitch start_list size: 0
[ INFO] [1608049761.245403474]: doSwitch start_list size: 1
[ INFO] [1608049761.245460553]: doSwitch start_list size: 0
Started ['position_trajectory_controller_1'] successfully
[ INFO] [1608049761.250531467]: prepareSwitch start_list size: 0
[ INFO] [1608049761.250588287]: prepareSwitch start_list size: 1
[ INFO] [1608049761.251965187]: doSwitch start_list size: 0
[ INFO] [1608049761.252011527]: doSwitch start_list size: 1
Started ['position_trajectory_controller_2'] successfully
[ INFO] [1608049761.255328591]: prepareSwitch start_list size: 0
[ INFO] [1608049761.255378649]: prepareSwitch start_list size: 0
[ INFO] [1608049761.258653497]: doSwitch start_list size: 0
[ INFO] [1608049761.258698951]: doSwitch start_list size: 0
Started ['joint_state_controller'] successfully Which is similar to what I got for my setup earlier. |
Ah now i understand the problem. The specific issue we see in every example is that the starting procedure calls In both of these functions,
This is obviously inconsistent with the normal behavior, as a I will open an issue in In any case, i don't think this issue should block further development/merging of this feature, as the issue is in |
Well i huddled up some of the specifics in the explanation: The controllers get handles to interfaces that claim resources ( |
Thanks for the explanation, now I understand the underlying issue. |
This creates an adapter class for
GenericHWInterfaces
which allows usage inside acombined_robot_hw
. This adapter is then used to exportSimHWInterface
.For demonstration, an additional rrbot demo is created. While creating this, some restructuring of
rrbot_control
was needed, which should reflect its function more clearly.This starts as a draft, as i want to add more documentation and explore the possibility of a "generic"
combined_robot_hw_runner
node (or similar) inros_control_boilerplate
.Fixes #34. Continuation of #42.