PowerCubeSim_OROCOS.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
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 #include "PowerCubeSim_OROCOS.h"
19 #include "simulatedArm.h"
20 #include <vector>
21 
22 using namespace RTT;
23 
25 {
26 
27 }
28 
30 {
31 }
32 
34 {
35  if ( m_powercubectrl.Init(false) )
36  {
37  log(Info) << "PowerCubeSim initialized successfully." << endlog();
38  return true;
39  }
40  else
41  {
42  log(Info) << "Error while initializing PowerCubeSim:" << endlog();
43  //log(Info) << m_powercubectrl.getErrorMessage() << endlog();
44  return false;
45  }
46 }
47 
49 {
50  /* if ( m_in_Angles.connected() )
51  {
52  // only one of the input ports should be used simultaniously
53  if ( m_in_Velocities.connected() || m_in_Currents.connected() ) {
54  log(Info) << "Error in PowerCubeSim.startHook(): more than one input port is connected!" << endlog();
55  return false;
56  }
57  m_in_Angles_connected = true;
58  log(Info) << "PowerCubeSim succesfully detected connection at in_Angles" << endlog();
59  return true;
60  }
61  if ( m_in_Velocities.connected() )
62  {
63  // only one of the input ports should be used simultaniously
64  if ( m_in_Angles.connected() || m_in_Currents.connected() ) {
65  log(Info) << "Error in PowerCubeSim.startHook(): more than one input port is connected!" << endlog();
66  return false;
67  }
68  m_in_Velocities_connected = true;
69  log(Info) << "PowerCubeSim succesfully detected connection at in_Velocities" << endlog();
70  return true;
71  }
72  if ( m_in_Currents.connected() )
73  {
74  log(Info) << "Error, port \"setCur_R\" is connected to PowerCubeSim_OROCOS.\"";
75  log(Info) << "Current movement is not yet supported by PowerCubeSim." << endlog();
76  return false;
77  /*
78  // only one of the input ports should be used simultaniously
79  if ( m_in_Angles.connected() || m_in_Velocities.connected() ) {
80  log(Info) << "Error in PowerCubeSim.startHook(): more than one input port is connected!" << endlog();
81  return false;
82  }
83  m_in_Current_connected = true;
84  return true;
85 
86  }
87  else
88  {
89  log(Info) << "No Input port is connected, PowerCubeSim will only return the current state." << endlog();
90  } */
91  return true;
92 }
93 
95 {
96  //log(Info) << "updateHook is being executed." << endlog();
97  Jointd setpositions, setvelocities;
98  setpositions = set_position_inport.Get();
99  setvelocities = set_velocity_inport.Get();
100  if(setpositions.size() == 7)
101  {
102 
103  }
104  else if(setvelocities.size() == 7)
105  {
106 
107  }
108 
111 }
112 
114 {
115  stopArm();
116 }
117 
119 {
120  //stop
121  m_powercubectrl.stop();
122  return true;
123 }
124 
126 {
127  //isStopped
129  return false;
130  return true;
131 }
bool getConfig(std::vector< double > &result)
Returns the current Joint Angles.
ReadDataPort< Jointd > set_velocity_inport
ReadDataPort< Jointd > set_position_inport
bool statusMoving()
Returns true if any of the Joints are still moving Should also return true if Joints are accelerating...
PowerCubeSim m_powercubectrl
unsigned int size() const
Definition: Joint.h:384
PowerCubeSim_OROCOS(std::string name)
WriteDataPort< Jointd > current_position_outport
Info
bool Init(PowerCubeCtrlParams *params)
WriteDataPort< Jointd > current_velocity_outport
bool getJointVelocities(std::vector< double > &result)
Returns the current Angular velocities (Rad/s)


schunk_powercube_chain
Author(s): Florian Weisshardt
autogenerated on Mon Nov 25 2019 03:48:21