Skip to content

ryanhodge240/ros-introduction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

169 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Intro to ROS

The purpose of this repository is to create ROS packages with increasing difficulties, as to understand how to use it. The order of packages is as follows:

  1. servo_control
  2. keyboard_servo_control
  3. toy_car

Within each package, the directories are laid out in the following way:

package_name
│   README.md
│   CMakeLists.txt
│   package.xml
│
└───config
│   │   physical_parameters.yaml
│
└───launch
│   │   ros_launch_file.launch
│
└───msg
│   │   ros_msgs.msg
│
└───src
    │   python_source_files.py

The CMakeLists.txt & package.xml files are used to tell ROS which packages it should include in the project.

In the config directory lies the parameters of certain parts. For example, it will contain which pin of the Raspberry Pi a sensor should be connected to (using BOARD mode normally).

The launch directory contains the launch file(s) of which can be used to run the package. Thesse launch files start off very simply.

The msg directory includes the user-defined message definitions used in the src directory python files.

Finally, the src directory conatins the brains of the package. These python files are what uses the ros messages and initializes all the nodes.

Setup

Clone this repository, cd into ros_ws, and build the workspace.

git clone https://github.com/ryanhodge240/ros_ws.git
cd ros_ws
catkin_make

Then, source the setup.sh file

source devel/setup.sh

Finally, install a package that will be used for some of the packages in this repository where <distro> should be replaced with your ros distribution (i.e. noetic).

sudo apt-get install ros-<distro>-teleop-twist-keyboard

Servo Control

This package is designed to rotate a servo to a certain position when a button is pushed, and then rotate back once to button is released. To run it, all you need to do is run the launch file after sourcing the setup.sh file.

source devel/setup.sh
roslaunch servo_control servo.launch

Keyboard Servo Control

This package uses the teleop_twist_keyboard package to communicate with the standard geometry_msgs/Twist message. It publishes reading from the keyboard into the Twist message, of which the python file is subscribed to. To run this, you will need two separate terminals running. First, open a terminal and locate ros_ws. Source the setup.sh file and run the launch file.

source devel/setup.sh
roslaunch keyboard_servo_control servo.launch

Next, open up a new terminal and re-source the workspace. Then run the teleop_twist_keyboard.

rosrun teleop_twist_keyboard teleop_twist_keyboard.py

Toy Car

This package is not complete yet, but it will work with a motor controller to use differential drive on a small toy car with 2 wheels and a caster in the back.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors