当前位置: 首页 > news >正文

上传网站到google网络营销产品

上传网站到google,网络营销产品,网站模板的制作怎么做,哪个网站可以代做试题【从0开始自动驾驶】用python做一个简单的自动驾驶仿真可视化界面 废话几句废话不多说,直接上源码目录结构init.pysimulator.pysimple_simulator_app.pyvehicle_config.json 废话几句 自动驾驶开发离不开仿真软件成品仿真软件种类多https://zhuanlan.zhihu.com/p/3…

【从0开始自动驾驶】用python做一个简单的自动驾驶仿真可视化界面

  • 废话几句
  • 废话不多说,直接上源码
    • 目录结构
    • init.py
    • simulator.py
    • simple_simulator_app.py
    • vehicle_config.json

废话几句

  • 自动驾驶开发离不开仿真软件
  • 成品仿真软件种类多
  • https://zhuanlan.zhihu.com/p/321771761#:~:text=%E5%8D%95%E5%B0%B1%E8%87%AA%E5%8A%A8%E9%A9%BE%E9%A9%B6%E4%BB%BF%E7%9C%9F,%E5%90%84%E8%87%AA%E7%9A%84%E5%8F%AF%E5%8F%96%E4%B9%8B%E5%A4%84%E3%80%82
  • 问题在于
    • 软件大多为WINDOWS环境,不一定满足开发环境需求
    • 软件大多收费,受版权影响
    • 软件较为复杂,普通开发任务无需复杂仿真软件
  • 那么
    • 以最简单的方式从0开始搭建一个可视化仿真软件
    • 直接使用python matplot库进行可视化
    • 后段采用简单车辆运动学控制可视化界面
      在这里插入图片描述

废话不多说,直接上源码

目录结构

  • src
    • simple_simulator_app.py
    • config
      • vehicle_config.json
    • lib
      • init.py
      • simulator.py

init.py

import json
import copydef import_veh_cfg(veh_cfg_path):with open(veh_cfg_path, "r", encoding="utf-8") as load_f:veh_cfg_ori = json.load(load_f)return veh_cfg_oridef init_veh_cfg(veh_cfg_path):veh_cfg_ori = import_veh_cfg(veh_cfg_path)# print(veh_cfg_ori)veh_cfg = copy.deepcopy(veh_cfg_ori)return veh_cfg

simulator.py

  • 使用class编写的仿真器
  • 输入为车辆x、y、yaw,进行可视化
  • 后段接入运动学等函数可随意进行扩展
import numpy
import matplotlib.pyplot as pltclass simulator:def init_simulator(self, veh_cfg):plt.ion()self.veh_cfg = veh_cfgdef draws(self, x, y, yaw, xmin, xmax, ymin, ymax):self.veh_x = xself.veh_y = yself.veh_yaw = yaw  # 角度plt.clf()  # 清除之前画的图plt.xlim(xmin, xmax)plt.ylim(ymin, ymax)plt.title("simulator")plt.xlabel("X/m")plt.ylabel("Y/m")ax = plt.gca()ax.set_aspect(1)  # 保持纵横比self.draw_veh()plt.pause(0.001)def draws_close(self):plt.ioff()def draw_veh(self):  # yaw以x轴为0,逆时针为正plt.plot(self.veh_x, self.veh_y, "o", color="r")self.ca_veh_points()plt.plot(self.veh_x_points, self.veh_y_points, color="r")def ca_veh_points(self):  # 计算车辆包络框的所有点half_veh_width = self.veh_cfg["width"] / 2self.veh_yaw_rad = numpy.deg2rad(self.veh_yaw)self.veh_x_points = [self.veh_x+ (self.veh_cfg["length"] - self.veh_cfg["rear_overhang"])* numpy.cos(self.veh_yaw_rad)+ half_veh_width * numpy.sin(self.veh_yaw_rad),self.veh_x+ (self.veh_cfg["length"] - self.veh_cfg["rear_overhang"])* numpy.cos(self.veh_yaw_rad)- half_veh_width * numpy.sin(self.veh_yaw_rad),self.veh_x- (self.veh_cfg["rear_overhang"]) * numpy.cos(self.veh_yaw_rad)- half_veh_width * numpy.sin(self.veh_yaw_rad),self.veh_x- (self.veh_cfg["rear_overhang"]) * numpy.cos(self.veh_yaw_rad)+ half_veh_width * numpy.sin(self.veh_yaw_rad),self.veh_x+ (self.veh_cfg["length"] - self.veh_cfg["rear_overhang"])* numpy.cos(self.veh_yaw_rad)+ half_veh_width * numpy.sin(self.veh_yaw_rad),]self.veh_y_points = [self.veh_y+ (self.veh_cfg["length"] - self.veh_cfg["rear_overhang"])* numpy.sin(self.veh_yaw_rad)- half_veh_width * numpy.cos(self.veh_yaw_rad),self.veh_y+ (self.veh_cfg["length"] - self.veh_cfg["rear_overhang"])* numpy.sin(self.veh_yaw_rad)+ half_veh_width * numpy.cos(self.veh_yaw_rad),self.veh_y- (self.veh_cfg["rear_overhang"]) * numpy.sin(self.veh_yaw_rad)+ half_veh_width * numpy.cos(self.veh_yaw_rad),self.veh_y- (self.veh_cfg["rear_overhang"]) * numpy.sin(self.veh_yaw_rad)- half_veh_width * numpy.cos(self.veh_yaw_rad),self.veh_y+ (self.veh_cfg["length"] - self.veh_cfg["rear_overhang"])* numpy.sin(self.veh_yaw_rad)- half_veh_width * numpy.cos(self.veh_yaw_rad),]

simple_simulator_app.py

  • 主函数入口
import timefrom lib.init import *
from lib.simulator import *if __name__ == "__main__":veh_cfg_path = r"./config/vehicle_config.json"veh_cfg = init_veh_cfg(veh_cfg_path)simulator_ = simulator()simulator_.init_simulator(veh_cfg)for i in range(0, 20):simulator_.draws(i, 15 + i * 0.3, 30 + i, 0, 30, 0, 30)  # veh_x, veh_y, veh_yaw, xmin, xmax, ymin, ymaxtime.sleep(0.1)plt.pause(1000)  # 暂停几秒看一看结果

vehicle_config.json

-车辆配置文件

{"vehicle_type": "test","front_wheel_base": 1.3,"rear_wheel_base": 1.3,"width": 1.9,"length": 4,"rear_overhang": 0.4,"max_steer_wheel_angle": 35.0,"steer_ratio": 17.5
}
http://www.hkea.cn/news/386246/

相关文章:

  • 做网站什么主题比较好上海网站seo诊断
  • 设计苹果手机的网站病毒什么时候才能消失
  • 国外做化工产品的网站自媒体发布平台
  • 怎么做资源类网站百度搜索热度排名
  • 大片网站建设seo关键词排名优化评价
  • 网络营销推广课程培训苏州seo门户网
  • 做盗版影视网站如何给公司网站做推广
  • 做网站付费流程郑州seo技术
  • 云南网站开发有哪些实用的网络推广方法
  • 央视新闻最新消息今天什么叫seo
  • 网站建设的意义徐州百度推广
  • 建设网站建设的目标百度云盘资源
  • 个体工商户是否能够做网站在线生成个人网站源码
  • 临沂高端网站建设厦门网站推广费用
  • 网站模版友链交易交易平台
  • 武汉做网站找谁百度导航是哪个国家的
  • wordpress互动游戏黄石seo诊断
  • 网页设计作品下载志鸿优化设计
  • 宾馆网站制作seminar是什么意思
  • 网站建设的进度表爱站查询工具
  • 深圳聘请做网站人员长春刚刚最新消息今天
  • 汽配人网做网站沈阳网站seo公司
  • 网站 短链接怎么做网站建设网站定制
  • 网站开发凭证做什么科目百度推广关键词多少合适
  • 网站正在建设 h5模板新闻热点
  • 龙岗公司网站建设怎么上百度搜索
  • 七米网站建设网站自动推广软件免费
  • 余姚公司做网站跨境电商怎么做
  • 顺义哪有做网站厂家百度快照在哪里找
  • 深圳南山网站建设重庆seo黄智