Skip to content
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

Add publishMesh example #154

Open
wants to merge 2 commits into
base: eloquent-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.bmp filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.STL filter=lfs diff=lfs merge=lfs -text
*.stl filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.tar.gz filter=lfs diff=lfs merge=lfs -text
*.ompldb filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ install(
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

# Install shared resources
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
Copy link
Contributor

Choose a reason for hiding this comment

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

Too many spaces between launch and DESTINATION

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the best thing would be to put DESTINATION on a new line, like at L205

install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/meshes"
DESTINATION "share/${PROJECT_NAME}"
)

# Install header files
install(
DIRECTORY include/
Expand Down Expand Up @@ -244,4 +251,4 @@ if (BUILD_TESTING)
)
endif()

ament_package()
ament_package()
3 changes: 3 additions & 0 deletions meshes/bishop.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions meshes/king.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions meshes/knight.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions meshes/pawn.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions meshes/queen.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions meshes/rook.stl
Git LFS file not shown
30 changes: 28 additions & 2 deletions src/rviz_visual_tools_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,33 @@ class RvizVisualToolsDemo : public rclcpp::Node
*/

// --------------------------------------------------------------------
// TODO(davetcoleman): publishMesh
RCLCPP_INFO(get_logger(), "Displaying Meshes");
pose1 = Eigen::Isometry3d::Identity();
y += space_between_rows;
pose1.translation().y() = y;

step = 0.2;
const std::array<double, 6> thetas = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
const std::array<std::string, 6> meshes = {
"pawn", "knight", "bishop", "rook", "queen", "king"
Copy link
Contributor

@AndyZe AndyZe Jun 8, 2020

Choose a reason for hiding this comment

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

I'm not a huge fan of uploading so many STL's, I think one would have been fine. But I guess it's OK

}; // "pig" };
const std::array<rvt::colors, 6> mesh_colors = { rvt::RED, rvt::ORANGE, rvt::YELLOW,
rvt::GREEN, rvt::BLACK, rvt::WHITE };
const std::array<double, 6> scales = { 0.05, 0.05, 0.05, 0.05, 0.05, 0.05 };

for (size_t i = 0; i < meshes.size(); ++i)
{
visual_tools_->publishMesh(pose1 * Eigen::AngleAxisd(thetas[i], Eigen::Vector3d::UnitZ()),
"package://rviz_visual_tools/meshes/" + meshes[i] + ".stl",
mesh_colors[i], scales[i]);
if (i == 0.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose you could use (!i) here

{
publishLabelHelper(pose1, "Meshes");
}

pose1.translation().x() += step;
}
visual_tools_->trigger();

// --------------------------------------------------------------------
// TODO(davetcoleman): publishPolygon
Expand Down Expand Up @@ -656,7 +682,7 @@ int main(int argc, char* argv[])

// Allow the action server to recieve and send ros messages
executor->add_node(demo);
executor->spin_some();
executor->spin_once();

double x_location = 0;
demo->testRows(x_location);
Expand Down