Giter Club home page Giter Club logo

differentialdriverobot's Introduction

Differential Drive Robot

package dependencies

  • rospy
  • roscpp
  • geometry_msgs

Brief Explanation

  • myrobot_description specifies the entire robot structure as links and joints and can launch the model in rviz.
  • myrobot_gazebo launches the model in the gazebo environment and contains different simulation worlds.
  • myrobot_control launches the model in the gazebo environment where the robot motion can be commanded by the keyboard.

Create the Robot Model (URDF)

In ~/catkin_ws/src/myrobot_description/urdf, there are four files:

  • myrobot.xacro: primary file that loads the other three files and contains only URDF items like joints and links
  • myrobot.gazebo: contains gazebo-specific labels that are wrapped within gaz
  • materials.xacro: maps strings to colors
  • macros.xacro: macros to help simplify

Run the Models

Load the Gazebo simulator and rviz in separate terminals using the following commands:

roslaunch myrobot_gazebo myrobot_world.launch
roslaunch myrobot_description myrobot_rviz.launch

simulation_in_gazebo_and_rviz

Circle mode:

On a new terminal use the following command to make the robot drive incessantly along a circle of user-defined diameter. (Here diameter = 4 m. So, radius = 2m. Thus linear and angular velocities are set accordingly)

rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: 0.2
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.1"

Can also run using script. The ~/catkin_ws/src/myrobot_gazebo/scripts contains the circle_mode.py node.

  • Launch the gazebo simulator using the following command:
roslaunch myrobot_gazebo myrobot_world.launch
  • Start the circle_mode node:
rosrun myrobot_gazebo circle_mode.py

circle_mode

Square mode:

The ~/catkin_ws/src/myrobot_gazebo/scripts contains the square_mode.py node. It draws a square of 0.4m side.

  • Launch the gazebo simulator using the following command:
roslaunch myrobot_gazebo myrobot_world.launch
  • Start the square_mode node:
rosrun myrobot_gazebo square_mode.py

This method is not perfect as the robot is way off from the point it started, after completing the square. Using motion planning the action can be made accurate.

Keyboard teleop mode:

The ~/catkin_ws/src/myrobot_control/scripts folder contains the myrobot_key node, which is the teleop node. There is already a standard teleop node implementation available (for the turtlebot), we simply reused the node. Then a remapping is done from the turtlebot_teleop_keyboard/cmd_vel to /cmd_vel of our robot in the keyboard_teleop.launch file.

  • Launch the gazebo simulator with complete simulation settings using the following command:
roslaunch myrobot_gazebo myrobot_gazebo_full.launch
  • Start the teleop node:
roslaunch myrobot_control keyboard_teleop.launch
  • Start RViz to visualize the robot state:
rosrun rviz rviz

differentialdriverobot's People

Contributors

sanuann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

differentialdriverobot's Issues

Obsolete File

Thank you for sharing this code, really helpful!

I think there is a file in the folder src/myrobot_description/urdf named myrobot.urdf, that doesn't really serve a purpose. Can you confirm that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.