Demo entry 5959402

extract orientation from compass

   

Submitted by Neur1n on Sep 09, 2016 at 23:14
Language: C++. Code size: 913 Bytes.

        Orientation.str(std::string());
        Orientation.clear();
        position = RawData.find("C") + 1;
        length = RawData.find("P") - RawData.find("C") - 1;
        Orientation << RawData.substr(position, length);
        Orientation >> yaw;
        ROS_INFO("Yaw is: %f", yaw);

        Orientation.str(std::string());
        Orientation.clear();
        position = RawData.find("P") + 1;
        length = RawData.find("R") - RawData.find("P") - 1;
        Orientation << RawData.substr(position, length);
        Orientation >> pitch;
        ROS_INFO("Pitch is: %f", pitch);

        Orientation.str(std::string());
        Orientation.clear();
        position = RawData.find("R") + 1;
        length = RawData.find("*") - RawData.find("R") - 1;
        Orientation << RawData.substr(position, length);
        Orientation >> roll;
        ROS_INFO("Roll is: %f\n", roll);

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).