kinfam_io.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /** \file itasc/kdl/kinfam_io.cpp
  2. * \ingroup itasc
  3. */
  4. // Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
  5. // Version: 1.0
  6. // Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
  7. // Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
  8. // URL: http://www.orocos.org/kdl
  9. // This library is free software; you can redistribute it and/or
  10. // modify it under the terms of the GNU Lesser General Public
  11. // License as published by the Free Software Foundation; either
  12. // version 2.1 of the License, or (at your option) any later version.
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. // Lesser General Public License for more details.
  17. // You should have received a copy of the GNU Lesser General Public
  18. // License along with this library; if not, write to the Free Software
  19. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. #include "kinfam_io.hpp"
  21. #include "frames_io.hpp"
  22. namespace KDL {
  23. std::ostream& operator <<(std::ostream& os, const Joint& joint) {
  24. return os << joint.getTypeName();
  25. }
  26. std::istream& operator >>(std::istream& is, Joint& joint) {
  27. return is;
  28. }
  29. std::ostream& operator <<(std::ostream& os, const Segment& segment) {
  30. os << "[" << segment.getJoint() << ",\n" << segment.getFrameToTip() << "]";
  31. return os;
  32. }
  33. std::istream& operator >>(std::istream& is, Segment& segment) {
  34. return is;
  35. }
  36. std::ostream& operator <<(std::ostream& os, const Chain& chain) {
  37. os << "[";
  38. for (unsigned int i = 0; i < chain.getNrOfSegments(); i++)
  39. os << chain.getSegment(i) << "\n";
  40. os << "]";
  41. return os;
  42. }
  43. std::istream& operator >>(std::istream& is, Chain& chain) {
  44. return is;
  45. }
  46. std::ostream& operator <<(std::ostream& os, const Tree& tree) {
  47. SegmentMap::const_iterator root = tree.getSegment("root");
  48. return os << root;
  49. }
  50. std::ostream& operator <<(std::ostream& os, SegmentMap::const_iterator root) {
  51. //os<<root->first<<": "<<root->second.segment<<"\n";
  52. os << root->first<<"(q_nr: "<<root->second.q_nr<<")"<<"\n \t";
  53. for (unsigned int i = 0; i < root->second.children.size(); i++) {
  54. os <<(root->second.children[i])<<"\t";
  55. }
  56. return os << "\n";
  57. }
  58. std::istream& operator >>(std::istream& is, Tree& tree) {
  59. return is;
  60. }
  61. std::ostream& operator <<(std::ostream& os, const JntArray& array) {
  62. os << "[";
  63. for (unsigned int i = 0; i < array.rows(); i++)
  64. os << std::setw(KDL_FRAME_WIDTH) << array[i];
  65. os << "]";
  66. return os;
  67. }
  68. std::istream& operator >>(std::istream& is, JntArray& array) {
  69. return is;
  70. }
  71. std::ostream& operator <<(std::ostream& os, const Jacobian& jac) {
  72. os << "[";
  73. for (unsigned int i = 0; i < jac.rows(); i++) {
  74. for (unsigned int j = 0; j < jac.columns(); j++)
  75. os << std::setw(KDL_FRAME_WIDTH) << jac(i, j);
  76. os << std::endl;
  77. }
  78. os << "]";
  79. return os;
  80. }
  81. std::istream& operator >>(std::istream& is, Jacobian& jac) {
  82. return is;
  83. }
  84. }