GithubHelp home page GithubHelp logo

jnitsch / moveit_visual_tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moveit/moveit_visual_tools

0.0 2.0 0.0 256 KB

Helper functions for displaying and debugging MoveIt! data in Rviz via published markers

moveit_visual_tools's Introduction

MoveIt! Visual Tools

Helper functions for displaying and debugging MoveIt! data in Rviz via published markers, trajectories, and MoveIt! collision objects. It is sometimes hard to understand everything that is going on internally with MoveIt!, but using these quick convenience functions allows one to easily visualize their code.

This package includes:

  • Basic geometric markers for Rviz
  • MoveIt! collision object tools
  • Trajectory visualization tools
  • Robot state tools

Developed by Dave Coleman at the Correll Robotics Lab, University of Colorado Boulder with outside contributors.

Build Status

Build Status

Install

Ubuntu Debian

sudo apt-get install ros-hydro-moveit-visual-tools
sudo apt-get install ros-indigo-moveit-visual-tools

Install From Source

Clone this repository into a catkin workspace, then use the rosdep install tool to automatically download its dependencies. Depending on your current version of ROS, use:

rosdep install --from-paths src --ignore-src --rosdistro indigo

Usage

We'll assume you will be using these helper functions within a class.

Initialize

Add to your includes:

#include <moveit_visual_tools/visual_tools.h>

Add to your class's member variables:

// For visualizing things in rviz
moveit_visual_tools::VisualToolsPtr visual_tools_;

In your class' constructor add:

visual_tools_.reset(new moveit_visual_tools::VisualTools("base_link","/moveit_visual_markers"));

Change the first parameter to the name of your robot's base link, and the second parameter to whatever name you'd like to use for the corresponding Rviz marker ROS topic.

There are several other settings you can adjust, which I might get around to documenting in the future:

visual_tools_->setMuted(false);
visual_tools_->setLifetime(20.0);
visual_tools_->setEEGroupName(grasp_data_.ee_group_);
visual_tools_->setPlanningGroupName(planning_group_name_);
visual_tools_->setFloorToBaseHeight(floor_to_base_height);
visual_tools_->setGraspPoseToEEFPose(grasp_pose_to_eef_pose);
visual_tools_->setAlpha(alpha);

Tools

Now in your code you can easily debug your MoveIt! code using visual markers in Rviz

Start rviz and create a new marker using the 'Add' button at the bottom right. Choose the marker topic to be the same as the topic you specified in the constructor.

Example Code

In the following snippet we create a pose at xyz (0.1, 0.1, 0.1) and rotate the pose down 45 degrees along the Y axis. Then we publish the pose as a arrow for visualziation in Rviz. Make sure your Rviz fixed frame is the same as the one chosen in the code.

// Create pose
Eigen::Affine3d pose;
pose = Eigen::AngleAxisd(M_PI/4, Eigen::Vector3d::UnitY()); // rotate along X axis by 45 degrees
pose.translation() = Eigen::Vector3d( 0.1, 0.1, 0.1 ); // translate x,y,z

// Publish arrow vector of pose
ROS_INFO_STREAM_NAMED("test","Publishing Arrow");
visual_tools_->publishArrow(pose, moveit_visual_tools::RED, moveit_visual_tools::LARGE);

Basic Publishing Functions

See visual_tools.h for more details and documentation on the following functions:

  • publishEEMarkers
  • publishSphere
  • publishArrow
  • publishRectangle
  • publishLine
  • publishBlock
  • publishText
  • publishTest

Collision Object Functions

Helpers for adding and removing objects from the MoveIt! planning scene. CO stands for Collision Object and ACO stands for Active Collision Object.

  • cleanupCO
  • cleanupACO
  • attachCO
  • publishCollisionBlock
  • publishCollisionCylinder
  • publishCollisionTree
  • publishCollisionTable
  • publishCollisionWall

Animate Trajectories

Higher level robot ans trajectory functions

  • publishTrajectoryPath
  • publishTrajectoryPoint
  • publishRobotState
  • publishAnimatedGrasps
  • publishIKSolutions

Helper Functions

Convenience functions

  • convertPose
  • generateRandomPose
  • dRand
  • getCenterPoint
  • getVectorBetweenPoints

Available Colors

This package helps you quickly choose colors - feel free to send PRs with more colors as needed

  • moveit_visual_tools::RED
  • moveit_visual_tools::GREEN
  • moveit_visual_tools::BLUE
  • moveit_visual_tools::GREY
  • moveit_visual_tools::WHITE
  • moveit_visual_tools::ORANGE
  • moveit_visual_tools::BLACK
  • moveit_visual_tools::YELLOW

Available Marker Sizes

  • moveit_visual_tools::XXSMALL
  • moveit_visual_tools::XSMALL
  • moveit_visual_tools::SMALL
  • moveit_visual_tools::REGULAR
  • moveit_visual_tools::LARGE
  • moveit_visual_tools::XLARGE

Lifetime

All markers will persist for the duration set by setLifetime, defaulting to 30 seconds. You can reset this earlier by calling

resetMarkerCounts();

This will cause all new markers to overwrite older ones.

Stacktrace Tool

An additional tool, that perhaps should not live in this repo, allows one to see the backtrace of their code without using gdb or compiling in debug mode. To use:

#include <moveit_visual_tools/stacktrace.h>

Then:

void someFunction()
{
  print_stacktrace();
}

Easy! Only works with g++, however. See this page for more information.

Contribute

Feel free to send PRs for new helper functions, fixes, etc. - I'll happily discuss and merge them. I do not, however, want to send much time helping people use this because I am a busy grad student. Use at your own risk.

moveit_visual_tools's People

Contributors

davetcoleman avatar bmagyar avatar jordi-pages avatar awesomebytes avatar

Watchers

James Cloos avatar Julia Nitsch avatar

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.