AirSim 自动驾驶仿真 (4) - 核心 APIs - C++
接下去主要介绍一下 AirSim
的 APIs
的使用. 官方 提供了 Python
和 C++
两个版本, 我这里就主要以 C++
来试验.
这篇文章的 Hello Car
的源码.
Hello Car
源码
官方文档该部分的源码还没有更新, 这里源码为 GitHub上的源码. 如果要用文档的例程, 需要把 两处
CarControllerBase::CarControls
改为
msr::airlib::CarApiBase::CarControls
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "common/common_utils/StrictMode.hpp"
STRICT_MODE_OFF
#ifndef RPCLIB_MSGPACK
#define RPCLIB_MSGPACK clmdep_msgpack
#endif // !RPCLIB_MSGPACK
#include "rpc/rpc_error.h"
STRICT_MODE_ON
#include "vehicles/car/api/CarRpcLibClient.hpp"
#include "common/common_utils/FileSystem.hpp"
#include <iostream>
#include <chrono>
int main()
{
using namespace msr::airlib;
std::cout << "Make sure settings.json has \"SimMode\"=\"Car\" at root. Press Enter to continue." << std::endl; std