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

Publish to topic cmd_val #5

Open
MoonWalkerAZ opened this issue Dec 8, 2021 · 9 comments
Open

Publish to topic cmd_val #5

MoonWalkerAZ opened this issue Dec 8, 2021 · 9 comments

Comments

@MoonWalkerAZ
Copy link

Is there a good example how to control two motors for differential drive robot ? I would like to publish Twist message to cmd_val topic to control velocity of two motors.

@borongyuan
Copy link
Member

Hi, there's a good example provied by @kallaspriit. Please refer to issue #1.

@kallaspriit
Copy link

Yeah my robot uses this library for physical and simulated differential drive robot, works nicely :)

https://github.com/kallaspriit/rosbot
https://www.youtube.com/watch?v=t-1GAfGHRLs

@MoonWalkerAZ
Copy link
Author

@kallaspriit I have checked your library, but I don't understand which part do I need to create a node that creates cmd_vel topic and sends the correct data to odrive. I'm new at this. Can you help me ? I have seen that you use joystick to send a Twist message, but I dont know where is that twist message being read and then converted to values that odrive driver understands.

@kallaspriit
Copy link

For manual testing /cmd_vel is published by teleop_twist_joy package (which uses joy package to get joystick input).

See this for reference
https://github.com/kallaspriit/rosbot/blob/main/ros/src/teleop_twist_joy/launch/teleop.launch.py

To run in, you can run . launch_teleop.bash in ros or

. install/local_setup.bash
ros2 launch teleop_twist_joy teleop.launch.py

Which does the same thing.

@MoonWalkerAZ
Copy link
Author

Ok, but who is subscribing to /cmd_vel topic ? And how is the Twist message being converted to input so that odrive can understand it ? Thats the part that I don't understand.

@borongyuan
Copy link
Member

Before using this package, you need to be familiar with ros2_control framework.
http://control.ros.org/ros2_controllers/diff_drive_controller/doc/userdoc.html

@MoonWalkerAZ
Copy link
Author

MoonWalkerAZ commented Dec 11, 2021

Ok. Some example of how to use an implement diff_drive_controller with odrive package would be nice. @kallaspriit could you help me with this ?

@kallaspriit
Copy link

Well the rosbot repo IS an example of how to implement diff drive controller with odrive, not sure what else you need. Familiarize yourself with ROS2, ros2_control, URDF's and read the repo. It's all configuration, no actual code is needed but it takes time to understand what does what, no way around it.

Main configuration is in robot URDF (Universal Robot Descriptor File), take a look at
https://github.com/kallaspriit/rosbot/blob/main/ros/src/rosbot_description/urdf/rosbot.urdf.xacro
https://github.com/kallaspriit/rosbot/blob/main/ros/src/rosbot_description/ros2_control/rosbot_system.ros2_control.xacro
https://github.com/kallaspriit/rosbot/blob/main/ros/src/rosbot_description/urdf/rosbot_links.urdf.xacro
https://github.com/kallaspriit/rosbot/blob/main/ros/src/rosbot_description/config/diff_drive_controller.yaml

@MoonWalkerAZ
Copy link
Author

Ok, thank you @kallaspriit and @borongyuan four your 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

No branches or pull requests

3 participants