-
Notifications
You must be signed in to change notification settings - Fork 8
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
Planning Scene transcription V2 #31
Conversation
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 look good!
I think all I see is cleaning up some of the debug prints and the hard-coded names -- ensure the planning scene object names match those specified here? But maybe I am misunderstanding how the Drake scene graph works.
src/ktopt_planning_context.cpp
Outdated
continue; | ||
} | ||
RCLCPP_INFO(getLogger(), "iterating inside collision object's shapes"); |
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.
Remove before merging
src/ktopt_planning_context.cpp
Outdated
const auto& pose = collision_object->shape_poses_[0]; | ||
const auto& shape_type = collision_object->shapes_[0]->type; | ||
RCLCPP_INFO(getLogger(), "Shape type: %d, object id: %s, shape: %s", shape_type, object, shape); |
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.
Remove before merging, or make into debug? Might still be useful, long as it doesn't spam by default
src/ktopt_planning_context.cpp
Outdated
case shapes::ShapeType::BOX: { | ||
|
||
const auto objectptr = std::dynamic_pointer_cast<const shapes::Box>(shape); | ||
RCLCPP_INFO(getLogger(), "Box, size: %f", objectptr->size[0]); // shape.size |
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.
Same as other comment. In general, should clean up what to print. So I'll stop commenting the same thing
src/ktopt_planning_context.cpp
Outdated
|
||
const auto objectptr = std::dynamic_pointer_cast<const shapes::Box>(shape); | ||
RCLCPP_INFO(getLogger(), "Box, size: %f", objectptr->size[0]); // shape.size | ||
const SourceId box_source_id = scene_graph.RegisterSource("template_box"); |
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.
The name should probably not be "template_SHAPE" but rather the actual entity name from the planning scene?
src/ktopt_planning_context.cpp
Outdated
break; | ||
} | ||
case shapes::ShapeType::UNKNOWN_SHAPE: { | ||
RCLCPP_INFO(getLogger(), "Unknown shape, ignoring in scene graph"); |
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.
Maybe this should be a warning instead
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.
Make sure to run pre-commit run -a
between the iterations on the code. It makes it also easier to read and review
@@ -26,6 +26,7 @@ RUN apt update && \ | |||
apt install -y \ | |||
build-essential \ | |||
clang-format-14 \ | |||
clangd-12 \ |
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.
Similar to Sebastian's comment: Why do we need this?
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 added this for linting and LSP support, so that vim has access to the symbols for functionality like Goto definition/declaration etc.
src/ktopt_planning_context.cpp
Outdated
// NOTE: Information tree, to be deleted after implementation | ||
// Planning scene -> World (getWorld, WorldConstPtr) | ||
// objectIds -> World.getObjectIds() | ||
// Object -> World.getObject(objectIds) |
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.
Delete?
src/ktopt_planning_context.cpp
Outdated
@@ -248,29 +253,83 @@ void KTOptPlanningContext::transcribePlanningScene(const planning_scene::Plannin | |||
} | |||
if (object == OCTOMAP_NS) | |||
{ | |||
RCLCPP_ERROR(getLogger(), "skipping octomap for now ..."); | |||
RCLCPP_INFO(getLogger(), "skipping octomap for now ..."); |
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.
Make this a warning and say explicitly: Octomap parsing not supported at the moment
RigidTransformd(pose), | ||
std::make_unique<Sphere>( | ||
objectptr->radius), object)); | ||
RCLCPP_INFO(getLogger(), "Sphere"); |
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.
Remove
@sea-bass @sjahr So I may have celebrated to soon, There seems to be some thing I'm missing when it comes to reading the poses of the objects within planning scene into the scene_graph. Is there a transformation I'm missing between the robot and the world. As far as the scene_graph is concerned, I make the robot spawn at world origin. There could be an initial transformation that I am missing? |
…rake into pr_scene_transcription
You could check the TF widget in RViz to see if there is something amiss there? But as far as world-robot transform is concerned, this should anyways come from the URDF and I would be surprised if this was it. As another thing to look form maybe the scene objects are expressed with some other transform relative to world? @sjahr would know this better. |
Actually from the screenshot it just seems like no transforms at all are being applied to the boxes in the Drake scene graph. Everything is at the origin with identity transform, far as I can tell? |
I think the poses of individual "boxes" (four in this case) w.r.t the collision object frame of reference may be correct. I think there is some global transformation that is missing here. If that makes sense? |
Yup I was thinking that it could be the second reason. Maybe somewhere in the planning scene there is object level pose as well? |
Not sure about that because it works with the MoveIt planning scene, so I guess all transform should be known. Does the function you added fix the issue @kamiradi ? |
The function I added, changes Moveit/ROS coordinate system to Drake. I thought this would, but it didn't. I'll try printing the positions and debugging. |
All right good news, the pose object coming in from the planning scene itself has pose.x, y, z = 0.0. Can you point me towards where in moveit's planning scene the object markers are being set. Because in RViZ it visualises it correctly, so maybe I can use whichever pose to do the same here? |
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.
Nice, I'll test it before our meeting and I have some small clean-up comments and then this is good to go
src/ktopt_planning_context.cpp
Outdated
@@ -248,33 +249,113 @@ void KTOptPlanningContext::transcribePlanningScene(const planning_scene::Plannin | |||
} | |||
if (object == OCTOMAP_NS) | |||
{ | |||
RCLCPP_ERROR(getLogger(), "skipping octomap for now ..."); | |||
RCLCPP_INFO(getLogger(), "Octomap not supported for now ... "); |
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.
RCLCPP_INFO(getLogger(), "Octomap not supported for now ... "); | |
RCLCPP_WARN(getLogger(), "Octomap not supported for now ... "); |
{ | ||
RCLCPP_WARN(getLogger(), "Cone not supported in drake"); | ||
break; | ||
} |
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.
Are these all possible shape types? If not, you should add a default like this at the end of the switch statement
default:
{
RCLCPP_WARN(getLogger(), "Shape TYPE conversation to drake is not implemented");
}
src/ktopt_planning_context.cpp
Outdated
} | ||
} | ||
} | ||
|
||
RigidTransformd KTOptPlanningContext::convertToDrakeFrame(const Eigen::Affine3d& ros_pose) |
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.
Remove the whole function since it is not needed?
README.md
Outdated
Tips for when inside the container | ||
|
||
# Can be added to the entrypoint | ||
git config --global --add safe.directory /root/workspace/src/moveit_drake/ |
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 think I already added this to the entrypoint!
@@ -160,7 +160,7 @@ void KTOptPlanningContext::solve(planning_interface::MotionPlanResponse& res) | |||
visualizer_->ForcedPublish(vis_context); | |||
|
|||
// Without these sleeps, the visualizer won't give you time to load your browser | |||
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int>(params_.trajectory_time_step * 1000.0))); | |||
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int>(params_.trajectory_time_step * 10000.0))); |
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.
Are you wanting to merge with this?
I had an idea which I could try -- basically have the motion planning terminate but starting the visualization separately in a thread so Meshcat doesn't die instantly, but also doesn't hold up the actual planning?
Not for this PR, but at least the delay should be reduced
src/ktopt_planning_context.cpp
Outdated
@@ -228,6 +228,7 @@ void KTOptPlanningContext::setRobotDescription(std::string robot_description) | |||
|
|||
void KTOptPlanningContext::transcribePlanningScene(const planning_scene::PlanningScene& planning_scene) | |||
{ | |||
// Transcribed the planning scene into a drake scene graph |
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.
// Transcribed the planning scene into a drake scene graph | |
// Transcribe the planning scene into a drake scene graph |
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.
Let's merge once SebC's comments are addressed 😄
@sea-bass @sjahr. This is at a reviewable stage. The planning scene transcription contains the following
I'll do the pre-commit stuff after any other changes you guys have in mind