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

Add urdftest to ros2 control #31

Merged

Conversation

gwalck
Copy link

@gwalck gwalck commented May 30, 2023

Added a test ensuring the TCP (tool0) is resolved correctly using TF. If a URDF is mal-formed (example mismatch of joint_names between base robot and ros2_control), the joint_state would be wrong and the Robot State Publisher would then not be capable of creating all TF.

This addition was tricky as tf listener in python is known to have some issues with spinning its thread see 1, 2

gwalck added 2 commits May 30, 2023 20:27
Due to many robots with tip at various poses,
the test verifies only if the tool0 frame
can be resolved and is non-null
With the listener within the main class,
strange wait_for_message issues arise
@gwalck gwalck requested a review from muritane May 30, 2023 20:28
@destogl
Copy link
Member

destogl commented Jun 1, 2023

I get this error when testing this:

<testsuite name="kuka_ros2_control_support.ros2_control_support.launch_tests[description_package=kuka_kr10_support description_macro_file=kr10r1100sixx_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" tests="5" failures="0" errors="1" skipped="0" time="4.117"><testcase classname="kuka_ros2_control_support.RobotDriverTest" name="test_joint_state_msg_retrieval[description_package=kuka_kr10_support description_macro_file=kr10r1100sixx_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" time="1.006" /><testcase classname="kuka_ros2_control_support.RobotDriverTest" name="test_node_started[description_package=kuka_kr10_support description_macro_file=kr10r1100sixx_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" time="0.002" /><testcase classname="kuka_ros2_control_support.RobotDriverTest" name="test_tcp_tf[description_package=kuka_kr10_support description_macro_file=kr10r1100sixx_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" time="0.065" /><testcase classname="kuka_ros2_control_support.RobotDriverTest" name="test_trajectory_following[description_package=kuka_kr10_support description_macro_file=kr10r1100sixx_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" time="3.001"><error message="Traceback (most recent call last):&#10;  File &quot;/home/deniss/workspace/ros_industrial/kuka_robots_tests/src/kuka_experimental/kuka_ros2_control_support/test/ros2_control_support.py&quot;, line 288, in test_trajectory_following&#10;    joint_states = get_joint_states_from_trajectory_state()&#10;  File &quot;/home/deniss/workspace/ros_industrial/kuka_robots_tests/src/kuka_experimental/kuka_ros2_control_support/test/ros2_control_support.py&quot;, line 285, in get_joint_states_from_trajectory_state&#10;    return dict(zip(msg.joint_names, msg.actual.positions))&#10;AttributeError: 'NoneType' object has no attribute 'joint_names'&#10;" /></testcase><testcase classname="kuka_ros2_control_support.RobotDriverTest" name="test_trajectory_state_retrieval[description_package=kuka_kr10_support description_macro_file=kr10r1100sixx_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" time="0.042" /></testsuite><testsuite name="kuka_ros2_control_support.ros2_control_support.launch_tests[description_package=kuka_kr10_support description_macro_file=kr10r1420_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" tests="5" failures="0" errors="0" skipped="0" time="3.268"><testcase classname="kuka_ros2_control_support.RobotDriverTest" name="test_joint_state_msg_retrieval[description_package=kuka_kr10_support description_macro_file=kr10r1420_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" time="0.596" /><testcase classname="kuka_ros2_control_support.RobotDriverTest" name="test_node_started[description_package=kuka_kr10_support description_macro_file=kr10r1420_macro.xacro controllers_file=kuka_6dof_controllers.yaml initial_positions_file=initial_positions.yaml]" time="0.002" />

It seems there is still some NoneType issue or for the given robot type the setup is not correct.

kuka_robots_tests/src/kuka_experimental/kuka_ros2_control_support/test/ros2_control_support.py", line 285, in get_joint_states_from_trajectory_state return dict(zip(msg.joint_names, msg.actual.positions)) AttributeError: 'NoneType' object has no attribute 'joint_names' " />

@gwalck
Copy link
Author

gwalck commented Jun 1, 2023

That is annoying. I spend hours already on that, and thought I had solved it. This problem occurs when some message is not received properly by rclpy low-level middleware stuff. I think we are facing some non-atomic operations or so, due to threading.
I cannot explaning otherwise, because without the threading of tf_listener this test never fails, and what I added should not alter the other tests. A solution to the problem would be to create a second pytest file independent of the other one (not as a subtest of a single pytest file)

@gwalck
Copy link
Author

gwalck commented Jun 1, 2023

I cannot reproduce this on my side, but noticed there was a missing line (as compared to typical way executors are used and how the tf_listener test is done upstream ) so could you retry again ?

@destogl destogl merged commit 4d370a1 into ros2_control_support_package_added Jun 4, 2023
@destogl destogl deleted the add-urdftest-to-ros2-control branch June 4, 2023 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants