blender/intern/itasc/ControlledObject.cpp

65 lines
1.3 KiB
C++
Raw Normal View History

2011-02-25 11:45:16 +00:00
/** \file itasc/ControlledObject.cpp
* \ingroup itasc
*/
2009-09-25 01:13:07 +00:00
/* $Id$
* ControlledObject.cpp
*
* Created on: Jan 5, 2009
* Author: rubensmits
*/
#include "ControlledObject.hpp"
namespace iTaSC {
ControlledObject::ControlledObject():
Object(Controlled),m_nq(0),m_nc(0),m_nee(0)
{
// max joint variable = 0.52 radian or 0.52 meter in one timestep
m_maxDeltaQ = e_scalar(0.52);
}
void ControlledObject::initialize(unsigned int _nq,unsigned int _nc, unsigned int _nee)
{
assert(_nee >= 1);
m_nq = _nq;
m_nc = _nc;
m_nee = _nee;
if (m_nq > 0) {
m_Wq = e_identity_matrix(m_nq,m_nq);
m_qdot = e_zero_vector(m_nq);
}
if (m_nc > 0) {
m_Wy = e_scalar_vector(m_nc,1.0);
m_ydot = e_zero_vector(m_nc);
}
if (m_nc > 0 && m_nq > 0)
m_Cq = e_zero_matrix(m_nc,m_nq);
// clear all Jacobian if any
m_JqArray.clear();
// reserve one more to have a zero matrix handy
if (m_nq > 0)
m_JqArray.resize(m_nee+1, e_zero_matrix(6,m_nq));
}
ControlledObject::~ControlledObject() {}
const e_matrix& ControlledObject::getJq(unsigned int ee) const
{
assert(m_nq > 0);
return m_JqArray[(ee>m_nee)?m_nee:ee];
}
double ControlledObject::getMaxTimestep(double& timestep)
{
Camera tracking integration =========================== - itasc adopted for Eigen3 library. It compiles well, but need deeper testing for regressions. - Removed Eigen2 library. - Added settings to tracker which could be changed from UI. - Pattern area is now affects on tracker. Currently libmv supports square patterns which are centered to marker's position. Maximal pattern dimensions is sending to libmv as pattern size. Would be changed when libmv would support non-centered and non-square patterns. - Fixed bug with syncing pattern's flags when tracking. - Current frame in cache line became a bit more visible. It's useful for me to when debugging. - Changed behaviour of "Add Marekr" operator: not it's non-modal and places marker on mouse position at click. - Added macro "Add Marekr and Move" which is used to place markers from toolbar button. - Added some utility functions to get image buffer under search and pattern area which also returns relative position of marker center for this images. Generated images are more "correct" from coords rounding POV, but re-calculation of marker position back to frame coords is more complicated and not implemented yet, so old not very accurate logic is still used. - Added preview widget with content of pattern area. NOTE: files saved in previous versions of this branch could easily crash on tracking. Use "Reset To Settings" button from Tracking Settings before tracking selected markers for such files. TODO: - Implement adjusting marker position from marker's preview widget. - We've got an idea of sliding marker after click before releasing mouse button.
2011-06-14 16:22:06 +00:00
e_scalar maxQdot = m_qdot.array().abs().maxCoeff();
if (timestep*maxQdot > m_maxDeltaQ) {
timestep = m_maxDeltaQ/maxQdot;
}
return timestep;
}
}