-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port kinematic_constraints to ROS2 #42
Port kinematic_constraints to ROS2 #42
Conversation
Authored by @anasarrak
@@ -200,7 +200,7 @@ moveit_msgs::msg::Constraints constructGoalConstraints(const std::string& link_n | |||
* | |||
* @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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
@@ -848,25 +851,26 @@ shapes::Mesh* VisibilityConstraint::getVisibilityCone(const robot_state::RobotSt | |||
} | |||
|
|||
void VisibilityConstraint::getMarkers(const robot_state::RobotState& state, | |||
visualization_msgs::MarkerArray& markers) const | |||
visualization_msgs::msg::MarkerArray& markers) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
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
@@ -991,7 +995,8 @@ ConstraintEvaluationResult VisibilityConstraint::decide(const robot_state::Robot | |||
collision_detection::CollisionRequest req; | |||
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&)>) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahcorde ping
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Still not building but fixes ROS 2 APIs
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") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
moveit_core/kinematic_constraints/include/moveit/kinematic_constraints/kinematic_constraint.h
Outdated
Show resolved
Hide resolved
…LOGGER_KINEMATIC_CONSTRAINTS
c4e2f69
to
df09d3a
Compare
friendly ping @mlautman @henningkayser @davetcoleman |
@ahcorde Please address all feedback. I see some open questions from @henningkayser |
@henningkayser can you re-review this |
friendly ping @mlautman @henningkayser @davetcoleman Can we merge this? |
* visualization * adding moveit_visual_tools depend * install panda from src instead of deb * minor grammar fix * fixing maintainer list * minor typeo
Authored by @anasarrak