1. 程式人生 > >(二)上交無人機比賽 基本控制-2控制添加

(二)上交無人機比賽 基本控制-2控制添加

spa IV time mov period () static RM second

已有的為功能

namespace msr { namespace airlib {


typedef msr::airlib_rpclib::MultirotorRpcLibAdapators MultirotorRpcLibAdapators;

MultirotorRpcLibClient::MultirotorRpcLibClient(const string&  ip_address, uint16_t port, uint timeout_ms)
    : RpcLibClientBase(ip_address, port, timeout_ms)
{
}

MultirotorRpcLibClient::~MultirotorRpcLibClient()
{}
//開啟
bool MultirotorRpcLibClient::armDisarm(bool arm)
{
    return static_cast<rpc::client*>(getClient())->call("armDisarm", arm).as<bool>();
}
//起飛
bool MultirotorRpcLibClient::takeoff(float max_wait_seconds)
{
    return static_cast<rpc::client*>(getClient())->call("takeoff", max_wait_seconds).as<bool>();
}
//降落
bool MultirotorRpcLibClient::land(float max_wait_seconds)
{
    return static_cast<rpc::client*>(getClient())->call("land", max_wait_seconds).as<bool>();
}
//角度速度移動
bool MultirotorRpcLibClient::moveByAngleThrottle(float pitch, float roll, float throttle, float yaw_rate, float duration)
{
    return static_cast<rpc::client*>(getClient())->call("moveByAngleThrottle", pitch, roll, throttle, yaw_rate, duration).as<bool>();
}
//懸停
bool MultirotorRpcLibClient::hover()
{
    return static_cast<rpc::client*>(getClient())->call("hover").as<bool>();
}
//GPS
GeoPoint MultirotorRpcLibClient::getGpsLocation()
{
    return static_cast<rpc::client*>(getClient())->call("getGpsLocation").as<MultirotorRpcLibAdapators::GeoPoint>().to();
}
//氣壓計
BarometerData MultirotorRpcLibClient::getBarometerdata(float period)
{
	return static_cast<rpc::client*>(getClient())->call("getBarometerdata", period).as<MultirotorRpcLibAdapators::BarometerData>().to();
}
//磁力計

MagnetometerData MultirotorRpcLibClient::getMagnetometerdata(float period)
{
	return static_cast<rpc::client*>(getClient())->call("getMagnetometerdata", period).as<MultirotorRpcLibAdapators::MagnetometerData>().to();
}
//IMU數據
ImuData  MultirotorRpcLibClient::getImudata(float period)
{
	return static_cast<rpc::client*>(getClient())->call("getImudata", period).as<MultirotorRpcLibAdapators::ImuData>().to();
}

}} //namespace

#endif
#endif

  

(二)上交無人機比賽 基本控制-2控制添加