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 tricycle controller demo #145

Merged
merged 12 commits into from
Aug 15, 2022

Conversation

tonynajjar
Copy link
Contributor

@tonynajjar tonynajjar force-pushed the add-tricycle-controller-demo branch from faf9ab9 to 766d5f4 Compare July 23, 2022 11:45
@bmagyar
Copy link
Member

bmagyar commented Jul 25, 2022

Hey @tonynajjar could you please fix the conflict on this one?

@tonynajjar
Copy link
Contributor Author

Done. What's the preferred way to activate the controllers, via the spawner as done in tricycle launch files or with "ros2 control" as done in differential launch files?

Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

Done. What's the preferred way to activate the controllers, via the spawner as done in tricycle launch files or with "ros2 control" as done in differential launch files?

@tonynajjar, I prefer ros2 control cmd, like the other examples

do you mind to fix linters?

@tonynajjar tonynajjar requested a review from ahcorde July 26, 2022 12:25
@tonynajjar
Copy link
Contributor Author

tonynajjar commented Jul 26, 2022

Changed to ros2 control and fixed linters (colcon test succeeds at least)

Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

I'm missing two things

  • Include in the README.md how to launch the demo.
  • Include a cpp example to move the robot
ros2 run gazebo_ros2_control_demos example_tricycle

gazebo_ros2_control_demos/launch/tricycle_drive.launch.py Outdated Show resolved Hide resolved
tonynajjar and others added 2 commits July 26, 2022 18:52
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@tonynajjar tonynajjar requested a review from ahcorde July 26, 2022 16:58
@tonynajjar
Copy link
Contributor Author

Done

Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

is the tricycle controller released?

README.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

include tricyle controller in the package.xml

tonynajjar and others added 2 commits July 26, 2022 19:11
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@tonynajjar
Copy link
Contributor Author

tonynajjar commented Jul 26, 2022

is the tricycle controller released?

No the PR is still not merged, I wanted to offer the maintainers a way to test it with this PR

@tonynajjar tonynajjar requested a review from ahcorde July 26, 2022 17:13
README.md Outdated
@@ -235,6 +236,7 @@ ros2 run gazebo_ros2_control_demos example_position
ros2 run gazebo_ros2_control_demos example_velocity
ros2 run gazebo_ros2_control_demos example_effort
ros2 run ign_ros2_control_demos example_diff_drive
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is ign_ros2_control_demos intentional here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

nope, it's wrong too.

Do you have any plans to include this demo in ign_ros2_control ?

Copy link
Contributor Author

@tonynajjar tonynajjar Jul 26, 2022

Choose a reason for hiding this comment

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

No not at the moment, maybe when I migrate to ignition.

Changed ign_ros2_control_demos to gazebo_ros2_control_demos

Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

I compiled from source the controller and I;m getting this error

[gzserver-1] [INFO] [1658874234.382522606] [controller_manager]: Loading controller 'tricycle_controller'
[gzserver-1] [INFO] [1658874234.405261155] [controller_manager]: Setting use_sim_time=True for tricycle_controller to match controller manager (see ros2_control#325 for details)
[gzserver-1] [INFO] [1658874234.428799512] [controller_manager]: Configuring controller 'tricycle_controller'
[gzserver-1] [INFO] [1658874234.458278809] [tricycle_controller]: On activate: Initialize Joints
[gzserver-1] [INFO] [1658874234.458323956] [tricycle_controller]: Get Wheel Joint Instance
[gzserver-1] [ERROR] [1658874234.458414226] [tricycle_controller]: Unable to obtain joint state handle for traction_joint
[gzserver-1] [INFO] [1658874234.458428779] [tricycle_controller]: Get Steering Joint Instance
[gzserver-1] [ERROR] [1658874234.458434899] [tricycle_controller]: Unable to obtain joint state handle for steering_joint
[gzserver-1] [WARN] [1658874234.458450560] []: Error occurred while doing error handling.
[gzserver-1] [ERROR] [1658874234.459401166] [controller_manager]: After activating, controller 'tricycle_controller' is in state 'unconfigured', expected Active
[ros2-6] Sucessfully loaded controller tricycle_controller into state active

@tonynajjar
Copy link
Contributor Author

tonynajjar commented Jul 27, 2022

Weird, I can't reproduce. What version of ros2_control are you using? it should be master. You might be missing these changes https://github.com/ros-controls/ros2_control/pull/737/files

root@logi-XMG-CORE-REN-M20:~/ros2# ros2 launch gazebo_ros2_control_demos tricycle_drive.launch.py 
[INFO] [launch]: All log files can be found below /root/.ros/log/2022-07-27-09-38-20-350759-logi-XMG-CORE-REN-M20-8232
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gzserver-1]: process started with pid [8233]
[INFO] [gzclient-2]: process started with pid [8235]
[INFO] [robot_state_publisher-3]: process started with pid [8237]
[INFO] [spawn_entity.py-4]: process started with pid [8239]
[robot_state_publisher-3] [INFO] [1658907500.775611338] [kdl_parser]: Link chassis had 3 children.
[robot_state_publisher-3] [INFO] [1658907500.775660776] [kdl_parser]: Link left_wheel had 0 children.
[robot_state_publisher-3] [INFO] [1658907500.775686421] [kdl_parser]: Link right_wheel had 0 children.
[robot_state_publisher-3] [INFO] [1658907500.775688943] [kdl_parser]: Link steering_link had 1 children.
[robot_state_publisher-3] [INFO] [1658907500.775691281] [kdl_parser]: Link wheel_front_link had 0 children.
[robot_state_publisher-3] [INFO] [1658907500.775698282] [robot_state_publisher]: got segment base_link
[robot_state_publisher-3] [INFO] [1658907500.775729150] [robot_state_publisher]: got segment chassis
[robot_state_publisher-3] [INFO] [1658907500.775732801] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-3] [INFO] [1658907500.775735572] [robot_state_publisher]: got segment right_wheel
[robot_state_publisher-3] [INFO] [1658907500.775738190] [robot_state_publisher]: got segment steering_link
[robot_state_publisher-3] [INFO] [1658907500.775740949] [robot_state_publisher]: got segment wheel_front_link
[spawn_entity.py-4] [INFO] [1658907500.899248052] [spawn_entity]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1658907500.899449723] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-4] /opt/ros/rolling/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead.
[spawn_entity.py-4]   warnings.warn(
[spawn_entity.py-4] [INFO] [1658907500.901643538] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1658907500.912280846] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1658907500.912464530] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-4] [INFO] [1658907501.668440106] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-4] [INFO] [1658907501.815870804] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [tricycle]
[gzserver-1] [INFO] [1658907501.828614077] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gzserver-1] [INFO] [1658907501.843692185] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /
[gzserver-1] [INFO] [1658907501.843887437] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gzserver-1] [INFO] [1658907501.844200941] [gazebo_ros2_control]: Loading parameter file /root/ros2/install/gazebo_ros2_control_demos/share/gazebo_ros2_control_demos/config/tricycle_drive_controller.yaml
[gzserver-1] 
[gzserver-1] [INFO] [1658907501.857699212] [gazebo_ros2_control]: connected to service!! robot_state_publisher
[gzserver-1] [INFO] [1658907501.859040638] [gazebo_ros2_control]: Recieved urdf from param server, parsing...
[gzserver-1] [INFO] [1658907501.868492103] [gazebo_ros2_control]: Loading joint: steering_joint
[gzserver-1] [INFO] [1658907501.868568874] [gazebo_ros2_control]: 	State:
[gzserver-1] [INFO] [1658907501.868587092] [gazebo_ros2_control]: 		 position
[gzserver-1] [INFO] [1658907501.868732766] [gazebo_ros2_control]: 	Command:
[gzserver-1] [INFO] [1658907501.868739498] [gazebo_ros2_control]: 		 position
[gzserver-1] [INFO] [1658907501.868962196] [gazebo_ros2_control]: Loading joint: traction_joint
[gzserver-1] [INFO] [1658907501.868970077] [gazebo_ros2_control]: 	State:
[gzserver-1] [INFO] [1658907501.868974725] [gazebo_ros2_control]: 		 velocity
[gzserver-1] [INFO] [1658907501.869028906] [gazebo_ros2_control]: 		 position
[gzserver-1] [INFO] [1658907501.869035177] [gazebo_ros2_control]: 	Command:
[gzserver-1] [INFO] [1658907501.869039645] [gazebo_ros2_control]: 		 velocity
[gzserver-1] [INFO] [1658907501.869457635] [resource_manager]: Initialize hardware 'GazeboSystem' 
[gzserver-1] [INFO] [1658907501.870005762] [resource_manager]: Successful initialization of hardware 'GazeboSystem'
[gzserver-1] [INFO] [1658907501.871479216] [resource_manager]: 'configure' hardware 'GazeboSystem' 
[gzserver-1] [INFO] [1658907501.871552395] [resource_manager]: Successful 'configure' of hardware 'GazeboSystem'
[gzserver-1] [INFO] [1658907501.871606258] [resource_manager]: 'activate' hardware 'GazeboSystem' 
[gzserver-1] [INFO] [1658907501.871610246] [resource_manager]: Successful 'activate' of hardware 'GazeboSystem'
[gzserver-1] [INFO] [1658907501.871837745] [gazebo_ros2_control]: Loading controller_manager
[gzserver-1] [WARN] [1658907501.931480126] [gazebo_ros2_control]:  Desired controller update period (0.02 s) is slower than the gazebo simulation period (0.001 s).
[gzserver-1] [INFO] [1658907501.932171412] [gazebo_ros2_control]: Loaded gazebo_ros2_control.
[INFO] [spawn_entity.py-4]: process has finished cleanly [pid 8239]
[INFO] [ros2-5]: process started with pid [8393]
[gzclient-2] ../src/intel/isl/isl.c:2216: FINISHME: ../src/intel/isl/isl.c:isl_surf_supports_ccs: CCS for 3D textures is disabled, but a workaround is available.
[gzserver-1] [INFO] [1658907502.667269464] [controller_manager]: Loading controller 'joint_state_broadcaster'
[gzserver-1] [INFO] [1658907502.689692704] [controller_manager]: Setting use_sim_time=True for joint_state_broadcaster to match controller manager (see ros2_control#325 for details)
[gzserver-1] [INFO] [1658907502.700036984] [controller_manager]: Configuring controller 'joint_state_broadcaster'
[gzserver-1] [INFO] [1658907502.700733039] [joint_state_broadcaster]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published
[ros2-5] Sucessfully loaded controller joint_state_broadcaster into state active
[INFO] [ros2-5]: process has finished cleanly [pid 8393]
[INFO] [ros2-6]: process started with pid [8468]
[gzserver-1] [INFO] [1658907503.599030392] [controller_manager]: Loading controller 'tricycle_controller'
[gzserver-1] [INFO] [1658907503.625695555] [controller_manager]: Setting use_sim_time=True for tricycle_controller to match controller manager (see ros2_control#325 for details)
[gzserver-1] [INFO] [1658907503.642857024] [controller_manager]: Configuring controller 'tricycle_controller'
[gzserver-1] [INFO] [1658907503.676904225] [tricycle_controller]: On activate: Initialize Joints
[gzserver-1] [INFO] [1658907503.676941674] [tricycle_controller]: Get Wheel Joint Instance
[gzserver-1] [INFO] [1658907503.677304348] [tricycle_controller]: Get Steering Joint Instance
[ros2-6] Sucessfully loaded controller tricycle_controller into state active
[INFO] [ros2-6]: process has finished cleanly [pid 8468]

@tonynajjar tonynajjar requested a review from ahcorde July 28, 2022 07:15
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

Thank you for the iterations! I will approve this PR, but I can't merge it until the other PR ros-controls/ros2_controllers#345 is in.

tonynajjar and others added 3 commits July 28, 2022 10:33
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@tonynajjar
Copy link
Contributor Author

Thanks for the review, I made the last fixes. Yep, let's wait for the other PR to be merged first 👍

@tonynajjar
Copy link
Contributor Author

@ahcorde @destogl controller is merged!

Copy link
Member

@destogl destogl left a comment

Choose a reason for hiding this comment

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

Thanks for the great example! I have tested it and it works!

@ahcorde ahcorde merged commit 55251df into ros-controls:master Aug 15, 2022
@ahcorde
Copy link
Collaborator

ahcorde commented Aug 15, 2022

Thank you for this example @tonynajjar, do you have any plans to add this example to gz_ros2_control?

@tonynajjar
Copy link
Contributor Author

No problem! As mentioned here I wasn't thinking of adding it to gz_ros2_control but if it's not too much work I can give it a shot (I don't know how different Gazebo and Gazebo Classic are)

@ahcorde
Copy link
Collaborator

ahcorde commented Aug 15, 2022

great @tonynajjar, feel free to ping me if you need help

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.

4 participants