当前位置: 首页>>代码示例>>C++>>正文


C++ Capability::isDirectionPossible方法代码示例

本文整理汇总了C++中Capability::isDirectionPossible方法的典型用法代码示例。如果您正苦于以下问题:C++ Capability::isDirectionPossible方法的具体用法?C++ Capability::isDirectionPossible怎么用?C++ Capability::isDirectionPossible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Capability的用法示例。


在下文中一共展示了Capability::isDirectionPossible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createReachabilitySphereFromCapability

ReachabilitySphere createReachabilitySphereFromCapability(Capability cap, unsigned int numPoints)
{
    // spread points over a sphere
    std::vector<Vector> points = distributePointsOnSphere(numPoints);
    
    ReachabilitySphere sphere;
    
    for (size_t i = 0; i < points.size(); ++i)
    {
        double phi = atan2(points[i].y, points[i].x) * 180.0 / M_PI;
        double theta = acos(points[i].z) * 180.0 / M_PI;
        
        if (cap.isDirectionPossible(phi, theta))
        {
            sphere.appendDirection(points[i].x, points[i].y, points[i].z, true);
        }
        else
        {
            sphere.appendDirection(points[i].x, points[i].y, points[i].z, false);
        }
    }
    return sphere;
}
开发者ID:JochenKempfle,项目名称:capability_map,代码行数:23,代码来源:CapabilityMapGeneratorTest.cpp

示例2: isReachable

bool ReachabilityDummyInterface::isReachable(const octomath::Pose6D &pose) const
{
    Capability cap;
    if (pose.y() > 0.04 && pose.y() < 0.06 && pose.z() > 0.44 && pose.z() < 0.46)
    {
        if (pose.x() > 0.14 && pose.x() < 0.16)
        {
            cap = Capability(SPHERE, 0.0, 0.0, 0.0);
        }
        else if (pose.x() > 0.34 && pose.x() < 0.36)
        {
            cap = Capability(CONE, 0.0, 90.0, 15.0);
        }
        else if (pose.x() > 0.54 && pose.x() < 0.56)
        {
            cap = Capability(CONE, 90.0, 0.0, 45.0);
        }
        else if (pose.x() > 0.74 && pose.x() < 0.76)
        {
            cap = Capability(CONE, 90.0, 0.0, 125.0);
        }
        else if (pose.x() > 0.94 && pose.x() < 0.96)
        {
            cap = Capability(CONE, 180.0, 120.0, 70.0);
        }
        else if (pose.x() > 1.14 && pose.x() < 1.16)
        {
            cap = Capability(CYLINDER_1, 0.0, 0.0, 10.0);
        }
        else if (pose.x() > 1.34 && pose.x() < 1.36)
        {
            cap = Capability(CYLINDER_1, 0.0, 0.0, 90.0);
        }
        else if (pose.x() > 1.54 && pose.x() < 1.56)
        {
            cap = Capability(CYLINDER_1, 40.0, 50.0, 45.0);
        }
        else if (pose.x() > 1.74 && pose.x() < 1.76)
        {
            cap = Capability(CYLINDER_2, 0.0, 0.0, 10.0);
        }
        else if (pose.x() > 1.94 && pose.x() < 1.96)
        {
            cap = Capability(CYLINDER_2, 0.0, 0.0, 45.0);
        }
        else if (pose.x() > 2.14 && pose.x() < 2.16)
        {
            cap = Capability(CYLINDER_2, 90.0, 90.0, 89.0);
        }
        else
        {
            return false;
        }
    }
    else
    {
        return false;
    }

    octomath::Vector3 unitVector(1.0, 0.0, 0.0);
    octomath::Vector3 rotatedVector = pose.rot().rotate(unitVector);

    double phi = atan2(rotatedVector.y(), rotatedVector.x()) * 180.0 / M_PI;
    double theta = acos(rotatedVector.z()) * 180.0 / M_PI;

    return cap.isDirectionPossible(phi, theta);
}
开发者ID:JochenKempfle,项目名称:capability_map,代码行数:67,代码来源:ReachabilityDummyInterface.cpp


注:本文中的Capability::isDirectionPossible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。