Skip to content

Commit 249f1ec

Browse files
authored
Added capsule and ellipsoid geom msgs (#128)
* Added capsule and ellipsoid geom msgs Signed-off-by: ahcorde <ahcorde@gmail.com> * Document new fields Signed-off-by: ahcorde <ahcorde@gmail.com>
1 parent b581eb1 commit 249f1ec

File tree

6 files changed

+109
-6
lines changed

6 files changed

+109
-6
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (C) 2021 Open Source Robotics Foundation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
syntax = "proto3";
19+
package ignition.msgs;
20+
option java_package = "com.ignition.msgs";
21+
option java_outer_classname = "CapsuleGeomProtos";
22+
23+
/// \ingroup ignition.msgs
24+
/// \interface CapsuleGeom
25+
/// \brief Information about a capsule geometry
26+
27+
import "ignition/msgs/header.proto";
28+
29+
message CapsuleGeom
30+
{
31+
/// \brief Optional header data
32+
Header header = 1;
33+
34+
/// \brief Radius of the capsule
35+
double radius = 2;
36+
/// \brief Height of the cylinder
37+
double length = 3;
38+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (C) 2021 Open Source Robotics Foundation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
syntax = "proto3";
19+
package ignition.msgs;
20+
option java_package = "com.ignition.msgs";
21+
option java_outer_classname = "EllipsoidGeomProtos";
22+
23+
/// \ingroup ignition.msgs
24+
/// \interface EllipsoidGeom
25+
/// \brief Information about a ellipsoid geometry
26+
27+
import "ignition/msgs/header.proto";
28+
import "ignition/msgs/vector3d.proto";
29+
30+
message EllipsoidGeom
31+
{
32+
/// \brief Optional header data
33+
Header header = 1;
34+
35+
/// \brief 3D Vector with the three radius that define a ellipsoid
36+
Vector3d radii = 2;
37+
}

proto/ignition/msgs/geometry.proto

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@ option java_outer_classname = "GeometryProtos";
2424
/// \interface Geometry
2525
/// \brief Information about a geometry element
2626

27-
import "ignition/msgs/header.proto";
2827
import "ignition/msgs/boxgeom.proto";
28+
import "ignition/msgs/capsulegeom.proto";
29+
import "ignition/msgs/conegeom.proto";
2930
import "ignition/msgs/cylindergeom.proto";
30-
import "ignition/msgs/spheregeom.proto";
31-
import "ignition/msgs/planegeom.proto";
32-
import "ignition/msgs/imagegeom.proto";
31+
import "ignition/msgs/ellipsoidgeom.proto";
32+
import "ignition/msgs/header.proto";
3333
import "ignition/msgs/heightmapgeom.proto";
34+
import "ignition/msgs/imagegeom.proto";
3435
import "ignition/msgs/meshgeom.proto";
35-
import "ignition/msgs/vector3d.proto";
36+
import "ignition/msgs/planegeom.proto";
3637
import "ignition/msgs/polylinegeom.proto";
37-
import "ignition/msgs/conegeom.proto";
38+
import "ignition/msgs/spheregeom.proto";
39+
import "ignition/msgs/vector3d.proto";
3840

3941
message Geometry
4042
{
@@ -54,6 +56,8 @@ message Geometry
5456
EMPTY = 11;
5557
ARROW = 12;
5658
AXIS = 13;
59+
CAPSULE = 14;
60+
ELLIPSOID = 15;
5761
}
5862

5963
/// \brief Optional header data
@@ -68,6 +72,8 @@ message Geometry
6872
HeightmapGeom heightmap = 8;
6973
MeshGeom mesh = 9;
7074
ConeGeom cone = 10;
75+
CapsuleGeom capsule = 13;
76+
EllipsoidGeom ellipsoid = 14;
7177

7278
repeated Vector3d points = 11;
7379
repeated Polyline polyline = 12;

proto/ignition/msgs/marker.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ message Marker
4949
CONE = 11;
5050
ARROW = 12;
5151
AXIS = 13;
52+
CAPSULE = 14;
53+
ELLIPSOID = 15;
5254
}
5355

5456
/// \brief Visilibity defines what cameras render the marker.

src/Utility.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,18 @@ namespace ignition
594594
{
595595
result = msgs::Geometry::BOX;
596596
}
597+
else if (_str == "capsule")
598+
{
599+
result = msgs::Geometry::CAPSULE;
600+
}
597601
else if (_str == "cylinder")
598602
{
599603
result = msgs::Geometry::CYLINDER;
600604
}
605+
else if (_str == "ellipsoid")
606+
{
607+
result = msgs::Geometry::ELLIPSOID;
608+
}
601609
else if (_str == "sphere")
602610
{
603611
result = msgs::Geometry::SPHERE;
@@ -644,11 +652,21 @@ namespace ignition
644652
result = "box";
645653
break;
646654
}
655+
case msgs::Geometry::CAPSULE:
656+
{
657+
result = "capsule";
658+
break;
659+
}
647660
case msgs::Geometry::CYLINDER:
648661
{
649662
result = "cylinder";
650663
break;
651664
}
665+
case msgs::Geometry::ELLIPSOID:
666+
{
667+
result = "ellipsoid";
668+
break;
669+
}
652670
case msgs::Geometry::SPHERE:
653671
{
654672
result = "sphere";

src/Utility_TEST.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,9 @@ TEST(MsgsTest, ConvertMsgsGeometryTypeToString)
577577
{
578578
CompareMsgsGeometryTypeToString(msgs::Geometry::BOX);
579579
CompareMsgsGeometryTypeToString(msgs::Geometry::SPHERE);
580+
CompareMsgsGeometryTypeToString(msgs::Geometry::CAPSULE);
580581
CompareMsgsGeometryTypeToString(msgs::Geometry::CYLINDER);
582+
CompareMsgsGeometryTypeToString(msgs::Geometry::ELLIPSOID);
581583
CompareMsgsGeometryTypeToString(msgs::Geometry::PLANE);
582584
CompareMsgsGeometryTypeToString(msgs::Geometry::IMAGE);
583585
CompareMsgsGeometryTypeToString(msgs::Geometry::HEIGHTMAP);

0 commit comments

Comments
 (0)