27 m_in_Angles(
"in_Angles"),
28 m_in_Velocities(
"in_Velocities"),
29 m_in_Currents(
"in_Currents"),
30 m_out_Angles(
"out_Angles"),
31 m_out_Velocities(
"out_Velocities"),
35 m_CanDev_prop(
"CanDev_n",
"Can Device No.", 0),
36 m_CanBaud_prop(
"BaudRate",
"Can Baud Rate", 1000),
37 m_dof_prop(
"DOF",
"Degrees of Freedom", 7),
38 m_MaxVel_prop(
"Max_Vel",
"Maximum Velocity", 0.5),
39 m_MaxAcc_prop(
"Max_Acc",
"Maximum Acceleration", 0.8),
42 this->ports()->addPort( &
m_in_Angles,
"Port for desired Angles" );
44 this->ports()->addPort( &
m_in_Velocities,
"Port for desired velocities" );
46 this->ports()->addPort( &
m_in_Currents,
"Port for desired currents" );
49 this->ports()->addPort( &
m_out_Angles,
"Port for current positions" );
68 for (
int i=0; i<
m_dof; i++)
73 m_modId_props.push_back( Property<int>( os.str(), os.str(), 0 ) );
75 os.str(
""); os.clear();
76 os <<
"upperLimit" << i+1;
77 m_ul_props.push_back( Property<double>( os.str(), os.str(), 0.0 ) );
79 os.str(
""); os.clear();
80 os <<
"lowerLimit" << i+1;
81 m_ll_props.push_back( Property<double>( os.str(), os.str(), 0.0 ) );
83 os.str(
""); os.clear();
84 os <<
"offset" << i+1;
85 m_offset_props.push_back( Property<double>( os.str(), os.str(), 0.0 ) );
90 for (
int i=0; i<
m_dof; i++)
93 os <<
"modParams" << i+1;
95 PropertyBag bag( os.str() );
101 Property<PropertyBag> prop_of_bag( os.str(),
"", bag);
106 for (
int i=0; i<
m_dof; i++)
120 this->marshalling()->readProperties(
m_xmlFile);
124 PowerCubeParameters pcparams;
126 pcparams.modIds.resize(
m_dof);
127 pcparams.upperlimits.resize(
m_dof);
128 pcparams.lowerlimits.resize(
m_dof);
129 pcparams.offsets.resize(
m_dof);
138 if(
m_dof != pcparams.dof)
140 log(
Info) <<
"Degrees of freedom" <<
m_dof <<
"doesn't match with xml input DOF." << pcparams.dof << endlog();
144 for (i=0 ; i< (
m_dof) ; i++)
147 pcparams.upperlimits[i] =
m_ul_props[i].get();
148 pcparams.lowerlimits[i] =
m_ll_props[i].get();
156 log(
Info) <<
"PowerCubeCtrl initialized successfully." << endlog();
161 log(
Info) <<
"Error while initializing PowerCubeCtrl:" << endlog();
180 log(
Info) <<
"Error in PowerCubeSim.startHook(): more than one input port is connected!" << endlog();
184 log(
Info) <<
"PowerCubeSim succesfully detected connection at in_Angles" << endlog();
192 log(
Info) <<
"Error in PowerCubeSim.startHook(): more than one input port is connected!" << endlog();
196 log(
Info) <<
"PowerCubeSim succesfully detected connection at in_Velocities" << endlog();
202 log(
Info) <<
"Error, port \"setCur_R\" is connected to PowerCubeSim_OROCOS.\"";
203 log(
Info) <<
"Current movement is not yet supported by PowerCubeSim." << endlog();
218 log(
Info) <<
"No Input port is connected, PowerCubeSim will only return the current state." << endlog();
230 std::vector<double> angles_desired(7);
237 std::vector<double> vel_desired(7);
243 std::vector<double> currents_desired(7);
249 std::vector<double> curConfig(7);
253 std::vector<double> curVelocities(7);
RTT::Method< bool(void)> m_stop_method
RTT::Property< int > m_CanDev_prop
bool getJointVelocities(std::vector< double > &result)
get the current joint velocities (Rad/s)
RTT::ReadDataPort< std::vector< double > > m_in_Currents
RTT::ReadDataPort< std::vector< double > > m_in_Velocities
std::vector< RTT::Property< double > > m_ul_props
bool m_in_Velocities_connected
PowerCubeCtrl_OROCOS(std::string name, std::string file, int dof)
bool MoveVel(const std::vector< double > &velocities)
Moves all cubes by the given velocities.
RTT::ReadDataPort< std::vector< double > > m_in_Angles
RTT::Property< double > m_MaxAcc_prop
bool m_in_Angles_connected
std::vector< RTT::Property< double > > m_offset_props
RTT::Property< int > m_dof_prop
bool Init(PowerCubeCtrlParams *params)
Initializing.
std::vector< RTT::Property< int > > m_modId_props
PowerCubeCtrl m_powercubectrl
bool m_in_Currents_connected
std::vector< RTT::Property< double > > m_ll_props
RTT::WriteDataPort< std::vector< double > > m_out_Velocities
bool statusMoving()
Returns true if any of the Joints are still moving.
bool moveJointSpace(std::vector< double > target)
std::string getErrorMessage() const
Get error message.
bool Stop()
Stops the Manipulator immediately.
RTT::Property< int > m_CanBaud_prop
std::vector< RTT::Property< RTT::PropertyBag > > m_mod_params
RTT::Property< double > m_MaxVel_prop
bool MoveJointSpaceSync(const std::vector< double > &angles)
Send position goals to powercubes, the final angles will be reached simultaneously.
RTT::WriteDataPort< std::vector< double > > m_out_Angles