BebopSetupAndProgramming, UniversalRobot-ROS
Getting Started with ROS
On this page... (hide)
1. Basic Concepts
- Shell (scripts): command-line program that allows you to program commands in chains. If you open a new terminal window, that's a new shell
- Most Linux distributions use the bash shell natively
- You usually place scripts in a bin folder
- chmod gives administrator privilege to run that script
- There are many ROS distributions (e.g. indigo, kinetic)
- Catkin is a build system (build = compile to obj files + link to libraries to create executables)
- Setup.bash file sets up environment variables to locate the files RPS needs. You technically need to type this command for every shell. You can configure your account to run the setup.bash script automaically
- ROS package is a collection of executables and supporting files that serve a specific purpose (e.g. turtlesim package has executables tutlesim_node, turtle_teleop_key)
- The directory with a file called package.xml (contains details about package) is the package directory
- Type rospack list to obtain all of the installed ROS packages
- One of the basic goals of ROS is to enable roboticists to design software as a collection of small, mostly independent programs called nodes that all run at the same time. Nodes are loosely coupled, meaning they don't know about each other
- ROS master (roscore) facilitates such communication. Always have roscore running in a separate terminal.
- Node is a running instance of a ROS program (would type rosrun [ROS executable file name])
- For nodes to share information they will have to publish (send) and subscribe (receive) to certain messages on topics
- note, rosout has to do with master
- data type tells you how the messages on a topic is organized
- In a publisher you can send out messages
- In a subscriber you need a callback function to de-queue the incoming message. Depending on whether there's other repetitive work to do in the subscriber, we use ros::spinOnce()or ros::spin() to continually execute our callback function
- when publishing/subscribing, remember to add dependency on the package of the data type it's communicating (via headers)
- Log messages are classified into five groups called serverity levels/severities/levels
- They're output on the console and published on the topic /rosout with the message type rosgraph_msgs/Log
- You can start master and the many nodes all at once using a file called a launch file
- Remapping nodes is the process of "translating" messaged published by one node into a format expected by another node (skipped reading)
2. Useful Command Line Arguments
- roscore
- rosrun [package name] [executable file name]
- rospack list
- view all installed ROS packages
- rosnode list
- get list of running nodes
- rosnode info [node-name]
- get info about particular node
- rosnode kill [ros-name]
- to kill a node
- rtq_graph
- rostopic list
- get list of active topics
- rostopic echo [topic-name]
- see the actual messages that are being published on a single topic
- e.g. rostopic echo /rosout to see all of the log messages from all the nodes.. but more friendly GUI command to display log messages is "rqt_console"
- rostopic info [topic-name]
- get info, including data/message type
- rosmsg show [message-type-name]
- see details about a message type; what fields the message type has
- rostopic pub -r [rate in Hz] [topic name] [message type] [message content]
- to manually publish messages from command line
- can also do one-time mode, latch-mode…
- roswtf
- to use when not behaving as expected
- roslaunch [package name] [launch file name]
- to create a launch file (automatically runs roscore and starts multiple nodes, whereas rosrun only starts a single node)
- Use Ctrl+C to gracefully shut down each active node from the launch
- rosbag record -O [filename].bag [topic names]
- to create a bag file to record data
- rosbag play [filename].bag
- to replay a bag file
3. Installing ROS onto Raspberry Pi Zero W
To install ROS on RaspPi, you could either install from source or flash an image of Raspbian+ROS on the microSD card and install. However, the RasPi Zero doesn't have enough computational power to install from source and many images online are not compatible with the Zero (mostly for RasPi 3). After many hours or trial and error, I've found this installation to work, after Raspbian OS is functional.
Page last modified on August 17, 2018, at 11:06 AM