frames_io.hpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /***************************************************************************
  2. frames_io.h - description
  3. -------------------------
  4. begin : June 2006
  5. copyright : (C) 2006 Erwin Aertbelien
  6. email : firstname.lastname@mech.kuleuven.ac.be
  7. History (only major changes)( AUTHOR-Description ) :
  8. Ruben Smits - Added output for jacobian and jntarray 06/2007
  9. ***************************************************************************
  10. * This library is free software; you can redistribute it and/or *
  11. * modify it under the terms of the GNU Lesser General Public *
  12. * License as published by the Free Software Foundation; either *
  13. * version 2.1 of the License, or (at your option) any later version. *
  14. * *
  15. * This library is distributed in the hope that it will be useful, *
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
  18. * Lesser General Public License for more details. *
  19. * *
  20. * You should have received a copy of the GNU Lesser General Public *
  21. * License along with this library; if not, write to the Free Software *
  22. * Foundation, Inc., 51 Franklin Street, *
  23. * Fifth Floor, Boston, MA 02110-1301, USA. *
  24. * *
  25. ***************************************************************************/
  26. /**
  27. //
  28. // \file
  29. // Defines routines for I/O of Frame and related objects.
  30. // \verbatim
  31. // Spaces, tabs and newlines do not have any importance.
  32. // Comments are allowed C-style,C++-style, make/perl/csh -style
  33. // Description of the I/O :
  34. // Vector : OUTPUT : e.g. [10,20,30]
  35. // INPUT :
  36. // 1) [10,20,30]
  37. // 2) Zero
  38. // Twist : e.g. [1,2,3,4,5,6]
  39. // where [1,2,3] is velocity vector
  40. // where [4,5,6] is rotational velocity vector
  41. // Wrench : e.g. [1,2,3,4,5,6]
  42. // where [1,2,3] represents a force vector
  43. // where [4,5,6] represents a torque vector
  44. // Rotation : output :
  45. // [1,2,3;
  46. // 4,5,6;
  47. // 7,8,9] cfr definition of Rotation object.
  48. // input :
  49. // 1) like the output
  50. // 2) EulerZYX,EulerZYZ,RPY word followed by a vector, e.g. :
  51. // Eulerzyx[10,20,30]
  52. // (ANGLES are always expressed in DEGREES for I/O)
  53. // (ANGELS are always expressed in RADIANS for internal representation)
  54. // 3) Rot [1,2,3] [20] Rotates around axis [1,2,3] with an angle
  55. // of 20 degrees.
  56. // 4) Identity returns identity rotation matrix.
  57. // Frames : output : [ Rotationmatrix positionvector ]
  58. // e.g. [ [1,0,0;0,1,0;0,0,1] [1,2,3] ]
  59. // Input :
  60. // 1) [ Rotationmatrix positionvector ]
  61. // 2) DH [ 10,10,50,30] Denavit-Hartenberg representation
  62. // ( is in fact not the representation of a Frame, but more
  63. // limited, cfr. documentation of Frame object.)
  64. // \endverbatim
  65. //
  66. // \warning
  67. // You can use iostream.h or iostream header files for file I/O,
  68. // if one declares the define WANT_STD_IOSTREAM then the standard C++
  69. // iostreams headers are included instead of the compiler-dependent version
  70. //
  71. *
  72. ****************************************************************************/
  73. #ifndef FRAMES_IO_H
  74. #define FRAMES_IO_H
  75. #include "utilities/utility_io.h"
  76. #include "frames.hpp"
  77. #include "jntarray.hpp"
  78. #include "jacobian.hpp"
  79. namespace KDL {
  80. //! width to be used when printing variables out with frames_io.h
  81. //! global variable, can be changed.
  82. // I/O to C++ stream.
  83. std::ostream& operator << (std::ostream& os,const Vector& v);
  84. std::ostream& operator << (std::ostream& os,const Rotation& R);
  85. std::ostream& operator << (std::ostream& os,const Frame& T);
  86. std::ostream& operator << (std::ostream& os,const Twist& T);
  87. std::ostream& operator << (std::ostream& os,const Wrench& T);
  88. std::ostream& operator << (std::ostream& os,const Vector2& v);
  89. std::ostream& operator << (std::ostream& os,const Rotation2& R);
  90. std::ostream& operator << (std::ostream& os,const Frame2& T);
  91. std::istream& operator >> (std::istream& is,Vector& v);
  92. std::istream& operator >> (std::istream& is,Rotation& R);
  93. std::istream& operator >> (std::istream& is,Frame& T);
  94. std::istream& operator >> (std::istream& os,Twist& T);
  95. std::istream& operator >> (std::istream& os,Wrench& T);
  96. std::istream& operator >> (std::istream& is,Vector2& v);
  97. std::istream& operator >> (std::istream& is,Rotation2& R);
  98. std::istream& operator >> (std::istream& is,Frame2& T);
  99. } // namespace Frame
  100. #endif