ros-industrial / ros2_canopen

CANopen driver framework for ROS2
https://ros-industrial.github.io/ros2_canopen/manual/rolling/
131 stars 55 forks source link

Docs/fix robot system launch path #186

Open flippybit opened 11 months ago

flippybit commented 11 months ago

Hi @ipa-cmh and @ipa-vsp Here is my 1st real PR. :sweat_smile:

The fix is to solve issue #182 a FileNotFoundError when following the humble user-guide "How to create a robot system" readthedocs

The user guide references the robot_control_launch.py file which expects the robot_controller.urdf.xacro file at a certain path. However, this path does not align with the location where the canopen_tests package actually keeps it: canopen_tests/urdf/robot_controller/robot_controller.urdf.xacro

I apologize if I've overlooked any GitHub best practices. Thank you for your understanding in advance.

ipa-vsp commented 11 months ago

Hi @flippybit,

I have merged your changes from branch docs/fix_robot_system_launch_path into PR #176 to prevent conflicts with the master branch.

Thanks for your review!

flippybit commented 11 months ago

Hi @ipa-vsp ,

I knew i did something wrong when i saw all the confilicts i followed some guide were i needed to open a branch for making a pull request. Anyways i think i have found another discrepancy in the docs. Should i share my findings opening a new issue ? || do i just post it here ?

thnx !

ipa-vsp commented 11 months ago

Hi @flippybit,

You can post it here.

Thank you!

flippybit commented 11 months ago

ros2 humble guide "How to create a robot system with ros2_control"

I think i have found 2 minor discrepencies in the "How to create a robot system with ros2_control" Point 12:

(Using the ros2 humble guide readthedocs)

1 There is no such topic name /joint1/forward_position_controller

CLICK TO EXPAND. **In the docs point 12** It states: You can now control the robot with the forward_command_controller. You can as well visualize the robot in rviz by adding a tf or a `robot_model` and setting the fixed frame to `base_link` You can move the robot with the following command: ```bash ros2 topic pub /joint1/forward_position_controller/command std_msgs/msg/Float64 "data: [1.0, 1.0]" ``` But this gives the following error output: ```bash Failed to populate field: Value '[1.0, 1.0]' is expected to be a dictionary but is a list ``` ## My investigations/probings ### 1 There is not such topic named `/joint1/forward_position_controller` If you run ```bash $ ros2 topic list ``` You get the following topics: ``` bash /clicked_point /dynamic_joint_states /forward_position_controller/commands <-- I THINK THIS IS THE TOPIC WE WANT TO PUBLISH TO /forward_position_controller/transition_event /goal_pose /initialpose /joint_1/joint_states /joint_1/nmt_state /joint_1/rpdo /joint_1/tpdo /joint_2/joint_states /joint_2/nmt_state /joint_2/rpdo /joint_2/tpdo /joint_state_broadcaster/transition_event /joint_states /parameter_events /robot_description /rosout /slave_node_1/transition_event /slave_node_2/transition_event /tf /tf_static ``` If you ask ROS2 for more info about `/forward_position_controller/commands ` ```bash $ ros2 topic info /forward_position_controller/commands Type: std_msgs/msg/Float64MultiArray Publisher count: 0 Subscription count: 1 ``` ### Proposed solution publish to the `/forward_position_controller/commands ` ```bash ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray "data: [1.0, 1.0]" ``` This outputs: ```bash ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray "data: [1.0, 1.0]" publisher: beginning loop publishing #1: std_msgs.msg.Float64MultiArray(layout=std_msgs.msg.MultiArrayLayout(dim=[], data_offset=0), data=[1.0, 1.0]) publishing #2: std_msgs.msg.Float64MultiArray(layout=std_msgs.msg.MultiArrayLayout(dim=[], data_offset=0), data=[1.0, 1.0]) publishing #3: std_msgs.msg.Float64MultiArray(layout=std_msgs.msg.MultiArrayLayout(dim=[], data_offset=0), data=[1.0, 1.0]) ```

2 There is no base_link in the /robot_description

In the docs it tells you to visualize the movement of the joints using rivz2:

In the docs it states:
" You can as well visualize the robot in rviz by adding a tf or a robot model and setting the fixed frame to base_link:"

CLICK TO EXPAND. If you run: ```bash ros2 run tf2_tools view_frames ``` You get the following transform tree with NO `base_link` ## Proposed solution #### 1. Run rviz2 ```bash ros2 run rviz2 rviz2 ``` #### 2. Configure rviz2 1. Add a `robot model` Select as a **Description Source** `Topic` Select as **Description Topic** `/robot_description` 2. In **Global Options** Set Fixed Frame as `World` ![rviz2_before](https://github.com/ros-industrial/ros2_canopen/assets/61566125/472ebbd1-7865-469f-8349-7a7feafdc61c) #### 3. Visualize the cilinder move like magic ```bash ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray "data: [1.0, 1.0]" ``` ![rviz2_after](https://github.com/ros-industrial/ros2_canopen/assets/61566125/3e0afdee-d978-4c27-959a-0f382f97ab77)

Hope it helped someone!

destogl commented 11 months ago

@Xi-HHHM can you please check this?