Go to the documentation of this file.
22 #define PSIM_CHECK_INITIALIZED() \
23 if (isInitialized() == false) \
25 m_ErrorMessage.assign("Manipulator not initialized."); \
31 std::cerr <<
"==============Starting Simulated Powercubes\n";
45 m_DOF = params->GetNumberOfDOF();
56 std::vector<double> ul(
m_DOF);
57 std::vector<double> ll(
m_DOF);
63 for (
int i = 0; i <
m_DOF; i++)
67 std::cerr <<
"===========Initializing Simulated Powercubes\n";
75 for (
int i = 0; i <
m_DOF; i++)
82 std::cerr <<
"======================TUTUTUTUT\n";
85 std::vector<double> acc(
m_DOF);
86 std::vector<double> vel(
m_DOF);
94 std::vector<double> posnow;
99 std::vector<double> velnow;
100 velnow.resize(
m_DOF);
104 std::vector<double> times(
m_DOF);
106 for (
int i = 0; i <
m_DOF; i++)
115 double max = times[0];
117 for (
int i = 1; i <
m_DOF; i++)
126 RampCommand rm_furthest(posnow[furthest], velnow[furthest], target[furthest],
m_maxAcc[furthest],
129 double T1 = rm_furthest.
T1();
130 double T2 = rm_furthest.
T2();
131 double T3 = rm_furthest.
T3();
140 for (
int i = 0; i <
m_DOF; i++)
161 for (
int i = 0; i <
m_DOF; i++)
163 std::cout <<
"moving motor " << i <<
": " << target[i] <<
": " << vel[i] <<
": " << acc[i] <<
"\n";
164 m_motors[i].moveRamp(target[i], vel[i], acc[i]);
176 for (
int i = 0; i <
m_DOF; i++)
189 for (
int i = 0; i <
m_DOF; i++)
206 for (
int i = 0; i <
m_DOF; i++)
209 m_motors[i].setMaxVelocity(radpersec);
221 for (
int i = 0; i <
m_DOF; i++)
232 for (
int i = 0; i <
m_DOF; i++)
242 for (
int i = 0; i <
m_DOF; i++)
257 result.resize(
m_DOF);
258 for (
int i = 0; i <
m_DOF; i++)
271 result.resize(
m_DOF);
272 for (
int i = 0; i <
m_DOF; i++)
274 result[i] =
m_motors[i].getVelocity();
286 for (
int i = 0; i <
m_DOF; i++)
299 for (
int i = 0; i <
m_DOF; i++)
312 for (
int i = 0; i <
m_DOF; i++)
bool Stop()
current movement currently not supported in simulation
std::vector< double > GetMaxAcc()
Gets the max. angular accelerations (rad/s^2) for the joints.
bool MoveJointSpaceSync(const std::vector< double > &Angle)
same as MoveJointSpace, but final angles should by reached simultaniously! Returns the time that the ...
bool statusMoving()
Returns true if any of the Joints are still moving Should also return true if Joints are accelerating...
bool setMaxVelocity(double radpersec)
Sets the maximum angular velocity (rad/s) for the Joints, use with care! A Value of 0....
bool statusDec()
Returns true if any of the Joints are decelerating.
bool getJointVelocities(std::vector< double > &result)
Returns the current Angular velocities (Rad/s)
Parameters for cob_powercube_chain.
virtual double getTotalTime()
returns the planned total time for the movement (in seconds)
bool setMaxAcceleration(double radPerSecSquared)
Sets the maximum angular acceleration (rad/s^2) for the Joints, use with care! A Value of 0....
bool Init(PowerCubeCtrlParams *params)
std::vector< double > m_maxAcc
std::string m_ErrorMessage
bool MoveVel(const std::vector< double > &)
Moves all cubes by the given velocities.
static void calculateAV(double x0, double v0, double xtarget, double time, double T3, double amax, double vmax, double &a, double &v)
Calculate the necessary a and v of a rampmove, so that the move will take the desired time.
std::vector< simulatedMotor > m_motors
bool getConfig(std::vector< double > &result)
Returns the current Joint Angles.
bool statusAcc()
Returs true if any of the Joints are accelerating.
std::vector< double > GetLowerLimits()
Gets the lower angular limits (rad) for the joints.
bool MovePos(const std::vector< double > &)
moves all cubes to the given position
virtual double T1()
Return the times of the different phases of the ramp move.
std::vector< double > m_maxVel
#define PSIM_CHECK_INITIALIZED()
std::vector< double > GetMaxVel()
Gets the max. angular velocities (rad/s) for the joints.
std::vector< double > GetUpperLimits()
Gets the upper angular limits (rad) for the joints.