You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. ## Getting the State of the Robot
  2. Begin by starting up the stretch driver launch file.
  3. ```{.bash .shell-prompt}
  4. roslaunch stretch_core stretch_driver.launch
  5. ```
  6. Then utilize the ROS command-line tool [rostopic](http://wiki.ros.org/rostopic) to display Stretch's internal state information. For instance, to view the current state of the robot's joints, simply type the following in a new terminal.
  7. ```{.bash .shell-prompt}
  8. rostopic echo /joint_states -n1
  9. ```
  10. Note that the flag, `-n1`, at the end of the command defines the count of how many times you wish to publish the current topic information. Remove the flag if you prefer to continuously print the topic for debugging purposes.
  11. Your terminal will output the information associated with the `/joint_states` topic. Your `header`, `position`, `velocity`, and `effort` information may vary from what is printed below.
  12. ```{.bash .no-copy}
  13. header:
  14. seq: 70999
  15. stamp:
  16. secs: 1420
  17. nsecs: 2000000
  18. frame_id: ''
  19. name: [joint_arm_l0, joint_arm_l1, joint_arm_l2, joint_arm_l3, joint_gripper_finger_left,
  20. joint_gripper_finger_right, joint_head_pan, joint_head_tilt, joint_left_wheel, joint_lift,
  21. joint_right_wheel, joint_wrist_yaw]
  22. position: [-1.6137320244357253e-08, -2.9392484829061376e-07, -2.8036125938539207e-07, -2.056847528567165e-07, -2.0518734302754638e-06, -5.98271107676851e-06, 2.9291786329821434e-07, 1.3802900147297237e-06, 0.08154086954434359, 1.4361499260374905e-07, 0.4139061738340768, 9.32603306580404e-07]
  23. velocity: [0.00015598730463972836, -0.00029395074514369584, -0.0002803845454217379, 1.322424459109634e-05, -0.00035084643762840415, 0.0012164337445918797, 0.0002138814988808099, 0.00010419792027496809, 4.0575263146426684e-05, 0.00022487596895736357, -0.0007751929074042957, 0.0002451588607332439]
  24. effort: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
  25. ---
  26. ```
  27. Let's say you are interested in only seeing the `header` component of the `/joint_states` topic, you can output this within the rostopic command-line tool by typing the following command.
  28. ```{.bash .shell-prompt}
  29. rostopic echo /joint_states/header -n1
  30. ```
  31. Your terminal will then output something similar to this:
  32. ```{.bash .no-copy}
  33. seq: 97277
  34. stamp:
  35. secs: 1945
  36. nsecs: 562000000
  37. frame_id: ''
  38. ---
  39. ```
  40. Additionally, if you were to type `rostopic echo /` in the terminal, then press the `Tab` key on your keyboard, you will see the list of published active topics.
  41. A powerful tool to visualize ROS communication is the ROS [rqt_graph package](http://wiki.ros.org/rqt_graph). By typing the following in a new terminal, you can see a graph of topics being communicated between nodes.
  42. ```{.bash .shell-prompt}
  43. rqt_graph
  44. ```
  45. <p align="center">
  46. <img src="https://raw.githubusercontent.com/hello-robot/stretch_tutorials/noetic/images/rqt_graph.png"/>
  47. </p>
  48. The graph allows a user to observe and affirm if topics are broadcasted to the correct nodes. This method can also be utilized to debug communication issues.