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 displaying error msg method to controller-action-client in robot-interface.l #460

Merged
merged 28 commits into from Oct 25, 2022

Conversation

tkmtnt7000
Copy link
Member

I added action-result-cb method to controller-action-client class in robot-interface.l to display error massages in the topic ...[depending on the robots]../follow_joint_trajectory/result. I found it good when I was running KINOVA.
This allows us to see error msg in the topic through an euslisp interpreter.
cc @708yamaguchi

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.

It works with kinova arm. (Related to jsk-ros-pkg/jsk_robot#1313 )
Looks good to me.

Copy link
Member

@Affonso-Gui Affonso-Gui left a comment

Choose a reason for hiding this comment

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

  • This should be made safer against other types of actions.
    Take a look in the :action-feedback-cb just below and notice how it verifies that the action type is correct before trying to get any values (for example pr2_controller_msgs/JointTrajectoryActionResult doesn't have :error_code)

  • Does controller-result-error-to-string needs to be defined as a global function? Is it usefull outside of this scope? If so maybe the name should be changed to something that makes more clear that it is only functional for control_msgs/FollowJointTrajectoryResult

  • Maybe also consider the more universal :status and cases in which the error-string is empty for better error formatting? When trying on the simulator with an empty goal I got status: 5, error_code: -2, error_string: ' '

k-okada added a commit to k-okada/jsk_pr2eus that referenced this pull request Nov 19, 2021
@k-okada
Copy link
Member

k-okada commented Nov 19, 2021

@708yamaguchi can you extend 73270ba to simulate actual error case?

@708yamaguchi
Copy link
Member

708yamaguchi commented Nov 22, 2021

@tkmtnt7000

Fetch's follow joint trajectory server:

Topic type

$ rostopic info /arm_controller/follow_joint_trajectory/result
Type: control_msgs/FollowJointTrajectoryActionResult

Success result

Send normal trajectory

$ rostopic echo /arm_controller/follow_joint_trajectory/result
header:
  seq: 7
  stamp:
    secs: 1637579129
    nsecs: 101318115
  frame_id: ''
status:
  goal_id:
    stamp:
      secs: 1637579124
      nsecs: 105360013
    id: "1637579124099497863_/fetch_eus_interface_1637577840428118257_6380_/arm_controller/follow_joint_trajectory_5"
  status: 3
  text: "Trajectory succeeded."
result:
  error_code: 0
  error_string: ''
---

Abort result

Send trajectory with very small time_from_start (0.1s)
The same result returned when I pushed emergency button during the normal trajectory.

rostopic echo /arm_controller/follow_joint_trajectory/result
header:
  seq: 8
  stamp:
    secs: 1637579250
    nsecs: 881366207
  frame_id: ''
status:
  goal_id:
    stamp:
      secs: 1637579250
      nsecs: 831392874
    id: "/robot_driver-3-1637579250.831392874"
  status: 4
  text: "Controller manager forced preemption."
result:
  error_code: 0
  error_string: ''
---

Preempted result

Send other goal during another trajectory

$ rostopic echo /arm_controller/follow_joint_trajectory/result
header:
  seq: 10
  stamp:
    secs: 1637579740
    nsecs: 465346321
  frame_id: ''
status:
  goal_id:
    stamp:
      secs: 1637579739
      nsecs: 460864349
    id: "/robot_driver-5-1637579739.460864349"
  status: 2
  text: "Trajectory preempted"
result:
  error_code: 0
  error_string: ''
---

test code:
https://gist.github.com/708yamaguchi/2c754cbfc1425345aceb5c3e7a66ae22

@708yamaguchi
Copy link
Member

708yamaguchi commented Nov 22, 2021

pr2' follow joint trajectory server

topic type

$ rostopic info /r_arm_controller/follow_joint_trajectory/result
Type: control_msgs/FollowJointTrajectoryActionResult

Success result

Send normal trajectory

$ rostopic echo /r_arm_controller/follow_joint_trajectory/result
header:
  seq: 13226
  stamp:
    secs: 1637584064
    nsecs: 195126159
  frame_id: ''
status:
  goal_id:
    stamp:
      secs: 1637584054
      nsecs: 224153773
    id: "1637584054187325286_/pr2_eus_interface_1637583850124161382_20332_r_arm_controller/follow_joint_trajectory_2"
  status: 3
  text: ''
result:
  error_code: 0
  error_string: ''
---

Abort result

Send trajectory with very small time_from_start (0.1s)

$ rostopic echo /r_arm_controller/follow_joint_trajectory/result

header:
  seq: 13227
  stamp:
    secs: 1637584346
    nsecs: 447756657
  frame_id: ''
status:
  goal_id:
    stamp:
      secs: 1637584345
      nsecs: 787349148
    id: "/realtime_loop-1-1637584345.787349148"
  status: 4
  text: ''
result:
  error_code: -5
  error_string: ''
---

Preempted result

Send other goal during another trajectory

$ rostopic echo /r_arm_controller/follow_joint_trajectory/result                                                                  
header:                                                                                                                           
  seq: 13230
  stamp:
    secs: 1637584476
    nsecs: 271548854
  frame_id: ''
status:
  goal_id:
    stamp:
      secs: 1637584475
      nsecs: 268636477
    id: "/realtime_loop-4-1637584475.268636477"
  status: 2
  text: ''
result:
  error_code: 0
  error_string: ''
---

test code
https://gist.github.com/708yamaguchi/a331023b0321f01d8fc9f36d7b59273a

@708yamaguchi
Copy link
Member

708yamaguchi commented Nov 22, 2021

kinova' follow joint trajectory server

topic type

$ rostopic info /arm_gen3/kinova_gen3_lite_joint_trajectory_controller/follow_joint_trajectory/result
Type: control_msgs/FollowJointTrajectoryActionResult

Success result

Send normal trajectory

$ rostopic echo /arm_gen3/kinova_gen3_lite_joint_trajectory_controller/follow_joint_trajectory/result                                                   
header:                                                                                                                                                 
  seq: 2                                                                                                                                                
  stamp:                                                                                                                                                
    secs: 1637586252                                                                                                                                    
    nsecs: 211414560                                                                                                                                    
  frame_id: ''
status:
  goal_id:
    stamp:
      secs: 1637586239
      nsecs: 876266440
    id: "1637586239878205593_/spotkinova_interface_1637586163323500035_10152_arm_gen3/kinova_gen3_lite_joint_trajectory_controller/follow_joint_trajectory_0"
  status: 3
  text: ''
result:
  error_code: 0
  error_string: ''
---

Abort result

pattern 1

$ rostopic echo /arm_gen3/kinova_gen3_lite_joint_trajectory_controller/follow_joint_trajectory/result

header:
  seq: 6
  stamp:
    secs: 1637586913
    nsecs: 991771956
  frame_id: ''
status:
  goal_id:
    stamp:
      secs: 1637586912
      nsecs: 362710512
    id: "/arm_gen3/arm_gen3_driver-3-1637586912.362710512"
  status: 4
  text: ''
result:
  error_code: -4
  error_string: "After validation, trajectory execution failed in the arm with sub error code SUB_ERROR_NONE"
---

pattern 2

$ rostopic echo /arm_gen3/kinova_gen3_lite_joint_trajectory_controller/follow_joint_trajectory/result
header: 
  seq: 7
  stamp: 
    secs: 1637586975
    nsecs:  91155403
  frame_id: ''
status: 
  goal_id: 
    stamp: 
      secs: 1637586975
      nsecs:  84985092
    id: "/arm_gen3/arm_gen3_driver-4-1637586975.84985092"
  status: 4
  text: ''
result: 
  error_code: 0
  error_string: ''
---

Preempted result

Send other goal during another trajectory
Be careful that the preempt status number for kinova is 4, while other robots show 2 when preempted.
Once this error occurs, the next time you send a normal trajectory, you will get this error instead of the normal result.

$ rostopic echo /arm_gen3/kinova_gen3_lite_joint_trajectory_controller/follow_joint_trajectory/result
header:                                                                                                                           
  seq: 13                                                                                                                         
  stamp:                                                                                                                          
    secs: 1637587168                                                                                                              
    nsecs: 782398936                                                                                                              
  frame_id: ''                                                                                                                    
status:                                                                                                                           
  goal_id:                                                                                                                        
    stamp:                                                                                                                        
      secs: 1637587168                                                                                                            
      nsecs: 773036725                                                                                                            
    id: "1637587168763316512_/spotkinova_interface_1637586163323500035_10152_arm_gen3/kinova_gen3_lite_joint_trajectory_controller/follow_joint_trajectory_4"
  status: 4
  text: ''
result:
  error_code: -4
  error_string: "Trajectory execution failed in the arm with sub error code 55\nThe speed while executing\
  \ the trajectory was too damn high and caused the robot to stop.\n"
---

test code:
https://gist.github.com/708yamaguchi/a2a982e9e9d44d356c7522376168ec6c
and kinovaeus.

@tkmtnt7000
Copy link
Member Author

@Affonso-Gui
Thank you very much for advice.

  • This should be made safer against other types of actions.
    Take a look in the :action-feedback-cb just below and notice how it verifies that the action type is correct before trying to get any values (for example pr2_controller_msgs/JointTrajectoryActionResult doesn't have :error_code)
  • Maybe also consider the more universal :status and cases in which the error-string is empty for better error formatting? When trying on the simulator with an empty goal I got status: 5, error_code: -2, error_string: ' '

I'll use :status for checking error and update action-result-cb more safer against the type of action.
And I'll display error_string if error_string is published.

@tkmtnt7000 tkmtnt7000 closed this Nov 24, 2021
@tkmtnt7000
Copy link
Member Author

tkmtnt7000 commented Nov 24, 2021

Sorry, I mistakenly closed this PR. I reopened.

@tkmtnt7000 tkmtnt7000 reopened this Nov 24, 2021
@tkmtnt7000
Copy link
Member Author

Changes from 0c38069

  • Use :status for checking and support for the case where :error_string is empty
  • Delete global function controller-result-error-to-string and set local variables which have the same behavior
  • Support for the case where some action types do not have :error_code

@tkmtnt7000
Copy link
Member Author

I changed the order of conditional branch in cond clause to make it simpler.

@708yamaguchi
Copy link
Member

melodic test fails.
https://github.com/jsk-ros-pkg/jsk_pr2eus/runs/4311911161?check_suite_focus=true

It seems that test-collision-object-publiser fails randomly.

We created PR to solve it.
#471

pr2eus/robot-interface.l Outdated Show resolved Hide resolved
INVALID_JOINTS
OLD_HEADER_TIMESTAMP
PATH_TOLERANCE_VIOLATED
GOAL_TOLERANCE_VIOLATED)))
Copy link
Member

Choose a reason for hiding this comment

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

Can we make these strings to avoid making new symbols?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but since there has been no mapping between these strings and error_code yet, we will have to send a pull request to roseus or something.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe I was unclear. I mean:

(let ((error-word '("SUCCESSFUL"
                    "INVALID_GOAL"
                    "INVALID_JOINTS"
                    "OLD_HEADER_TIMESTAMP"
                    "PATH_TOLERANCE_VIOLATED"
                    "GOAL_TOLERANCE_VIOLATED")))
  ...)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry. I see.
I updated in 2ce0b4c

@k-okada
Copy link
Member

k-okada commented Oct 18, 2022

LGTM, please pass the test.

@tkmtnt7000
Copy link
Member Author

tkmtnt7000 commented Oct 18, 2022

Could you please give us permissions to press Re-run jobs in Github actions?
This repository does not seem to be set up yet.

@k-okada
Copy link
Member

k-okada commented Oct 18, 2022 via email

@tkmtnt7000
Copy link
Member Author

Thank you. I can push Re-run button.

@knorth55
Copy link
Member

@tkmtnt7000
Copy link
Member Author

actions/checkout@v3.0.2 is good.

Thank you!

@tkmtnt7000
Copy link
Member Author

tkmtnt7000 commented Oct 19, 2022

noetic test fails with following error.
In my local environment, the same failure occurred.
https://github.com/jsk-ros-pkg/jsk_pr2eus/actions/runs/3272413879/jobs/5384061347
https://gist.github.com/tkmtnt7000/a2cd600f1cee134fecbb5d456e1c3550

@tkmtnt7000
Copy link
Member Author

Test fails randomly in noetic(I do not know what is caused...), but Re-run test many times may make test pass.
Especially, in pr2-ri-test-base.l, test-go-stop and test-move-to usually fail.

@tkmtnt7000
Copy link
Member Author

Ummm... noetic gazebo may have something weird???

@k-okada k-okada merged commit 7e03b4d into jsk-ros-pkg:master Oct 25, 2022
@tkmtnt7000 tkmtnt7000 deleted the add_result_cb branch October 25, 2022 14:12
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

5 participants