Skip to content

Commit

Permalink
added rstrt::robot::JointState
Browse files Browse the repository at this point in the history
  • Loading branch information
xwavex committed Jun 8, 2016
1 parent eb81d8c commit 6bf7bb8
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,5 @@ build/
*.txt
!CMakeLists.txt
*.log
.project
.cproject
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Expand Up @@ -30,7 +30,9 @@ set(SOURCES ${CMAKE_PROJECT_NAME}/geometry/Translation.cpp
${CMAKE_PROJECT_NAME}/kinematics/JointAccelerations.cpp

${CMAKE_PROJECT_NAME}/dynamics/JointTorques.cpp
${CMAKE_PROJECT_NAME}/dynamics/JointImpedance.cpp)
${CMAKE_PROJECT_NAME}/dynamics/JointImpedance.cpp

${CMAKE_PROJECT_NAME}/robot/JointState.cpp)

set(HEADERS ${CMAKE_PROJECT_NAME}/geometry/Translation.hpp
${CMAKE_PROJECT_NAME}/geometry/Rotation.hpp
Expand All @@ -40,7 +42,9 @@ set(HEADERS ${CMAKE_PROJECT_NAME}/geometry/Translation.hpp
${CMAKE_PROJECT_NAME}/kinematics/JointAccelerations.hpp

${CMAKE_PROJECT_NAME}/dynamics/JointTorques.hpp
${CMAKE_PROJECT_NAME}/dynamics/JointImpedance.hpp)
${CMAKE_PROJECT_NAME}/dynamics/JointImpedance.hpp

${CMAKE_PROJECT_NAME}/robot/JointState.hpp)

# Shared object

Expand Down
56 changes: 56 additions & 0 deletions src/rst-rt/robot/JointState.cpp
@@ -0,0 +1,56 @@
/* ============================================================
*
* This file is a part of RST-RT (CogIMon) project
*
* Copyright (C) 2016 by Dennis Leroy Wigand <dwigand at cor-lab dot uni-bielefeld dot de>
*
* This file may be licensed under the terms of the
* GNU Lesser General Public License Version 3 (the ``LGPL''),
* or (at your option) any later version.
*
* Software distributed under the License is distributed
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the LGPL for the specific language
* governing rights and limitations.
*
* You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The development of this software was supported by:
* CoR-Lab, Research Institute for Cognition and Robotics
* Bielefeld University
*
* ============================================================ */

#include "JointState.hpp"

namespace rstrt {
namespace robot {

JointState::JointState() {
}

JointState::JointState(int size) {
this->angles.resize(size);
this->angles.fill(0);

this->velocities.resize(size);
this->velocities.fill(0);

this->torques.resize(size);
this->torques.fill(0);
}


std::ostream& operator<<(std::ostream& os, const JointState& cd) {
return os << "JointState : {\nangles : " << cd.angles << "\nvelocities : " << cd.velocities << "\ntorques : " << cd.torques << "\n}";
}

std::istream& operator>>(std::istream& is, JointState& cd) {
return is;// >> cd.angles;
}

}
}
53 changes: 53 additions & 0 deletions src/rst-rt/robot/JointState.hpp
@@ -0,0 +1,53 @@
/* ============================================================
*
* This file is a part of RST-RT (CogIMon) project
*
* Copyright (C) 2016 by Dennis Leroy Wigand <dwigand at cor-lab dot uni-bielefeld dot de>
*
* This file may be licensed under the terms of the
* GNU Lesser General Public License Version 3 (the ``LGPL''),
* or (at your option) any later version.
*
* Software distributed under the License is distributed
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the LGPL for the specific language
* governing rights and limitations.
*
* You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The development of this software was supported by:
* CoR-Lab, Research Institute for Cognition and Robotics
* Bielefeld University
*
* ============================================================ */

#pragma once

#include <iostream>

#include <Eigen/Dense>

namespace rstrt {
namespace robot {

class JointState {
public:
JointState();
JointState(int size);

//private:
Eigen::VectorXf angles;
Eigen::VectorXf velocities;
Eigen::VectorXf torques;
};

// Displaying:
std::ostream& operator<<(std::ostream& os, const JointState& cd);
// Reading:
std::istream& operator>>(std::istream& is, JointState& cd);

}
}

0 comments on commit 6bf7bb8

Please sign in to comment.