void imuCallback(sensor_msgs::Imu const &imu) { std::vector<geometry_msgs::TransformStamped> transforms; tf::StampedTransform transform; tf::Quaternion orientation; tf::quaternionMsgToTF(imu.orientation, orientation); btScalar yaw, pitch, roll; tf::Matrix3x3(orientation).getEulerYPR(yaw, pitch, roll); // Stabilized transform (z, yaw) transform.frame_id_ = global_frame_id; transform.child_frame_id_ = stabilized_frame_id; transform.stamp_ = imu.header.stamp; transform.setOrigin(tf::Vector3(0.0, 0.0, 1.0)); transform.setRotation(tf::createQuaternionFromRPY(0.0, 0.0, yaw)); addTransform(transforms, transform); // Add transform to the buffer // Base transform (roll, pitch) transform.frame_id_ = stabilized_frame_id; transform.child_frame_id_ = base_frame_id; transform.stamp_ = imu.header.stamp; transform.setOrigin(tf::Vector3(0.0, 0.0, 0.0)); transform.setRotation(tf::createQuaternionFromRPY(roll, pitch, 0.0)); addTransform(transforms, transform); // Add transform to the buffer // Send both Transforms transform_broadcaster->sendTransform(transforms); }
void imuCallback(sensor_msgs::Imu const &imu) { std::vector<geometry_msgs::TransformStamped> transforms; tf::Quaternion orientation; tf::quaternionMsgToTF(imu.orientation, orientation); tfScalar yaw, pitch, roll; tf::Matrix3x3(orientation).getEulerYPR(yaw, pitch, roll); tf::StampedTransform tf; tf.stamp_ = imu.header.stamp; // footprint intermediate transform (x,y,yaw) tf.frame_id_ = global_frame_id; tf.child_frame_id_ = footprint_frame_id; tf.setOrigin(tf::Vector3(0.0, 0.0, 0.0)); tf.setRotation(tf::createQuaternionFromRPY(0.0, 0.0, yaw)); addTransform(transforms, tf); // Add transform to the buffer // base_link transform (roll, pitch) tf.frame_id_ = stabilized_frame_id; tf.child_frame_id_ = base_frame_id; tf.setRotation(tf::createQuaternionFromRPY(roll, pitch, 0.0)); addTransform(transforms, tf); // Add transform to the buffer g_transform_broadcaster->sendTransform(transforms); }
void sendTransform(geometry_msgs::Pose const &pose, const std_msgs::Header& header, std::string child_frame_id = "") { std::vector<geometry_msgs::TransformStamped> transforms; tf::StampedTransform tf; tf.frame_id_ = header.frame_id; if (!g_frame_id.empty()) tf.frame_id_ = g_frame_id; tf.stamp_ = header.stamp; if (!g_child_frame_id.empty()) child_frame_id = g_child_frame_id; if (child_frame_id.empty()) child_frame_id = "base_link"; tf::Quaternion orientation; tf::quaternionMsgToTF(pose.orientation, orientation); tfScalar yaw, pitch, roll; tf::Matrix3x3(orientation).getEulerYPR(yaw, pitch, roll); tf::Point position; tf::pointMsgToTF(pose.position, position); // position intermediate transform (x,y,z) if( !g_position_frame_id.empty() && child_frame_id != g_position_frame_id) { tf.child_frame_id_ = g_position_frame_id; tf.setOrigin(tf::Vector3(position.x(), position.y(), position.z() )); tf.setRotation(tf::Quaternion(0.0, 0.0, 0.0, 1.0)); addTransform(transforms, tf); } // footprint intermediate transform (x,y,yaw) if (!g_footprint_frame_id.empty() && child_frame_id != g_footprint_frame_id) { tf.child_frame_id_ = g_footprint_frame_id; tf.setOrigin(tf::Vector3(position.x(), position.y(), 0.0)); tf.setRotation(tf::createQuaternionFromRPY(0.0, 0.0, yaw)); addTransform(transforms, tf); yaw = 0.0; position.setX(0.0); position.setY(0.0); tf.frame_id_ = g_footprint_frame_id; } // stabilized intermediate transform (z) if (!g_footprint_frame_id.empty() && child_frame_id != g_stabilized_frame_id) { tf.child_frame_id_ = g_stabilized_frame_id; tf.setOrigin(tf::Vector3(0.0, 0.0, position.z())); tf.setBasis(tf::Matrix3x3::getIdentity()); addTransform(transforms, tf); position.setZ(0.0); tf.frame_id_ = g_stabilized_frame_id; } // base_link transform (roll, pitch) tf.child_frame_id_ = child_frame_id; tf.setOrigin(position); tf.setRotation(tf::createQuaternionFromRPY(roll, pitch, yaw)); addTransform(transforms, tf); br->sendTransform(transforms); }
Layout::Layout() : _session(nullptr) { setFilename("layout.html"); addTransform("stylesheets", [this](tastefulframework::DomNode & node) { node << link(type("text/css"), href("/stylesheets/blog.css"), rel("stylesheet")); }); addTransform("login", &Layout::login); addTransform("menu", &Layout::menu); }
TagPartial::TagPartial(tastefulframework::DomNode node) : Partial(node) , _tag(nullptr) { addTransform("searchtagurl", [this](tastefulframework::DomNode & node) { node("href") = url(&SearchController::find, { { "string", _tag->name() } }); }); addTransform("tagname", [this](tastefulframework::DomNode & node) { node.inner() = _tag->name(); }); }
void imuCallback(sensor_msgs::Imu const &imu) { std::vector<geometry_msgs::TransformStamped> transforms; std::string child_frame_id; tf::StampedTransform tf; tf.stamp_ = imu.header.stamp; tf.frame_id_ = tf::resolve(g_tf_prefix, g_stabilized_frame_id); if (!g_child_frame_id.empty()) child_frame_id = g_child_frame_id; if (child_frame_id.empty()) child_frame_id = "base_link"; tf::Quaternion orientation; tf::quaternionMsgToTF(imu.orientation, orientation); tfScalar yaw, pitch, roll; tf::Matrix3x3(orientation).getEulerYPR(yaw, pitch, roll); // base_link transform (roll, pitch) tf.child_frame_id_ = tf::resolve(g_tf_prefix, child_frame_id); tf.setRotation(tf::createQuaternionFromRPY(roll, pitch, 0.0)); addTransform(transforms, tf); g_transform_broadcaster->sendTransform(transforms); // publish pose message if (g_pose_publisher) { geometry_msgs::PoseStamped pose_stamped; pose_stamped.header.stamp = imu.header.stamp; pose_stamped.header.frame_id = g_stabilized_frame_id; tf::quaternionTFToMsg(tf.getRotation(), pose_stamped.pose.orientation); g_pose_publisher.publish(pose_stamped); } }
Tank::Tank(QObject *parent) : QGLSceneNode(parent) , m_texture(0) { QSequentialAnimationGroup *seq = new QSequentialAnimationGroup(this); QGraphicsScale3D *scale = new QGraphicsScale3D(this); addTransform(scale); QPropertyAnimation *anim = new QPropertyAnimation(scale, "scale"); anim->setDuration(10000); anim->setStartValue(QVector3D(1.0f, 0.1f, 1.0f)); anim->setEndValue(QVector3D(1.0f, 1.2f, 1.0f)); anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad)); seq->addAnimation(anim); seq->addPause(2000); anim = new QPropertyAnimation(scale, "scale"); anim->setDuration(10000); anim->setStartValue(QVector3D(1.0f, 1.2f, 1.0f)); anim->setEndValue(QVector3D(1.0f, 0.1f, 1.0f)); anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad)); seq->addAnimation(anim); seq->setLoopCount(-1); seq->start(); addNode(tankObject()); QGLMaterial *mat = qCreateFluid(); m_texture = mat->texture(); setMaterial(mat); }
BlogPostEdit::BlogPostEdit(Session * session, BlogPost * blogPost, unsigned id) : BlogView(session) , _blogPost(blogPost) , _id(id) { setFilename("blogpostedit.html"); addTransform("blogeditform", [this](tastefulframework::DomNode & node) { node("action") = url(&BlogPostController::save); }); addTransform("blogpostid", [this](tastefulframework::DomNode & node) { node("value") = _id; }); addTransform("blogposttitle", [this](tastefulframework::DomNode & node) { node("value") = _blogPost ? _blogPost->title() : ""; }); addTransform("blogposttext", [this](tastefulframework::DomNode & node) { node.inner() = _blogPost ? _blogPost->text() : " "; }); addTransform("savebuttontext", [this](tastefulframework::DomNode & node) { node("value") = (_id == 0) ? "Create" : "Save"; }); addTransform("backurl", [this](tastefulframework::DomNode & node) { node("href") = url(&BlogPostController::index); }); addTransform("blogposttags", &BlogPostEdit::tagList); }
DSIGTransformBase64 * DSIGReference::appendBase64Transform() { DOMElement *txfmElt; DSIGTransformBase64 * txfm; XSECnew(txfm, DSIGTransformBase64(mp_env)); txfmElt = txfm->createBlankTransform(mp_env->getParentDocument()); addTransform(txfm, txfmElt); return txfm; }
DSIGTransformXPath * DSIGReference::appendXPathTransform(const char * expr) { DOMElement *txfmElt; DSIGTransformXPath * txfm; XSECnew(txfm, DSIGTransformXPath(mp_env)); txfmElt = txfm->createBlankTransform(mp_env->getParentDocument()); txfm->setExpression(expr); addTransform(txfm, txfmElt); return txfm; }
DSIGTransformXPathFilter * DSIGReference::appendXPathFilterTransform(void) { DOMElement *txfmElt; DSIGTransformXPathFilter * txfm; XSECnew(txfm, DSIGTransformXPathFilter(mp_env)); txfmElt = txfm->createBlankTransform(mp_env->getParentDocument()); addTransform(txfm, txfmElt); mp_env->doPrettyPrint(txfmElt); return txfm; }
DSIGTransformEnvelope * DSIGReference::appendEnvelopedSignatureTransform() { DOMElement *txfmElt; DSIGTransformEnvelope * txfm; XSECnew(txfm, DSIGTransformEnvelope(mp_env)); txfmElt = txfm->createBlankTransform(mp_env->getParentDocument()); addTransform(txfm, txfmElt); return txfm; }
Login::Login(Session * session, const QString & email, bool loginAttempt) : BlogView(session) , _loginAttempt(loginAttempt) , _email(email) { setFilename("login.html"); addTransform("loginform", [this](tastefulframework::DomNode & node) { node("method") = "POST"; node("url") = url(&LoginController::login); }); addTransform("errormessage", [this](tastefulframework::DomNode & node) { if (_loginAttempt) { node << "Failed to log in."; } }); addTransform("emailvalue", [this](tastefulframework::DomNode & node) { node("value") = _email; }); }
DSIGTransformC14n * DSIGReference::appendCanonicalizationTransform(canonicalizationMethod cm) { DOMElement *txfmElt; DSIGTransformC14n * txfm; XSECnew(txfm, DSIGTransformC14n(mp_env)); txfmElt = txfm->createBlankTransform(mp_env->getParentDocument()); txfm->setCanonicalizationMethod(cm); addTransform(txfm, txfmElt); return txfm; }
DSIGTransformXSL * DSIGReference::appendXSLTransform(DOMNode * stylesheet) { DOMElement *txfmElt; DSIGTransformXSL * txfm; XSECnew(txfm, DSIGTransformXSL(mp_env)); txfmElt = txfm->createBlankTransform(mp_env->getParentDocument()); txfm->setStylesheet(stylesheet); addTransform(txfm, txfmElt); return txfm; }
Registration::Registration(Session * session, const QString & email, const QString & error) : BlogView(session) , _email(email) , _error(error) { setFilename("registration.html"); addTransform("registrationform", [this](tastefulframework::DomNode & node) { node("method") = "POST"; node("url") = url(&RegisterController::signup); }); addTransform("errormessage", [this](tastefulframework::DomNode & node) { if (!_error.isNull()) { node << _error; } }); addTransform("emailvalue", [this](tastefulframework::DomNode & node) { node("value") = _email; }); }
void Entity::fixUp() { for(size_t i = 0; i < components.Size(); i++ ) { Component* component = components[i].get(); if( !component ) continue; component->setEntity(this); Class* type = component->getType(); componentsMap[type] = component; } if( !getTransform() ) addTransform(); }
void imuCallback(sensor_msgs::Imu const &imu) { std::vector<geometry_msgs::TransformStamped> transforms; std::string child_frame_id; tf::StampedTransform tf; tf.frame_id_ = g_stabilized_frame_id; tf.stamp_ = imu.header.stamp; if (!g_child_frame_id.empty()) child_frame_id = g_child_frame_id; if (child_frame_id.empty()) child_frame_id = "base_link"; tf::Quaternion orientation; tf::quaternionMsgToTF(imu.orientation, orientation); btScalar yaw, pitch, roll; btMatrix3x3(orientation.asBt()).getEulerYPR(yaw, pitch, roll); // base_link transform (roll, pitch) tf.child_frame_id_ = child_frame_id; tf.setRotation(tf::createQuaternionFromRPY(roll, pitch, 0.0)); addTransform(transforms, tf); br->sendTransform(transforms); }
void setOrigin (int x, int y) { addTransform (AffineTransform::translation ((float) x, (float) y)); }
void SampleGraph::setupGraph( int frame_w, int frame_h, int fps, int bitrate) { m_audioTransformChain.clear(); m_videoTransformChain.clear(); { // Add audio mixer const double aacPacketTime = 1024. / 44100.0; #ifdef __APPLE__ addTransform(m_audioTransformChain, std::make_shared<videocore::Apple::AudioMixer>(2,44100,16,aacPacketTime)); #else addTransform(m_audioTransformChain, std::make_shared<videocore::GenericAudioMixer>(2,44100,16,aacPacketTime)); #endif } #ifdef __APPLE__ #ifdef TARGET_OS_IPHONE { // Add video mixer auto mixer = std::make_shared<videocore::iOS::GLESVideoMixer>(frame_w, frame_h, 1. / static_cast<double>(fps)); addTransform(m_videoTransformChain, mixer); } { // [Optional] add splits // Splits would be used to add different graph branches at various // stages. For example, if you wish to record an MP4 file while // streaming to RTMP. auto videoSplit = std::make_shared<videocore::Split>(); m_videoSplit = videoSplit; addTransform(m_videoTransformChain, videoSplit); } if(m_pbOutput) { m_videoSplit->setOutput(m_pbOutput); } { // Add encoders addTransform(m_audioTransformChain, std::make_shared<videocore::iOS::AACEncode>(44100, 2)); addTransform(m_videoTransformChain, std::make_shared<videocore::iOS::H264Encode>(frame_w, frame_h, fps, bitrate)); } #else #endif // TARGET_OS_IPHONE #endif // __APPLE__ addTransform(m_audioTransformChain, std::make_shared<videocore::rtmp::AACPacketizer>()); addTransform(m_videoTransformChain, std::make_shared<videocore::rtmp::H264Packetizer>()); m_videoTransformChain.back()->setOutput(this->m_outputSession); m_audioTransformChain.back()->setOutput(this->m_outputSession); const auto epoch = std::chrono::steady_clock::now(); for(auto it = m_videoTransformChain.begin() ; it != m_videoTransformChain.end() ; ++it) { (*it)->setEpoch(epoch); } for(auto it = m_audioTransformChain.begin() ; it != m_audioTransformChain.end() ; ++it) { (*it)->setEpoch(epoch); } // Create sources { // Add camera source m_cameraSource = std::make_shared<videocore::iOS::CameraSource>(frame_w/2,frame_h/2, frame_w,frame_h, frame_w, frame_h, float(frame_w) / float(frame_h)); std::dynamic_pointer_cast<videocore::iOS::CameraSource>(m_cameraSource)->setupCamera(false); m_cameraSource->setOutput(m_videoTransformChain.front()); } { // Add mic source m_micSource = std::make_shared<videocore::iOS::MicSource>(); m_micSource->setOutput(m_audioTransformChain.front()); } }
void sendTransform(geometry_msgs::Pose const &pose, const std_msgs::Header& header, std::string child_frame_id = "") { std::vector<geometry_msgs::TransformStamped> transforms; tf::StampedTransform tf; tf.stamp_ = header.stamp; tf.frame_id_ = header.frame_id; if (!g_frame_id.empty()) tf.frame_id_ = g_frame_id; tf.frame_id_ = tf::resolve(g_tf_prefix, tf.frame_id_); if (!g_child_frame_id.empty()) child_frame_id = g_child_frame_id; if (child_frame_id.empty()) child_frame_id = "base_link"; tf::Quaternion orientation; tf::quaternionMsgToTF(pose.orientation, orientation); tfScalar yaw, pitch, roll; tf::Matrix3x3(orientation).getEulerYPR(yaw, pitch, roll); tf::Point position; tf::pointMsgToTF(pose.position, position); // position intermediate transform (x,y,z) if( !g_position_frame_id.empty() && child_frame_id != g_position_frame_id) { tf.child_frame_id_ = tf::resolve(g_tf_prefix, g_position_frame_id); tf.setOrigin(tf::Vector3(position.x(), position.y(), position.z() )); tf.setRotation(tf::Quaternion(0.0, 0.0, 0.0, 1.0)); addTransform(transforms, tf); } // footprint intermediate transform (x,y,yaw) if (!g_footprint_frame_id.empty() && child_frame_id != g_footprint_frame_id) { tf.child_frame_id_ = tf::resolve(g_tf_prefix, g_footprint_frame_id); tf.setOrigin(tf::Vector3(position.x(), position.y(), 0.0)); tf.setRotation(tf::createQuaternionFromRPY(0.0, 0.0, yaw)); addTransform(transforms, tf); yaw = 0.0; position.setX(0.0); position.setY(0.0); tf.frame_id_ = tf::resolve(g_tf_prefix, g_footprint_frame_id); } // stabilized intermediate transform (z) if (!g_footprint_frame_id.empty() && child_frame_id != g_stabilized_frame_id) { tf.child_frame_id_ = tf::resolve(g_tf_prefix, g_stabilized_frame_id); tf.setOrigin(tf::Vector3(0.0, 0.0, position.z())); tf.setBasis(tf::Matrix3x3::getIdentity()); addTransform(transforms, tf); position.setZ(0.0); tf.frame_id_ = tf::resolve(g_tf_prefix, g_stabilized_frame_id); } // base_link transform (roll, pitch) tf.child_frame_id_ = tf::resolve(g_tf_prefix, child_frame_id); tf.setOrigin(position); tf.setRotation(tf::createQuaternionFromRPY(roll, pitch, yaw)); addTransform(transforms, tf); g_transform_broadcaster->sendTransform(transforms); // publish pose message if (g_pose_publisher) { geometry_msgs::PoseStamped pose_stamped; pose_stamped.pose = pose; pose_stamped.header = header; g_pose_publisher.publish(pose_stamped); } // publish pose message if (g_euler_publisher) { geometry_msgs::Vector3Stamped euler_stamped; euler_stamped.vector.x = roll; euler_stamped.vector.y = pitch; euler_stamped.vector.z = yaw; euler_stamped.header = header; g_euler_publisher.publish(euler_stamped); } }
void setOrigin (Point<int> o) { addTransform (AffineTransform::translation ((float) o.x, (float) o.y)); }