Skip to content

Port kinematic_constraints to ROS2 - #42

Merged
mlautman merged 15 commits into
moveit:masterfrom
AcutronicRobotics:kinematic-constraints
Jun 25, 2019
Merged

mlautman merged 15 commits into
moveit:masterfrom
AcutronicRobotics:kinematic-constraints

Conversation

@vmayoral

Copy link
Copy Markdown
Contributor

Authored by @anasarrak

* @return was the construction successful?
*/
bool constructConstraints(XmlRpc::XmlRpcValue& params, moveit_msgs::msg::Constraints& constraints);
// bool constructConstraints(XmlRpc::XmlRpcValue& params, moveit_msgs::msg::Constraints& constraints);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add TODO with missing dependency. Was this removed because xmlrpc is not available? If so, it looks like it is used in the ros1_bridge

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can actually use the rclcpp parameters to fix these kind of things, or at least, the way that I'm following.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@v4hn spent a lot of time on this feature. Perhaps you and he can collaborate on the best path for porting this. In the mean time, any time you comment out a feature, please add comments explaining why the feature is being removed and what steps would be necessary before re-enabling the feature

constraints.name = static_cast<std::string>(params["name"]);
return collectConstraints(params["constraints"], constraints);
}
// TODO: Is not getting called from anywhere, check if is necessary

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended to be used by application code. It enables the user to define a set of constraints in a config file and use it for both the generation of an approximated constraint manifold and the sampling of that manifold. Without this code those parameters have to be defined multiple times and may get out of sync. The tutorial on approximated constraint manifolds has some more information: https://ros-planning.github.io/moveit_tutorials/doc/planning_with_approximated_constraint_manifolds/planning_with_approximated_constraint_manifolds_tutorial.html

I believe @v4hn is working on documenting this feature better

delete m;
mk.header.frame_id = robot_model_->getModelFrame();
mk.header.stamp = ros::Time::now();
mk.header.stamp = stamp;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use clock_ros_.now() directly? I don't see stamp being used anywhere else.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes were made on the following commit b3855c3


void VisibilityConstraint::getMarkers(const robot_state::RobotState& state,
visualization_msgs::MarkerArray& markers) const
visualization_msgs::msg::MarkerArray& markers)

@henningkayser henningkayser Mar 18, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getMarkers() should be const. Did you change it because of clock_ros_? In this case I would suggest creating a local instance.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better, just use rclcpp::Time::now(RCL_ROS_TIME);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted back here AcutronicRobotics@beb3bca

collision_detection::CollisionResult res;
collision_detection::AllowedCollisionMatrix acm;
acm.setDefaultEntry("cone", boost::bind(&VisibilityConstraint::decideContact, this, _1));
acm.setDefaultEntry("cone", (boost::function<bool(collision_detection::Contact&)>)

@henningkayser henningkayser Mar 18, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this function cast necessary?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahcorde ping

@ahcorde ahcorde Jun 4, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't explain you exactly why we have this cast. Maybe @anasarrak can jump here and add some light. But I was trying today to change this to the current version but it was not working. My guess is because we are using C++14. I have tried to change this to std using std::function and std::bind because most of the packages are moving from boost to std but again I was not able to do it.

Anyhow help is wellcome.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed this with this commit b3855c3

What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was causing some compilation problems, the cast prevented the problem.

@ahcorde ahcorde mentioned this pull request May 24, 2019
14 tasks done
if(WIN32)
# set(append_library_dirs "$<TARGET_FILE_DIR:${PROJECT_NAME}>;$<TARGET_FILE_DIR:${PROJECT_NAME}_TestPlugins1>")
else()
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_BINARY_DIR}/../utils;${CMAKE_CURRENT_BINARY_DIR}/../robot_model;${CMAKE_CURRENT_BINARY_DIR}/../robot_state;${CMAKE_CURRENT_BINARY_DIR}/../collision_detection_fcl")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding relative paths is a bad idea.

I would recommend that for every library in this package that is used else ware you set a <lib_name>_lib_dir environment variable that can then be used by the tests

A good example is the rcl_lib_dir I have taken the time to show how it is used below:

/home/mike/ws_ros2/src/ros2/rcl/rcl/CMakeLists.txt:
   78  
   79: # rcl_lib_dir is passed as APPEND_LIBRARY_DIRS for each ament_add_gtest call so
   80  # the librcl that they link against is on the library path.
   81  # This is especially important on Windows.
   82  # This is overwritten each loop, but which one it points to doesn't really matter.
   83: set(rcl_lib_dir "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
   84  

/home/mike/ws_ros2/src/ros2/rcl/rcl/test/CMakeLists.txt:
   16  
   17: set(extra_lib_dirs "${rcl_lib_dir}")
   18  
   
/home/mike/ws_ros2/src/ros2/rcl/rcl/test/CMakeLists.txt:
   34    rcl_add_custom_gtest(test_client${target_suffix}
   35      SRCS rcl/test_client.cpp
   36:     INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
   37      ENV ${rmw_implementation_env_var}
   38      APPEND_LIBRARY_DIRS ${extra_lib_dirs}

The example uses rcl_add_custom_gtest but it works just as well with ament_add_gtest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind I prefer to merge this. And then I will fix them all together. Because we have other merged that use this style. I can open an issue to avoid forgetting it.

@ahcorde
ahcorde force-pushed the kinematic-constraints branch from c4e2f69 to df09d3a Compare May 29, 2019 21:46
@ahcorde

ahcorde commented Jun 3, 2019

Copy link
Copy Markdown
Contributor

friendly ping @mlautman @henningkayser @davetcoleman

@mlautman

mlautman commented Jun 3, 2019

Copy link
Copy Markdown
Contributor

@ahcorde Please address all feedback. I see some open questions from @henningkayser

@anasarrak

Copy link
Copy Markdown
Contributor

@mlautman

Copy link
Copy Markdown
Contributor

@henningkayser can you re-review this

@ahcorde

ahcorde commented Jun 24, 2019

Copy link
Copy Markdown
Contributor

friendly ping @mlautman @henningkayser @davetcoleman

Can we merge this?

@mlautman
mlautman merged commit 3405196 into moveit:master Jun 25, 2019
MikeWrock pushed a commit to MikeWrock/moveit2 that referenced this pull request Aug 15, 2022
* visualization

* adding moveit_visual_tools depend

* install panda from src instead of deb

* minor grammar fix

* fixing maintainer list

* minor typeo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants