diff --git a/tesseract_visualization/CMakeLists.txt b/tesseract_visualization/CMakeLists.txt index fb7e79b09db..d24afaad5d4 100644 --- a/tesseract_visualization/CMakeLists.txt +++ b/tesseract_visualization/CMakeLists.txt @@ -17,11 +17,11 @@ find_package(tesseract_environment REQUIRED) find_package(tesseract_scene_graph REQUIRED) find_package(tesseract_state_solver REQUIRED) -# Optional to build ignition visualization -find_package(ignition-common3 COMPONENTS profiler events av QUIET) -find_package(ignition-transport8 QUIET) -find_package(ignition-msgs5 QUIET) -find_package(ignition-math6-eigen3 QUIET) +# Optional to build gazebo visualization +find_package(gz-common5 COMPONENTS profiler events av QUIET) +find_package(gz-transport11 QUIET) +find_package(gz-msgs8 QUIET) +find_package(gz-math7-eigen3 QUIET) if(NOT TARGET console_bridge::console_bridge) add_library(console_bridge::console_bridge INTERFACE IMPORTED) @@ -36,13 +36,13 @@ else() endif() endif() -set(IGNITION_FOUND FALSE) -if(ignition-common3_FOUND - AND ignition-transport8_FOUND - AND ignition-msgs5_FOUND - AND ignition-math6-eigen3_FOUND) - set(IGNITION_FOUND TRUE) - message(STATUS "Ignition Visualization Library will be built!") +set(GAZEBO_FOUND FALSE) +if(gz-common5_FOUND + AND gz-transport11_FOUND + AND gz-msgs8_FOUND + AND gz-math7-eigen3_FOUND) + set(GAZEBO_FOUND TRUE) + message(STATUS "Gazebo Visualization Library will be built!") endif() # Load variable for clang tidy args, compiler options and cxx version @@ -96,14 +96,17 @@ target_include_directories(${PROJECT_NAME} PUBLIC "$") list(APPEND PACKAGE_LIBRARIES ${PROJECT_NAME}) -if(IGNITION_FOUND) +option(TESSERACT_BUILD_GZ_VISUALIZATION "Build Gazebo visualization plugin" ON) +if(GAZEBO_FOUND AND TESSERACT_BUILD_GZ_VISUALIZATION) add_library(${PROJECT_NAME}_ignition src/ignition/entity_manager.cpp src/ignition/conversions.cpp) target_link_libraries( ${PROJECT_NAME}_ignition PUBLIC tesseract::tesseract_scene_graph tesseract::tesseract_common - ${IGNITION-COMMON_LIBRARIES} - ${IGNITION-MSGS_LIBRARIES} + gz-common5::gz-common5-profiler + gz-common5::gz-common5-events + gz-common5::gz-common5-av + gz-msg8::gz-msg8 console_bridge::console_bridge) target_compile_options(${PROJECT_NAME}_ignition PRIVATE ${TESSERACT_COMPILE_OPTIONS_PRIVATE}) target_compile_options(${PROJECT_NAME}_ignition PUBLIC ${TESSERACT_COMPILE_OPTIONS_PUBLIC}) @@ -118,8 +121,6 @@ if(IGNITION_FOUND) ENABLE ${TESSERACT_ENABLE_CODE_COVERAGE}) target_include_directories(${PROJECT_NAME}_ignition PUBLIC "$" "$") - target_include_directories(${PROJECT_NAME}_ignition SYSTEM PUBLIC ${IGNITION-COMMON_INCLUDE_DIRS} - ${IGNITION-MSGS_INCLUDE_DIRS}) add_library(${PROJECT_NAME}_ignition_visualization src/ignition/tesseract_ignition_visualization.cpp) target_link_libraries( @@ -128,9 +129,11 @@ if(IGNITION_FOUND) ${PROJECT_NAME}_ignition tesseract::tesseract_scene_graph tesseract::tesseract_common - ${IGNITION-COMMON_LIBRARIES} - ${IGNITION-TRANSPORT_LIBRARIES} - ${IGNITION-MSGS_LIBRARIES} + gz-common5::gz-common5-profiler + gz-common5::gz-common5-events + gz-common5::gz-common5-av + gz-transport11::gz-transport11 + gz-msg8::gz-msg8 console_bridge::console_bridge) target_compile_options(${PROJECT_NAME}_ignition_visualization PRIVATE ${TESSERACT_COMPILE_OPTIONS_PRIVATE}) target_compile_options(${PROJECT_NAME}_ignition_visualization PUBLIC ${TESSERACT_COMPILE_OPTIONS_PUBLIC}) @@ -146,9 +149,6 @@ if(IGNITION_FOUND) target_include_directories( ${PROJECT_NAME}_ignition_visualization PUBLIC "$" "$") - target_include_directories( - ${PROJECT_NAME}_ignition_visualization SYSTEM - PUBLIC ${IGNITION-COMMON_INCLUDE_DIRS} ${IGNITION-TRANSPORT_INCLUDE_DIRS} ${IGNITION-MSGS_INCLUDE_DIRS}) list( APPEND @@ -156,20 +156,20 @@ if(IGNITION_FOUND) ${PROJECT_NAME}_ignition ${PROJECT_NAME}_ignition_visualization) else() - list(APPEND IGNITION_MISSING "") - if(NOT ignition-common3_FOUND) - list(APPEND IGNITION_MISSING "ignition-common3") + list(APPEND GAZEBO_MISSING "") + if(NOT gz-common5_FOUND) + list(APPEND GAZEBO_MISSING "gz-common5") endif() - if(NOT ignition-transport8_FOUND) - list(APPEND IGNITION_MISSING "ignition-transport8") + if(NOT ignition-transport11_FOUND) + list(APPEND GAZEBO_MISSING "gz-transport11") endif() - if(NOT ignition-msgs5_FOUND) - list(APPEND IGNITION_MISSING "ignition-msgs5") + if(NOT gz-msgs8_FOUND) + list(APPEND GAZEBO_MISSING "gz-msgs8") endif() - if(NOT ignition-math6-eigen3_FOUND) - list(APPEND IGNITION_MISSING "ignition-math6-eigen3") + if(NOT gz-math7-eigen3_FOUND) + list(APPEND GAZEBO_MISSING "gz-math7-eigen3") endif() - message(STATUS "Ignition Visualization Library will not be built! Missing: ${IGNITION_MISSING}") + message(STATUS "Gazebo Visualization Library will not be built! Missing: ${GAZEBO_MISSING}") endif() configure_package(NAMESPACE tesseract TARGETS ${PACKAGE_LIBRARIES}) diff --git a/tesseract_visualization/include/tesseract_visualization/ignition/conversions.h b/tesseract_visualization/include/tesseract_visualization/ignition/conversions.h index 55b1216c51d..49ceaa0d01d 100644 --- a/tesseract_visualization/include/tesseract_visualization/ignition/conversions.h +++ b/tesseract_visualization/include/tesseract_visualization/ignition/conversions.h @@ -28,7 +28,7 @@ #include TESSERACT_COMMON_IGNORE_WARNINGS_PUSH -#include +#include TESSERACT_COMMON_IGNORE_WARNINGS_POP #include @@ -39,7 +39,7 @@ namespace tesseract_visualization { bool isMeshWithColor(const std::string& file_path); -bool toMsg(ignition::msgs::Scene& scene_msg, +bool toMsg(gz::msgs::Scene& scene_msg, EntityManager& entity_manager, const tesseract_scene_graph::SceneGraph& scene_graph, const tesseract_common::TransformMap& link_transforms); diff --git a/tesseract_visualization/include/tesseract_visualization/ignition/tesseract_ignition_visualization.h b/tesseract_visualization/include/tesseract_visualization/ignition/tesseract_ignition_visualization.h index 4d37e686e0c..d532e34f452 100644 --- a/tesseract_visualization/include/tesseract_visualization/ignition/tesseract_ignition_visualization.h +++ b/tesseract_visualization/include/tesseract_visualization/ignition/tesseract_ignition_visualization.h @@ -28,9 +28,9 @@ #include TESSERACT_COMMON_IGNORE_WARNINGS_PUSH -#include -#include -#include +#include +#include +#include TESSERACT_COMMON_IGNORE_WARNINGS_POP #include @@ -69,10 +69,10 @@ class TesseractIgnitionVisualization : public tesseract_visualization::Visualiza void waitForInput(std::string message = "Hit enter key to continue!") override; private: - ignition::transport::Node node_; /**< Ignition communication node. */ - ignition::transport::Node::Publisher scene_pub_; /**< Scene publisher */ - ignition::transport::Node::Publisher pose_pub_; /**< Pose publisher */ - ignition::transport::Node::Publisher deletion_pub_; /**< Deletion publisher */ + gz::transport::Node node_; /**< Ignition communication node. */ + gz::transport::Node::Publisher scene_pub_; /**< Scene publisher */ + gz::transport::Node::Publisher pose_pub_; /**< Pose publisher */ + gz::transport::Node::Publisher deletion_pub_; /**< Deletion publisher */ EntityManager entity_manager_; /** diff --git a/tesseract_visualization/src/ignition/conversions.cpp b/tesseract_visualization/src/ignition/conversions.cpp index 6b5cdc48fb6..e15f6dfe1ae 100644 --- a/tesseract_visualization/src/ignition/conversions.cpp +++ b/tesseract_visualization/src/ignition/conversions.cpp @@ -26,16 +26,16 @@ #include TESSERACT_COMMON_IGNORE_WARNINGS_PUSH -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include TESSERACT_COMMON_IGNORE_WARNINGS_POP @@ -58,9 +58,9 @@ bool isMeshWithColor(const std::string& file_path) return false; } -ignition::msgs::Material convert(const Eigen::Vector4d& rgba) +gz::msgs::Material convert(const Eigen::Vector4d& rgba) { - ignition::msgs::Material shape_material_msg; + gz::msgs::Material shape_material_msg; shape_material_msg.mutable_ambient()->set_r(static_cast(rgba(0))); shape_material_msg.mutable_ambient()->set_g(static_cast(rgba(1))); shape_material_msg.mutable_ambient()->set_b(static_cast(rgba(2))); @@ -79,22 +79,22 @@ ignition::msgs::Material convert(const Eigen::Vector4d& rgba) return shape_material_msg; } -bool toMsg(ignition::msgs::Scene& scene_msg, +bool toMsg(gz::msgs::Scene& scene_msg, EntityManager& entity_manager, const tesseract_scene_graph::SceneGraph& scene_graph, const tesseract_common::TransformMap& link_transforms) { scene_msg.set_name("scene"); - ignition::msgs::Model* model = scene_msg.add_model(); + gz::msgs::Model* model = scene_msg.add_model(); model->set_name(scene_graph.getName()); model->set_id(static_cast(entity_manager.addModel(scene_graph.getName()))); for (const auto& link : scene_graph.getLinks()) { - ignition::msgs::Link* link_msg = model->add_link(); + gz::msgs::Link* link_msg = model->add_link(); link_msg->set_name(link->getName()); link_msg->set_id(static_cast(entity_manager.addLink(link->getName()))); link_msg->mutable_pose()->CopyFrom( - ignition::msgs::Convert(ignition::math::eigen3::convert(link_transforms.at(link->getName())))); + gz::msgs::Convert(gz::math::eigen3::convert(link_transforms.at(link->getName())))); int cnt = 0; for (const auto& vs : link->visual) @@ -104,18 +104,18 @@ bool toMsg(ignition::msgs::Scene& scene_msg, { case tesseract_geometry::GeometryType::BOX: { - ignition::msgs::Visual* gv_msg = link_msg->add_visual(); + gz::msgs::Visual* gv_msg = link_msg->add_visual(); gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); gv_msg->set_name(gv_name); - gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(vs->origin))); + gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(vs->origin))); - ignition::msgs::Geometry geometry_msg; - geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_BOX); + gz::msgs::Geometry geometry_msg; + geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_BOX); auto shape = std::static_pointer_cast(vs->geometry); - ignition::msgs::BoxGeom shape_geometry_msg; + gz::msgs::BoxGeom shape_geometry_msg; shape_geometry_msg.mutable_size()->CopyFrom( - ignition::msgs::Convert(ignition::math::Vector3d(shape->getX(), shape->getY(), shape->getZ()))); + gz::msgs::Convert(gz::math::Vector3d(shape->getX(), shape->getY(), shape->getZ()))); geometry_msg.mutable_box()->CopyFrom(shape_geometry_msg); gv_msg->mutable_geometry()->CopyFrom(geometry_msg); @@ -130,16 +130,16 @@ bool toMsg(ignition::msgs::Scene& scene_msg, } case tesseract_geometry::GeometryType::SPHERE: { - ignition::msgs::Visual* gv_msg = link_msg->add_visual(); + gz::msgs::Visual* gv_msg = link_msg->add_visual(); gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); gv_msg->set_name(gv_name); - gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(vs->origin))); + gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(vs->origin))); - ignition::msgs::Geometry geometry_msg; - geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_SPHERE); + gz::msgs::Geometry geometry_msg; + geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_SPHERE); auto shape = std::static_pointer_cast(vs->geometry); - ignition::msgs::SphereGeom shape_geometry_msg; + gz::msgs::SphereGeom shape_geometry_msg; shape_geometry_msg.set_radius(shape->getRadius()); geometry_msg.mutable_sphere()->CopyFrom(shape_geometry_msg); gv_msg->mutable_geometry()->CopyFrom(geometry_msg); @@ -155,16 +155,16 @@ bool toMsg(ignition::msgs::Scene& scene_msg, } case tesseract_geometry::GeometryType::CYLINDER: { - ignition::msgs::Visual* gv_msg = link_msg->add_visual(); + gz::msgs::Visual* gv_msg = link_msg->add_visual(); gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); gv_msg->set_name(gv_name); - gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(vs->origin))); + gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(vs->origin))); - ignition::msgs::Geometry geometry_msg; - geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_CYLINDER); + gz::msgs::Geometry geometry_msg; + geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_CYLINDER); auto shape = std::static_pointer_cast(vs->geometry); - ignition::msgs::CylinderGeom shape_geometry_msg; + gz::msgs::CylinderGeom shape_geometry_msg; shape_geometry_msg.set_radius(shape->getRadius()); shape_geometry_msg.set_length(shape->getLength()); geometry_msg.mutable_cylinder()->CopyFrom(shape_geometry_msg); @@ -181,16 +181,16 @@ bool toMsg(ignition::msgs::Scene& scene_msg, } // case tesseract_geometry::GeometryType::CONE: // { - // ignition::msgs::Visual* gv_msg = link_msg->add_visual(); + // gz::msgs::Visual* gv_msg = link_msg->add_visual(); // gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); // gv_msg->set_name(gv_name); - // gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(vs->origin))); + // gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(vs->origin))); - // ignition::msgs::Geometry geometry_msg; - // geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_CONE); + // gz::msgs::Geometry geometry_msg; + // geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_CONE); // auto shape = std::static_pointer_cast(vs->geometry); - // ignition::msgs::ConeGeom shape_geometry_msg; + // gz::msgs::ConeGeom shape_geometry_msg; // shape_geometry_msg.set_radius(shape->getRadius()); // shape_geometry_msg.set_length(shape->getLength()); // geometry_msg.mutable_sphere()->CopyFrom(shape_geometry_msg); @@ -208,16 +208,16 @@ bool toMsg(ignition::msgs::Scene& scene_msg, // case tesseract_geometry::GeometryType::CAPSULE: // { - // ignition::msgs::Visual* gv_msg = link_msg->add_visual(); + // gz::msgs::Visual* gv_msg = link_msg->add_visual(); // gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); // gv_msg->set_name(gv_name); - // gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(vs->origin))); + // gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(vs->origin))); - // ignition::msgs::Geometry geometry_msg; - // geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_CAPSULE); + // gz::msgs::Geometry geometry_msg; + // geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_CAPSULE); // auto shape = std::static_pointer_cast(vs->geometry); - // ignition::msgs::CapsuleGeom shape_geometry_msg; + // gz::msgs::CapsuleGeom shape_geometry_msg; // shape_geometry_msg.set_radius(shape->getRadius()); // shape_geometry_msg.set_length(shape->getLength()); // geometry_msg.mutable_sphere()->CopyFrom(shape_geometry_msg); @@ -234,22 +234,22 @@ bool toMsg(ignition::msgs::Scene& scene_msg, // } case tesseract_geometry::GeometryType::MESH: { - ignition::msgs::Visual* gv_msg = link_msg->add_visual(); + gz::msgs::Visual* gv_msg = link_msg->add_visual(); gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); gv_msg->set_name(gv_name); - gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(vs->origin))); + gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(vs->origin))); - ignition::msgs::Geometry geometry_msg; - geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_MESH); + gz::msgs::Geometry geometry_msg; + geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_MESH); auto shape = std::static_pointer_cast(vs->geometry); auto resource = shape->getResource(); if (resource) { - ignition::msgs::MeshGeom shape_geometry_msg; + gz::msgs::MeshGeom shape_geometry_msg; shape_geometry_msg.set_filename(resource->getFilePath()); shape_geometry_msg.mutable_scale()->CopyFrom( - ignition::msgs::Convert(ignition::math::eigen3::convert(shape->getScale()))); + gz::msgs::Convert(gz::math::eigen3::convert(shape->getScale()))); geometry_msg.mutable_mesh()->CopyFrom(shape_geometry_msg); gv_msg->mutable_geometry()->CopyFrom(geometry_msg); @@ -270,22 +270,22 @@ bool toMsg(ignition::msgs::Scene& scene_msg, } case tesseract_geometry::GeometryType::CONVEX_MESH: { - ignition::msgs::Visual* gv_msg = link_msg->add_visual(); + gz::msgs::Visual* gv_msg = link_msg->add_visual(); gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); gv_msg->set_name(gv_name); - gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(vs->origin))); + gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(vs->origin))); - ignition::msgs::Geometry geometry_msg; - geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_MESH); + gz::msgs::Geometry geometry_msg; + geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_MESH); auto shape = std::static_pointer_cast(vs->geometry); auto resource = shape->getResource(); if (resource) { - ignition::msgs::MeshGeom shape_geometry_msg; + gz::msgs::MeshGeom shape_geometry_msg; shape_geometry_msg.set_filename(resource->getFilePath()); shape_geometry_msg.mutable_scale()->CopyFrom( - ignition::msgs::Convert(ignition::math::eigen3::convert(shape->getScale()))); + gz::msgs::Convert(gz::math::eigen3::convert(shape->getScale()))); geometry_msg.mutable_mesh()->CopyFrom(shape_geometry_msg); gv_msg->mutable_geometry()->CopyFrom(geometry_msg); diff --git a/tesseract_visualization/src/ignition/tesseract_ignition_visualization.cpp b/tesseract_visualization/src/ignition/tesseract_ignition_visualization.cpp index 05f7c2443cf..4264047ada7 100644 --- a/tesseract_visualization/src/ignition/tesseract_ignition_visualization.cpp +++ b/tesseract_visualization/src/ignition/tesseract_ignition_visualization.cpp @@ -26,9 +26,9 @@ #include TESSERACT_COMMON_IGNORE_WARNINGS_PUSH -#include -#include -#include +#include +#include +#include #include #include TESSERACT_COMMON_IGNORE_WARNINGS_POP @@ -42,13 +42,13 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include -/** @brief Message type is ignition::msgs::Scene */ +/** @brief Message type is gz::msgs::Scene */ static const std::string DEFAULT_SCENE_TOPIC_NAME = "/tesseract_ignition/topic/scene"; -/** @brief Message type is ignition::msgs::Pose_V */ +/** @brief Message type is gz::msgs::Pose_V */ static const std::string DEFAULT_POSE_TOPIC_NAME = "/tesseract_ignition/topic/pose"; -/** @brief Message type is ignition::msgs::UInt32_V */ +/** @brief Message type is gz::msgs::UInt32_V */ static const std::string DEFAULT_DELETION_TOPIC_NAME = "/tesseract_ignition/topic/deletion"; static const std::string COLLISION_RESULTS_MODEL_NAME = "tesseract_collision_results_model"; @@ -60,9 +60,9 @@ namespace tesseract_visualization { TesseractIgnitionVisualization::TesseractIgnitionVisualization() { - scene_pub_ = node_.Advertise(DEFAULT_SCENE_TOPIC_NAME); - pose_pub_ = node_.Advertise(DEFAULT_POSE_TOPIC_NAME); - deletion_pub_ = node_.Advertise(DEFAULT_DELETION_TOPIC_NAME); + scene_pub_ = node_.Advertise(DEFAULT_SCENE_TOPIC_NAME); + pose_pub_ = node_.Advertise(DEFAULT_POSE_TOPIC_NAME); + deletion_pub_ = node_.Advertise(DEFAULT_DELETION_TOPIC_NAME); } bool TesseractIgnitionVisualization::isConnected() const @@ -86,7 +86,7 @@ void TesseractIgnitionVisualization::waitForConnection(long seconds) const void TesseractIgnitionVisualization::plotEnvironment(const tesseract_environment::Environment& env, std::string /*ns*/) { - ignition::msgs::Scene msg; + gz::msgs::Scene msg; toMsg(msg, entity_manager_, *(env.getSceneGraph()), env.getState().link_transforms); scene_pub_.Publish(msg); } @@ -110,23 +110,23 @@ void TesseractIgnitionVisualization::plotTrajectory(const tesseract_common::Join } } -void addArrow(EntityManager& entity_manager, ignition::msgs::Link& link, long& sub_index, const ArrowMarker& marker) +void addArrow(EntityManager& entity_manager, gz::msgs::Link& link, long& sub_index, const ArrowMarker& marker) { std::string gv_name = link.name() + "_" + std::to_string(++sub_index); - ignition::msgs::Visual* gv_msg = link.add_visual(); + gz::msgs::Visual* gv_msg = link.add_visual(); gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); gv_msg->set_name(gv_name); - gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(marker.pose))); + gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(marker.pose))); - ignition::msgs::Geometry geometry_msg; - geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_CYLINDER); - ignition::msgs::CylinderGeom shape_geometry_msg; + gz::msgs::Geometry geometry_msg; + geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_CYLINDER); + gz::msgs::CylinderGeom shape_geometry_msg; shape_geometry_msg.set_radius(marker.shaft_radius); shape_geometry_msg.set_length(marker.shaft_length); geometry_msg.mutable_cylinder()->CopyFrom(shape_geometry_msg); gv_msg->mutable_geometry()->CopyFrom(geometry_msg); - ignition::msgs::Material shape_material_msg; + gz::msgs::Material shape_material_msg; shape_material_msg.mutable_diffuse()->set_r(static_cast(marker.material->color(0))); shape_material_msg.mutable_diffuse()->set_g(static_cast(marker.material->color(1))); shape_material_msg.mutable_diffuse()->set_b(static_cast(marker.material->color(2))); @@ -136,7 +136,7 @@ void addArrow(EntityManager& entity_manager, ignition::msgs::Link& link, long& s } void addCylinder(EntityManager& entity_manager, - ignition::msgs::Link& link, + gz::msgs::Link& link, long& sub_index, const Eigen::Ref& pt1, const Eigen::Ref& pt2, @@ -144,7 +144,7 @@ void addCylinder(EntityManager& entity_manager, const Eigen::Vector3d& /*scale*/) { std::string gv_name = link.name() + "_" + std::to_string(++sub_index); - ignition::msgs::Visual* gv_msg = link.add_visual(); + gz::msgs::Visual* gv_msg = link.add_visual(); gv_msg->set_id(static_cast(entity_manager.addVisual(gv_name))); gv_msg->set_name(gv_name); @@ -160,16 +160,16 @@ void addCylinder(EntityManager& entity_manager, pose.linear() = rot; pose.translation() = pt1 + (((pt2 - pt1).norm() / 2) * z); - gv_msg->mutable_pose()->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(pose))); + gv_msg->mutable_pose()->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(pose))); - ignition::msgs::Geometry geometry_msg; - geometry_msg.set_type(ignition::msgs::Geometry::Type::Geometry_Type_CYLINDER); - ignition::msgs::CylinderGeom shape_geometry_msg; + gz::msgs::Geometry geometry_msg; + geometry_msg.set_type(gz::msgs::Geometry::Type::Geometry_Type_CYLINDER); + gz::msgs::CylinderGeom shape_geometry_msg; shape_geometry_msg.set_radius(1); /** @todo LEVI fix */ shape_geometry_msg.set_length((pt2 - pt1).norm()); geometry_msg.mutable_cylinder()->CopyFrom(shape_geometry_msg); gv_msg->mutable_geometry()->CopyFrom(geometry_msg); - ignition::msgs::Material shape_material_msg; + gz::msgs::Material shape_material_msg; shape_material_msg.mutable_diffuse()->set_r(static_cast(material.color(0))); shape_material_msg.mutable_diffuse()->set_g(static_cast(material.color(1))); shape_material_msg.mutable_diffuse()->set_b(static_cast(material.color(2))); @@ -178,7 +178,7 @@ void addCylinder(EntityManager& entity_manager, gv_msg->set_parent_name(link.name()); } -void addAxis(EntityManager& entity_manager, ignition::msgs::Link& link, long& sub_index, const AxisMarker& m) +void addAxis(EntityManager& entity_manager, gz::msgs::Link& link, long& sub_index, const AxisMarker& m) { Eigen::Vector3d x_axis = m.axis.matrix().block<3, 1>(0, 0); Eigen::Vector3d y_axis = m.axis.matrix().block<3, 1>(0, 1); @@ -207,16 +207,16 @@ void TesseractIgnitionVisualization::plotMarker(const Marker& marker, std::strin case static_cast(MarkerType::ARROW): { const auto& m = dynamic_cast(marker); - ignition::msgs::Scene scene_msg; + gz::msgs::Scene scene_msg; scene_msg.set_name("scene"); - ignition::msgs::Model* model = scene_msg.add_model(); + gz::msgs::Model* model = scene_msg.add_model(); std::string model_name = ARROW_MODEL_NAME; model->set_name(model_name); model->set_id(static_cast(entity_manager_.addModel(model_name))); long cnt = 0; std::string link_name = model_name + std::to_string(++cnt); - ignition::msgs::Link* link_msg = model->add_link(); + gz::msgs::Link* link_msg = model->add_link(); link_msg->set_id(static_cast(entity_manager_.addVisual(link_name))); link_msg->set_name(link_name); addArrow(entity_manager_, *link_msg, cnt, m); @@ -227,16 +227,16 @@ void TesseractIgnitionVisualization::plotMarker(const Marker& marker, std::strin { const auto& m = dynamic_cast(marker); - ignition::msgs::Scene scene_msg; + gz::msgs::Scene scene_msg; scene_msg.set_name("scene"); - ignition::msgs::Model* model = scene_msg.add_model(); + gz::msgs::Model* model = scene_msg.add_model(); std::string model_name = AXES_MODEL_NAME; model->set_name(model_name); model->set_id(static_cast(entity_manager_.addModel(model_name))); long cnt = 0; std::string link_name = model_name + std::to_string(++cnt); - ignition::msgs::Link* link_msg = model->add_link(); + gz::msgs::Link* link_msg = model->add_link(); link_msg->set_id(static_cast(entity_manager_.addVisual(link_name))); link_msg->set_name(link_name); addAxis(entity_manager_, *link_msg, cnt, m.axis); @@ -247,9 +247,9 @@ void TesseractIgnitionVisualization::plotMarker(const Marker& marker, std::strin { const auto& m = dynamic_cast(marker); - ignition::msgs::Scene scene_msg; + gz::msgs::Scene scene_msg; scene_msg.set_name("scene"); - ignition::msgs::Model* model = scene_msg.add_model(); + gz::msgs::Model* model = scene_msg.add_model(); std::string model_name = COLLISION_RESULTS_MODEL_NAME; model->set_name(model_name); model->set_id(static_cast(entity_manager_.addModel(model_name))); @@ -261,7 +261,7 @@ void TesseractIgnitionVisualization::plotMarker(const Marker& marker, std::strin double safety_distance = m.margin_data.getPairCollisionMargin(dist.link_names[0], dist.link_names[1]); std::string link_name = model_name + std::to_string(++cnt); - ignition::msgs::Link* link_msg = model->add_link(); + gz::msgs::Link* link_msg = model->add_link(); link_msg->set_id(static_cast(entity_manager_.addVisual(link_name))); link_msg->set_name(link_name); @@ -340,7 +340,7 @@ void TesseractIgnitionVisualization::plotMarkers(const std::vector& void TesseractIgnitionVisualization::clear(std::string /*ns*/) { - ignition::msgs::UInt32_V deletion_msg; + gz::msgs::UInt32_V deletion_msg; long id = entity_manager_.getModel(COLLISION_RESULTS_MODEL_NAME); if (id >= 1000) deletion_msg.add_data(static_cast(id)); @@ -364,11 +364,11 @@ void TesseractIgnitionVisualization::waitForInput(std::string message) void TesseractIgnitionVisualization::sendSceneState(const tesseract_scene_graph::SceneState& scene_state) { - ignition::msgs::Pose_V pose_v; + gz::msgs::Pose_V pose_v; for (const auto& pair : scene_state.link_transforms) { - ignition::msgs::Pose* pose = pose_v.add_pose(); - pose->CopyFrom(ignition::msgs::Convert(ignition::math::eigen3::convert(pair.second))); + gz::msgs::Pose* pose = pose_v.add_pose(); + pose->CopyFrom(gz::msgs::Convert(gz::math::eigen3::convert(pair.second))); pose->set_name(pair.first); pose->set_id(static_cast(entity_manager_.getLink(pair.first))); } @@ -431,9 +431,9 @@ void TesseractIgnitionVisualization::sendSceneState(const tesseract_scene_graph: //{ // using namespace tesseract_planning; -// ignition::msgs::Scene scene_msg; +// gz::msgs::Scene scene_msg; // scene_msg.set_name("scene"); -// ignition::msgs::Model* model = scene_msg.add_model(); +// gz::msgs::Model* model = scene_msg.add_model(); // std::string model_name = TOOL_PATH_MODEL_NAME; // model->set_name(model_name); // model->set_id(static_cast(entity_manager_.addModel(model_name))); @@ -465,7 +465,7 @@ void TesseractIgnitionVisualization::sendSceneState(const tesseract_scene_graph: // tesseract_common::ManipulatorInfo manip_info; // std::string link_name = model_name + std::to_string(++cnt); -// ignition::msgs::Link* link_msg = model->add_link(); +// gz::msgs::Link* link_msg = model->add_link(); // link_msg->set_id(static_cast(entity_manager_.addVisual(link_name))); // link_msg->set_name(link_name); @@ -529,7 +529,7 @@ void TesseractIgnitionVisualization::sendSceneState(const tesseract_scene_graph: // { // long cnt = 0; // std::string link_name = model_name + std::to_string(++cnt); -// ignition::msgs::Link* link_msg = model->add_link(); +// gz::msgs::Link* link_msg = model->add_link(); // link_msg->set_id(static_cast(entity_manager_.addVisual(link_name))); // link_msg->set_name(link_name);