GithubHelp home page GithubHelp logo

oscardegroot / ros_tools Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 1.56 MB

Wrappers for ROS visualization, benchmarking and data saving in C++

License: Apache License 2.0

CMake 1.05% C++ 90.71% Python 8.24%

ros_tools's Introduction

ROS1 - Build ROS2 - Build

ROS Tools

This package is a tool package for C++ ROS/ROS2 that standardizes and simplifies basic features over ROS/ROS2.

Table of Contents

  1. Features
  2. Installation
  3. Examples
  4. License

Features

This package is a tool package for ROS/ROS2 that contains:

  • Tools for visualization in RViz ros_visuals.cpp

  • Tools for data saving data_saver.h

  • Tools for profiling in profiling.h

  • Tools for logging in logging.h

  • Various other tools

Installation

Clone this repository

git clone https://github.com/oscardegroot/ros_tools.git

Install dependencies with

rosdep install --from-paths src --ignore-src -r -y

To define its ROS version, run python3 switch_to_ros.py <ROS_VERSION>, with ROS_VERSION either 1 or 2.

Note that a rough python version of the visuals is also provided under scripts, but is not actively maintained.


Examples

A ROS1 example is provided in src/example.cpp. Run the example with ros launch ros1_example.launch.

You should see the following in rviz:

example

Visualization

The visualization wrappers for RViz are provided in ros_tools/visuals.h. For example, the following code draws a cube at the origin on the topic ros_tools/example:

        auto &publisher = VISUALS.getPublisher("ros_tools/example");
        auto &cube = publisher.getNewPointMarker("CUBE");
        cube.setColorInt(0, 5);                           
        cube.setScale(0.25, 0.25, 0.25);                 
        cube.addPointMarker(Eigen::Vector3d(0., 0., 0.)); 
        publisher.publish()

Debugging

This package provides useful commands for logging/debugging.

  • ROSTOOLS_HOOK prints the line and file where it is in the terminal and can be clicked in VSCode.
  • ROSTOOLS_ASSERT prints its line and file when the assert fails.
  • LOG_INFO, LOG_WARN, LOG_ERROR, LOG_SUCCESS logs info messages

Profiling

Profiling output is stored in the package that is selected in its initialization (see the example). To view the output, open chrome and go to chrome://tracing/. Click load in the top left and navigate and select <your_package>/profiler.json.

The output of the example is the following:

example


Data Saving

Data is saved in ros_tools/scripts/data/example_data.txt. See the example for more details.


License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.

ros_tools's People

Contributors

oscardegroot avatar

Stargazers

Alvaro Serra avatar Max Spahn avatar  avatar

Watchers

 avatar

ros_tools's Issues

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.