Skip to content

Commit

Permalink
Added capsule and ellipsoid geom msgs (#128)
Browse files Browse the repository at this point in the history
* Added capsule and ellipsoid geom msgs

Signed-off-by: ahcorde <[email protected]>

* Document new fields

Signed-off-by: ahcorde <[email protected]>
  • Loading branch information
ahcorde authored Jan 26, 2021
1 parent b581eb1 commit 249f1ec
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 6 deletions.
38 changes: 38 additions & 0 deletions proto/ignition/msgs/capsulegeom.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2021 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

syntax = "proto3";
package ignition.msgs;
option java_package = "com.ignition.msgs";
option java_outer_classname = "CapsuleGeomProtos";

/// \ingroup ignition.msgs
/// \interface CapsuleGeom
/// \brief Information about a capsule geometry

import "ignition/msgs/header.proto";

message CapsuleGeom
{
/// \brief Optional header data
Header header = 1;

/// \brief Radius of the capsule
double radius = 2;
/// \brief Height of the cylinder
double length = 3;
}
37 changes: 37 additions & 0 deletions proto/ignition/msgs/ellipsoidgeom.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2021 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

syntax = "proto3";
package ignition.msgs;
option java_package = "com.ignition.msgs";
option java_outer_classname = "EllipsoidGeomProtos";

/// \ingroup ignition.msgs
/// \interface EllipsoidGeom
/// \brief Information about a ellipsoid geometry

import "ignition/msgs/header.proto";
import "ignition/msgs/vector3d.proto";

message EllipsoidGeom
{
/// \brief Optional header data
Header header = 1;

/// \brief 3D Vector with the three radius that define a ellipsoid
Vector3d radii = 2;
}
18 changes: 12 additions & 6 deletions proto/ignition/msgs/geometry.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ option java_outer_classname = "GeometryProtos";
/// \interface Geometry
/// \brief Information about a geometry element

import "ignition/msgs/header.proto";
import "ignition/msgs/boxgeom.proto";
import "ignition/msgs/capsulegeom.proto";
import "ignition/msgs/conegeom.proto";
import "ignition/msgs/cylindergeom.proto";
import "ignition/msgs/spheregeom.proto";
import "ignition/msgs/planegeom.proto";
import "ignition/msgs/imagegeom.proto";
import "ignition/msgs/ellipsoidgeom.proto";
import "ignition/msgs/header.proto";
import "ignition/msgs/heightmapgeom.proto";
import "ignition/msgs/imagegeom.proto";
import "ignition/msgs/meshgeom.proto";
import "ignition/msgs/vector3d.proto";
import "ignition/msgs/planegeom.proto";
import "ignition/msgs/polylinegeom.proto";
import "ignition/msgs/conegeom.proto";
import "ignition/msgs/spheregeom.proto";
import "ignition/msgs/vector3d.proto";

message Geometry
{
Expand All @@ -54,6 +56,8 @@ message Geometry
EMPTY = 11;
ARROW = 12;
AXIS = 13;
CAPSULE = 14;
ELLIPSOID = 15;
}

/// \brief Optional header data
Expand All @@ -68,6 +72,8 @@ message Geometry
HeightmapGeom heightmap = 8;
MeshGeom mesh = 9;
ConeGeom cone = 10;
CapsuleGeom capsule = 13;
EllipsoidGeom ellipsoid = 14;

repeated Vector3d points = 11;
repeated Polyline polyline = 12;
Expand Down
2 changes: 2 additions & 0 deletions proto/ignition/msgs/marker.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ message Marker
CONE = 11;
ARROW = 12;
AXIS = 13;
CAPSULE = 14;
ELLIPSOID = 15;
}

/// \brief Visilibity defines what cameras render the marker.
Expand Down
18 changes: 18 additions & 0 deletions src/Utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,18 @@ namespace ignition
{
result = msgs::Geometry::BOX;
}
else if (_str == "capsule")
{
result = msgs::Geometry::CAPSULE;
}
else if (_str == "cylinder")
{
result = msgs::Geometry::CYLINDER;
}
else if (_str == "ellipsoid")
{
result = msgs::Geometry::ELLIPSOID;
}
else if (_str == "sphere")
{
result = msgs::Geometry::SPHERE;
Expand Down Expand Up @@ -644,11 +652,21 @@ namespace ignition
result = "box";
break;
}
case msgs::Geometry::CAPSULE:
{
result = "capsule";
break;
}
case msgs::Geometry::CYLINDER:
{
result = "cylinder";
break;
}
case msgs::Geometry::ELLIPSOID:
{
result = "ellipsoid";
break;
}
case msgs::Geometry::SPHERE:
{
result = "sphere";
Expand Down
2 changes: 2 additions & 0 deletions src/Utility_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,9 @@ TEST(MsgsTest, ConvertMsgsGeometryTypeToString)
{
CompareMsgsGeometryTypeToString(msgs::Geometry::BOX);
CompareMsgsGeometryTypeToString(msgs::Geometry::SPHERE);
CompareMsgsGeometryTypeToString(msgs::Geometry::CAPSULE);
CompareMsgsGeometryTypeToString(msgs::Geometry::CYLINDER);
CompareMsgsGeometryTypeToString(msgs::Geometry::ELLIPSOID);
CompareMsgsGeometryTypeToString(msgs::Geometry::PLANE);
CompareMsgsGeometryTypeToString(msgs::Geometry::IMAGE);
CompareMsgsGeometryTypeToString(msgs::Geometry::HEIGHTMAP);
Expand Down

0 comments on commit 249f1ec

Please sign in to comment.