Skip to content

Commit

Permalink
Merged in issue_101_pose (pull request gazebosim#329)
Browse files Browse the repository at this point in the history
8. Updating pose

Approved-by: Steve Peters <[email protected]>
  • Loading branch information
nkoenig committed Apr 7, 2020
2 parents 6d63416 + 99f1850 commit 1555267
Show file tree
Hide file tree
Showing 12 changed files with 355 additions and 72 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
* [Pull request 319](https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/319)

1. Updates per issue #101.
* Quaternion: [Pull request 327](https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/327)
* Matrix3: [Pull request 328](https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/328)
* Pose: [Pull request 329](https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/329)
* Quaternion: [Pull request 327](https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/327)

1. Removed deprecations.
* [Pull request 320](https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/320)
Expand Down
3 changes: 3 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ target_link_libraries(graph_example ignition-math${IGN_MATH_VER}::ignition-math$
add_executable(matrix3_example matrix3_example.cc)
target_link_libraries(matrix3_example ignition-math${IGN_MATH_VER}::ignition-math${IGN_MATH_VER})

add_executable(pose3_example pose3_example.cc)
target_link_libraries(pose3_example ignition-math${IGN_MATH_VER}::ignition-math${IGN_MATH_VER})

add_executable(quaternion_example quaternion_example.cc)
target_link_libraries(quaternion_example ignition-math${IGN_MATH_VER}::ignition-math${IGN_MATH_VER})

Expand Down
41 changes: 41 additions & 0 deletions examples/pose3_example.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2019 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.
*
*/
//! [complete]
#include <iostream>
#include <ignition/math/Pose3.hh>

int main(int argc, char **argv)
{
// Construct a default Pose3d.
ignition::math::Pose3d p;
std::cout << "A default Pose3d has the following values\n"
<< p << std::endl;

// Construct a pose at position 1, 2, 3 with a yaw of PI radians.
ignition::math::Pose3d p1(1, 2, 3, 0, 0, IGN_PI);
std::cout << "A pose3d(1, 2, 3, 0, 0, IGN_PI) has the following values\n"
<< p1 << std::endl;

// Set the position of a pose to 10, 20, 30
p.Pos().Set(10, 20, 30);

// Combine two poses, and store the result in a new pose
ignition::math::Pose3d p3 = p * p1;
std::cout << "Result of adding two poses together is\n"
<< p3 << std::endl;
}
//! [complete]
43 changes: 43 additions & 0 deletions examples/pose3_example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (C) 2019 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.

# This example will only work if the Ruby interface library was compiled and
# installed.
#
# Modify the RUBYLIB environment variable to include the ignition math
# library install path. For example, if you install to /user:
#
# $ export RUBYLIB=/usr/lib/ruby:$RUBYLIB
#
require 'ignition/math'

# Construct a default Pose3d.
p = Ignition::Math::Pose3d.new
printf("A default Pose3d has the following values\n" +
"%f %f %f %f %f %f\n", p.Pos().X(), p.Pos().Y(), p.Pos().Z(),
p.Rot().Euler().X(), p.Rot().Euler().Y(), p.Rot().Euler().Z())

# Construct a pose at position 1, 2, 3 with a yaw of PI radians.
p1 = Ignition::Math::Pose3d.new(1, 2, 3, 0, 0, Math::PI)
printf("A pose3d(1, 2, 3, 0, 0, IGN_PI) has the following values\n" +
"%f %f %f %f %f %f\n", p1.Pos().X(), p1.Pos().Y(), p1.Pos().Z(),
p1.Rot().Euler().X(), p1.Rot().Euler().Y(), p1.Rot().Euler().Z())

# Set the position of a pose to 10, 20, 30
p.Pos().Set(10, 20, 30)

p3 = p * p1
printf("Result of combining two poses is\n"+
"%f %f %f %f %f %f\n", p3.Pos().X(), p3.Pos().Y(), p3.Pos().Z(),
p3.Rot().Euler().X(), p3.Rot().Euler().Y(), p3.Rot().Euler().Z())
1 change: 0 additions & 1 deletion include/ignition/math/OrientedBox.hh
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ namespace ignition
private: ignition::math::Material material;
};

typedef OrientedBox<int> OrientedBoxi;
typedef OrientedBox<double> OrientedBoxd;
typedef OrientedBox<float> OrientedBoxf;
}
Expand Down
Loading

0 comments on commit 1555267

Please sign in to comment.