Coder Social home page Coder Social logo

Display the mesh after padding about moveit HOT 4 OPEN

nyxrobotics avatar nyxrobotics commented on September 16, 2024
Display the mesh after padding

from moveit.

Comments (4)

jsupratman13 avatar jsupratman13 commented on September 16, 2024 1

It's a work in progress, and here is something I noticed when visualizing the padding/scale

original scaled/padded (excluding mesh type)
rviz_screenshot_2023_09_06-18_33_43 rviz_screenshot_2023_09_06-18_33_15

I've extracted moveit_core::RobotModel link model information to generate the padding as shown above. However, it seems that it only takes the first collision define by the link and ignores any other collision. Need more investigation on this.

from moveit.

jsupratman13 avatar jsupratman13 commented on September 16, 2024 1

Memo:
This is where the padd/scale parameters are loaded set.

configureDefaultPadding();
scene_->getCollisionEnvNonConst()->setPadding(default_robot_padd_);
scene_->getCollisionEnvNonConst()->setScale(default_robot_scale_);
for (const std::pair<const std::string, double>& it : default_robot_link_padd_)
{
scene_->getCollisionEnvNonConst()->setLinkPadding(it.first, it.second);
}
for (const std::pair<const std::string, double>& it : default_robot_link_scale_)
{
scene_->getCollisionEnvNonConst()->setLinkScale(it.first, it.second);
}
scene_->propogateRobotPadding();

The parameters are stored in the scene_ a planning_scene::PlanningScene instance under cenv_, a collision_detection::CollisionEnvPtr variable. Accessing this will give you the link padd/scale.

collision_detection::CollisionEnvPtr cenv_; // never NULL

Collision check with padd/scale parameter is executed when checkCollision function is called (ros-planning ignores padd/scale self-collision but sbgisen don't)

void PlanningScene::checkCollision(const collision_detection::CollisionRequest& req,
collision_detection::CollisionResult& res,
const moveit::core::RobotState& robot_state,
const collision_detection::AllowedCollisionMatrix& acm) const
{
// check collision with the world using the padded version
getCollisionEnv()->checkRobotCollision(req, res, robot_state, acm);
// do self-collision checking with the padded version of the robot
if (!res.collision || (req.contacts && res.contacts.size() < req.max_contacts))
getCollisionEnv()->checkSelfCollision(req, res, robot_state, acm);
}

This will called the checkRobotCollision and checkSelfCollision function defined in moveit_core/collision_detection/include/collision_env.h file. Here, it gets a little tricky since it is a virtual function; this means the function will override whatever class it inherits. In this case, MoveIt has several collision detection method, such as FCL and Bullet. By default, MoveIt uses the FCL.

setActiveCollisionDetector(collision_detection::CollisionDetectorAllocatorFCL::create());

Visualization part:
In general, we want to modify either the https://github.com/sbgisen/moveit/tree/noetic-devel/moveit_ros/visualization/motion_planning_rviz_plugin or https://github.com/sbgisen/moveit/tree/noetic-devel/moveit_ros/visualization/planning_scene_rviz_plugin to visualize the robot model on rviz.

from moveit.

jsupratman13 avatar jsupratman13 commented on September 16, 2024

Memo part2:
Since MoveIt uses FCL, the updatedPaddingOrScaling function, which is called when the padd/scale parameter are configured, is referred here.

void CollisionEnv::setPadding(double padding)

void CollisionEnvFCL::updatedPaddingOrScaling(const std::vector<std::string>& links)

Looking at FCL's createCollisionGeometry function, the individual link's collision are cast as geometric_shapes::Shape with the scaling and padding parameters configured within. Depending on the type of collision shape, the geometric_shapes::Shape updates the scaling and padding parameters accordingly.

shapes::ShapePtr scaled_shape(shape->clone());
scaled_shape->scaleAndPadd(scale, padding);

This is also used in Bullet
if (fabs(getLinkScale(link->name) - 1.0) >= std::numeric_limits<double>::epsilon() ||
fabs(getLinkPadding(link->name)) >= std::numeric_limits<double>::epsilon())
{
shape->scaleAndPadd(getLinkScale(link->name), getLinkPadding(link->name));
}

Therefore, if we can extract the geometric_shapes::Shape to some structure for Rviz (such as visualization_msgs or Rviz api) we can visualize how the padding/scaling parameters affects the robot model collision.

from moveit.

jsupratman13 avatar jsupratman13 commented on September 16, 2024

#24 due to trying to sync with the latest branch, it was requested to temporarily revert (#26).
Reopening this issue as a reminder that the padding visual is not enabled at the moment.

from moveit.

Related Issues (13)

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.