openpilot

opendbc

class CANPacker

Public Functions

CANPacker(const std::string &dbc_name)
std::vector<uint8_t> pack(uint32_t address, const std::vector<SignalPackValue> &values)
Msg *lookup_message(uint32_t address)

Private Members

const DBC *dbc = NULL
std::map<std::pair<uint32_t, std::string>, Signal> signal_lookup
std::map<uint32_t, Msg> message_lookup
std::map<uint32_t, uint32_t> counters
class CANParser

Public Functions

CANParser(int abus, const std::string &dbc_name, const std::vector<MessageParseOptions> &options, const std::vector<SignalParseOptions> &sigoptions)
CANParser(int abus, const std::string &dbc_name, bool ignore_checksum, bool ignore_counter)
void update_string(const std::string &data, bool sendcan)
void UpdateCans(uint64_t sec, const capnp::List<cereal::CanData>::Reader &cans)
void UpdateCans(uint64_t sec, const capnp::DynamicStruct::Reader &cans)
void UpdateValid(uint64_t sec)
std::vector<SignalValue> query_latest()

Public Members

bool can_valid = false
bool bus_timeout = false
uint64_t first_sec = 0
uint64_t last_sec = 0
uint64_t last_nonempty_sec = 0
uint64_t bus_timeout_threshold = 0
uint64_t can_invalid_cnt = CAN_INVALID_CNT

Private Members

const int bus
kj::Array<capnp::word> aligned_buf
const DBC *dbc = NULL
std::unordered_map<uint32_t, MessageState> message_states
class MessageState

Public Functions

bool parse(uint64_t sec, const std::vector<uint8_t> &dat)
bool update_counter_generic(int64_t v, int cnt_size)

Public Members

uint32_t address
unsigned int size
std::vector<Signal> parse_sigs
std::vector<double> vals
std::vector<std::vector<double>> all_vals
uint64_t last_seen_nanos
uint64_t check_threshold
uint8_t counter
uint8_t counter_fail
bool ignore_checksum = false
bool ignore_counter = false
file common.h
#include <vector>
#include <map>
#include <unordered_map>
#include “common_dbc.h”
#include <cstddef>
#include <cstdint>
#include <string>
#include <capnp/dynamic.h>
#include <capnp/serialize.h>
#include “cereal/gen/cpp/log.capnp.h”

Defines

INFO
WARN
DEBUG(...)
MAX_BAD_COUNTER
CAN_INVALID_CNT

Functions

void init_crc_lookup_tables()
unsigned int honda_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d)
unsigned int toyota_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d)
unsigned int subaru_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d)
unsigned int chrysler_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d)
unsigned int volkswagen_mqb_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d)
unsigned int xor_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d)
unsigned int hkg_can_fd_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d)
unsigned int pedal_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d)
dir /home/batman/openpilot/opendbc/can
dir /home/batman/openpilot/opendbc

cereal

messaging

class AlignedBuffer

Public Functions

kj::ArrayPtr<const capnp::word> align(const char *data, const size_t size)
kj::ArrayPtr<const capnp::word> align(Message *m)

Private Members

kj::Array<capnp::word> aligned_buf
size_t words_size
class Context

Subclassed by MSGQContext, ZMQContext

Public Functions

virtual void *getRawContext() = 0
virtual ~Context()

Public Static Functions

static Context *create()
class Message

Subclassed by MSGQMessage, ZMQMessage

Public Functions

virtual void init(size_t size) = 0
virtual void init(char *data, size_t size) = 0
virtual void close() = 0
virtual size_t getSize() = 0
virtual char *getData() = 0
virtual ~Message()
class MessageBuilder : public MallocMessageBuilder

Public Functions

MessageBuilder()
cereal::Event::Builder initEvent(bool valid = true)
kj::ArrayPtr<capnp::byte> toBytes()

Private Members

kj::Array<capnp::word> heapArray_
struct msgq_header_t

Public Members

uint64_t num_readers
uint64_t write_pointer
uint64_t write_uid
uint64_t read_pointers[NUM_READERS]
uint64_t read_valids[NUM_READERS]
uint64_t read_uids[NUM_READERS]
struct msgq_msg_t

Public Members

size_t size
char *data
struct msgq_pollitem_t

Public Members

msgq_queue_t *q
int revents
struct msgq_queue_t

Public Members

std::atomic<uint64_t> *num_readers
std::atomic<uint64_t> *write_pointer
std::atomic<uint64_t> *write_uid
std::atomic<uint64_t> *read_pointers[NUM_READERS]
std::atomic<uint64_t> *read_valids[NUM_READERS]
std::atomic<uint64_t> *read_uids[NUM_READERS]
char *mmap_p
char *data
size_t size
int reader_id
uint64_t read_uid_local
uint64_t write_uid_local
bool read_conflate
std::string endpoint
class MSGQContext : public Context

Public Functions

MSGQContext()
void *getRawContext()
~MSGQContext()

Private Members

void *context = NULL
class MSGQMessage : public Message

Public Functions

void init(size_t size)
void init(char *data, size_t size)
void takeOwnership(char *data, size_t size)
size_t getSize()
char *getData()
void close()
~MSGQMessage()

Private Members

char *data
size_t size
class MSGQPoller : public Poller

Public Functions

void registerSocket(SubSocket *socket)
std::vector<SubSocket*> poll(int timeout)
~MSGQPoller()

Private Members

std::vector<SubSocket*> sockets
msgq_pollitem_t polls[MAX_POLLERS]
size_t num_polls = 0
class MSGQPubSocket : public PubSocket

Public Functions

int connect(Context *context, std::string endpoint, bool check_endpoint = true)
int sendMessage(Message *message)
int send(char *data, size_t size)
bool all_readers_updated()
~MSGQPubSocket()

Private Members

msgq_queue_t *q = NULL
class MSGQSubSocket : public SubSocket

Public Functions

int connect(Context *context, std::string endpoint, std::string address, bool conflate = false, bool check_endpoint = true)
void setTimeout(int timeout)
void *getRawSocket()
Message *receive(bool non_blocking = false)
~MSGQSubSocket()

Private Members

msgq_queue_t *q = NULL
int timeout
class Poller

Subclassed by MSGQPoller, ZMQPoller

Public Functions

virtual void registerSocket(SubSocket *socket) = 0
virtual std::vector<SubSocket*> poll(int timeout) = 0
virtual ~Poller()

Public Static Functions

static Poller *create()
static Poller *create(std::vector<SubSocket*> sockets)
class PubMaster

Public Functions

PubMaster(const std::vector<const char*> &service_list)
int send(const char *name, capnp::byte *data, size_t size)
int send(const char *name, MessageBuilder &msg)
~PubMaster()

Private Members

std::map<std::string, PubSocket*> sockets_
class PubSocket

Subclassed by MSGQPubSocket, ZMQPubSocket

Public Functions

virtual int connect(Context *context, std::string endpoint, bool check_endpoint = true) = 0
virtual int sendMessage(Message *message) = 0
virtual int send(char *data, size_t size) = 0
virtual bool all_readers_updated() = 0
virtual ~PubSocket()

Public Static Functions

static PubSocket *create()
static PubSocket *create(Context *context, std::string endpoint, bool check_endpoint = true)
static PubSocket *create(Context *context, std::string endpoint, int port, bool check_endpoint = true)
class SubMaster

Public Functions

SubMaster(const std::vector<const char*> &service_list, const std::vector<const char*> &poll = {}, const char *address = nullptr, const std::vector<const char*> &ignore_alive = {})
void update(int timeout = 1000)
void update_msgs(uint64_t current_time, const std::vector<std::pair<std::string, cereal::Event::Reader>> &messages)
bool allAlive(const std::vector<const char*> &service_list = {})
bool allValid(const std::vector<const char*> &service_list = {})
bool allAliveAndValid(const std::vector<const char*> &service_list = {})
void drain()
~SubMaster()
bool updated(const char *name) const
bool alive(const char *name) const
bool valid(const char *name) const
uint64_t rcv_frame(const char *name) const
uint64_t rcv_time(const char *name) const
cereal::Event::Reader &operator[](const char *name) const

Public Members

uint64_t frame = 0

Private Functions

bool all_(const std::vector<const char*> &service_list, bool valid, bool alive)

Private Members

Poller *poller_ = nullptr
std::map<SubSocket*, SubMessage*> messages_
std::map<std::string, SubMessage*> services_
class SubSocket

Subclassed by MSGQSubSocket, ZMQSubSocket

Public Functions

virtual int connect(Context *context, std::string endpoint, std::string address, bool conflate = false, bool check_endpoint = true) = 0
virtual void setTimeout(int timeout) = 0
virtual Message *receive(bool non_blocking = false) = 0
virtual void *getRawSocket() = 0
virtual ~SubSocket()

Public Static Functions

static SubSocket *create()
static SubSocket *create(Context *context, std::string endpoint, std::string address = "127.0.0.1", bool conflate = false, bool check_endpoint = true)
class ZMQContext : public Context

Public Functions

ZMQContext()
void *getRawContext()
~ZMQContext()

Private Members

void *context = NULL
class ZMQMessage : public Message

Public Functions

void init(size_t size)
void init(char *data, size_t size)
size_t getSize()
char *getData()
void close()
~ZMQMessage()

Private Members

char *data
size_t size
class ZMQPoller : public Poller

Public Functions

void registerSocket(SubSocket *socket)
std::vector<SubSocket*> poll(int timeout)
~ZMQPoller()

Private Members

std::vector<SubSocket*> sockets
zmq_pollitem_t polls[MAX_POLLERS]
size_t num_polls = 0
class ZMQPubSocket : public PubSocket

Public Functions

int connect(Context *context, std::string endpoint, bool check_endpoint = true)
int sendMessage(Message *message)
int send(char *data, size_t size)
bool all_readers_updated()
~ZMQPubSocket()

Private Members

void *sock
std::string full_endpoint
class ZMQSubSocket : public SubSocket

Public Functions

int connect(Context *context, std::string endpoint, std::string address, bool conflate = false, bool check_endpoint = true)
void setTimeout(int timeout)
void *getRawSocket()
Message *receive(bool non_blocking = false)
~ZMQSubSocket()

Private Members

void *sock
std::string full_endpoint
file impl_msgq.h
#include “messaging.h
#include “msgq.h
#include <zmq.h>
#include <string>

Defines

MAX_POLLERS
file impl_zmq.h
#include “messaging.h
#include <zmq.h>
#include <string>

Defines

MAX_POLLERS
file messaging.h
#include <cstddef>
#include <map>
#include <string>
#include <vector>
#include <capnp/serialize.h>
#include “../gen/cpp/log.capnp.h”
#include <capnp/generated-header-support.h>
#include <kj/windows-sanity.h>
#include “/home/batman/openpilot/cereal/gen/cpp/car.capnp.h”
#include “/home/batman/openpilot/cereal/gen/cpp/legacy.capnp.h”

Defines

MSG_MULTIPLE_PUBLISHERS

Functions

bool messaging_use_zmq()
file msgq.h
#include <cstdint>
#include <cstring>
#include <string>
#include <atomic>

Defines

DEFAULT_SEGMENT_SIZE
NUM_READERS
ALIGN(n)
UNPACK64(higher, lower, input)
PACK64(output, higher, lower)

Functions

void msgq_wait_for_subscriber(msgq_queue_t *q)
void msgq_reset_reader(msgq_queue_t *q)
int msgq_msg_init_size(msgq_msg_t *msg, size_t size)
int msgq_msg_init_data(msgq_msg_t *msg, char *data, size_t size)
int msgq_msg_close(msgq_msg_t *msg)
int msgq_new_queue(msgq_queue_t *q, const char *path, size_t size)
void msgq_close_queue(msgq_queue_t *q)
void msgq_init_publisher(msgq_queue_t *q)
void msgq_init_subscriber(msgq_queue_t *q)
int msgq_msg_send(msgq_msg_t *msg, msgq_queue_t *q)
int msgq_msg_recv(msgq_msg_t *msg, msgq_queue_t *q)
int msgq_msg_ready(msgq_queue_t *q)
int msgq_poll(msgq_pollitem_t *items, size_t nitems, int timeout)
bool msgq_all_readers_updated(msgq_queue_t *q)
dir /home/batman/openpilot/cereal
dir /home/batman/openpilot/cereal/messaging

visionipc

class VisionBuf

Public Functions

void allocate(size_t len)
void import()
void init_cl(cl_device_id device_id, cl_context ctx)
void init_rgb(size_t width, size_t height, size_t stride)
void init_yuv(size_t width, size_t height, size_t stride, size_t uv_offset)
int sync(int dir)
int free()
void set_frame_id(uint64_t id)
uint64_t get_frame_id()

Public Members

size_t len = 0
size_t mmap_len = 0
void *addr = nullptr
uint64_t *frame_id
int fd = 0
bool rgb = false
size_t width = 0
size_t height = 0
size_t stride = 0
size_t uv_offset = 0
uint8_t *y = nullptr
uint8_t *uv = nullptr
uint64_t server_id = 0
size_t idx = 0
VisionStreamType type
cl_mem buf_cl = nullptr
cl_command_queue copy_q = nullptr
int handle = 0
class VisionIpcClient

Public Functions

VisionIpcClient(std::string name, VisionStreamType type, bool conflate, cl_device_id device_id = nullptr, cl_context ctx = nullptr)
~VisionIpcClient()
VisionBuf *recv(VisionIpcBufExtra *extra = nullptr, const int timeout_ms = 100)
bool connect(bool blocking = true)
bool is_connected()

Public Members

bool connected = false
int num_buffers = 0
VisionBuf buffers[VISIONIPC_MAX_FDS]

Private Functions

void init_msgq(bool conflate)

Private Members

std::string name
Context *msg_ctx
SubSocket *sock
Poller *poller
VisionStreamType type
cl_device_id device_id = nullptr
cl_context ctx = nullptr
class VisionIpcServer

Public Functions

VisionIpcServer(std::string name, cl_device_id device_id = nullptr, cl_context ctx = nullptr)
~VisionIpcServer()
VisionBuf *get_buffer(VisionStreamType type)
void create_buffers(VisionStreamType type, size_t num_buffers, bool rgb, size_t width, size_t height)
void create_buffers_with_sizes(VisionStreamType type, size_t num_buffers, bool rgb, size_t width, size_t height, size_t size, size_t stride, size_t uv_offset)
void send(VisionBuf *buf, VisionIpcBufExtra *extra, bool sync = true)
void start_listener()

Private Functions

void listener(void)

Private Members

cl_device_id device_id = nullptr
cl_context ctx = nullptr
uint64_t server_id
std::atomic<bool> should_exit = false
std::string name
std::thread listener_thread
std::map<VisionStreamType, std::atomic<size_t>> cur_idx
std::map<VisionStreamType, std::vector<VisionBuf*>> buffers
std::map<VisionStreamType, std::map<VisionBuf*, size_t>> idxs
Context *msg_ctx
std::map<VisionStreamType, PubSocket*> sockets
file ipc.h
#include <cstddef>

Functions

int ipc_connect(const char *socket_path)
int ipc_bind(const char *socket_path)
int ipc_sendrecv_with_fds(bool send, int fd, void *buf, size_t buf_size, int *fds, int num_fds, int *out_num_fds)
file visionbuf.h
#include “visionipc.h”
#include <cstdint>
#include <cstddef>
#include <CL/cl.h>

Defines

CL_USE_DEPRECATED_OPENCL_1_2_APIS
VISIONBUF_SYNC_FROM_DEVICE
VISIONBUF_SYNC_TO_DEVICE

Enums

enum VisionStreamType

Values:

enumerator VISION_STREAM_ROAD
enumerator VISION_STREAM_DRIVER
enumerator VISION_STREAM_WIDE_ROAD
enumerator VISION_STREAM_MAP
enumerator VISION_STREAM_MAX

Functions

void visionbuf_compute_aligned_width_and_height(int width, int height, int *aligned_w, int *aligned_h)
file visionipc_client.h
#include <vector>
#include <string>
#include <unistd.h>
#include “messaging/messaging.h”
#include “visionipc/visionipc.h”
#include “visionipc/visionbuf.h
file visionipc_server.h
#include <vector>
#include <string>
#include <thread>
#include <atomic>
#include <map>
#include “messaging/messaging.h”
#include “visionipc/visionipc.h”
#include “visionipc/visionbuf.h

Functions

std::string get_endpoint_name(std::string name, VisionStreamType type)
dir /home/batman/openpilot/cereal
dir /home/batman/openpilot/cereal/visionipc

selfdrive

camerad

class CameraBuf

Public Functions

CameraBuf()
~CameraBuf()
void init(cl_device_id device_id, cl_context context, CameraState *s, VisionIpcServer *v, int frame_cnt, VisionStreamType yuv_type)
bool acquire()
void queue(size_t buf_idx)

Public Members

cl_command_queue q
FrameMetadata cur_frame_data
VisionBuf *cur_yuv_buf
VisionBuf *cur_camera_buf
std::unique_ptr<VisionBuf[]> camera_bufs
std::unique_ptr<FrameMetadata[]> camera_bufs_metadata
int rgb_width
int rgb_height
int rgb_stride
mat3 yuv_transform

Private Members

VisionIpcServer *vipc_server
Debayer *debayer = nullptr
VisionStreamType yuv_type
int cur_buf_idx
SafeQueue<int> safe_queue
int frame_buf_count
struct CameraInfo

Public Members

uint32_t frame_width
uint32_t frame_height
uint32_t frame_stride
uint32_t frame_offset = 0
uint32_t extra_height = 0
int registers_offset = -1
int stats_offset = -1
class CameraState

Public Functions

void handle_camera_event(void *evdat)
void set_camera_exposure(float grey_frac)
void sensors_start()
void camera_open(MultiCameraState *multi_cam_state, int camera_num, bool enabled)
void camera_set_parameters()
void camera_map_bufs(MultiCameraState *s)
void camera_init(MultiCameraState *s, VisionIpcServer *v, int camera_id, unsigned int fps, cl_device_id device_id, cl_context ctx, VisionStreamType yuv_type)
void camera_close()
std::map<uint16_t, uint16_t> ar0231_parse_registers(uint8_t *data, std::initializer_list<uint16_t> addrs)

Public Members

MultiCameraState *multi_cam_state
CameraInfo ci
bool enabled
std::mutex exp_lock
int exposure_time
bool dc_gain_enabled
int dc_gain_weight
int gain_idx
float analog_gain_frac
int exposure_time_min
int exposure_time_max
float dc_gain_factor
int dc_gain_min_weight
int dc_gain_max_weight
float dc_gain_on_grey
float dc_gain_off_grey
float sensor_analog_gains[35]
int analog_gain_min_idx
int analog_gain_max_idx
int analog_gain_rec_idx
float cur_ev[3]
float min_ev
float max_ev
float measured_grey_fraction
float target_grey_fraction
float target_grey_factor
unique_fd sensor_fd
unique_fd csiphy_fd
int camera_num
int32_t session_handle
int32_t sensor_dev_handle
int32_t isp_dev_handle
int32_t csiphy_dev_handle
int buf0_handle
int buf_handle[FRAME_BUF_COUNT]
int sync_objs[FRAME_BUF_COUNT]
int request_ids[FRAME_BUF_COUNT]
int request_id_last
int frame_id_last
int idx_offset
bool skipped
int camera_id
CameraBuf buf
MemoryManager mm

Private Functions

void config_isp(int io_mem_handle, int fence, int request_id, int buf0_mem_handle, int buf0_offset)
void enqueue_req_multi(int start, int n, bool dp)
void enqueue_buffer(int i, bool dp)
int clear_req_queue()
int sensors_init()
void sensors_poke(int request_id)
void sensors_i2c(struct i2c_random_wr_payload *dat, int len, int op_code, bool data_word)
std::map<uint16_t, std::pair<int, int>> ar0231_build_register_lut(uint8_t *data)

Private Members

std::map<uint16_t, std::pair<int, int>> ar0231_register_lut
struct FrameMetadata

Public Members

uint32_t frame_id
unsigned int frame_length
uint64_t timestamp_sof
uint64_t timestamp_eof
unsigned int integ_lines
bool high_conversion_gain
float gain
float measured_grey_fraction
float target_grey_fraction
unsigned int lens_pos
float lens_err
float lens_true_pos
float processing_time
class MemoryManager

Public Functions

void init(int _video0_fd)
void *alloc(int len, uint32_t *handle)
void free(void *ptr)
~MemoryManager()

Private Members

std::mutex lock
std::map<void*, uint32_t> handle_lookup
std::map<void*, int> size_lookup
std::map<int, std::queue<void*>> cached_allocations
int video0_fd
struct MultiCameraState

Public Members

unique_fd video0_fd
unique_fd cam_sync_fd
unique_fd isp_fd
int device_iommu
int cdm_iommu
CameraState road_cam
CameraState wide_road_cam
CameraState driver_cam
PubMaster *pm
file camera_common.h
#include <cstdint>
#include <cstdlib>
#include <memory>
#include <thread>
#include “cereal/messaging/messaging.h”
#include “cereal/visionipc/visionbuf.h”
#include “cereal/visionipc/visionipc.h”
#include “cereal/visionipc/visionipc_server.h”
#include “common/mat.h”
#include “common/queue.h”
#include “common/swaglog.h”
#include “system/hardware/hw.h”

Defines

CAMERA_ID_IMX298
CAMERA_ID_IMX179
CAMERA_ID_S5K3P8SP
CAMERA_ID_OV8865
CAMERA_ID_IMX298_FLIPPED
CAMERA_ID_OV10640
CAMERA_ID_LGC920
CAMERA_ID_LGC615
CAMERA_ID_AR0231
CAMERA_ID_OX03C10
CAMERA_ID_MAX

Typedefs

typedef struct CameraInfo CameraInfo
typedef struct FrameMetadata FrameMetadata
typedef void (*process_thread_cb)(MultiCameraState *s, CameraState *c, int cnt)

Enums

enum CameraType

Values:

enumerator RoadCam
enumerator DriverCam
enumerator WideRoadCam

Functions

void fill_frame_data(cereal::FrameData::Builder &framed, const FrameMetadata &frame_data, CameraState *c)
kj::Array<uint8_t> get_raw_frame_image(const CameraBuf *b)
float set_exposure_target(const CameraBuf *b, int x_start, int x_end, int x_skip, int y_start, int y_end, int y_skip)
std::thread start_process_thread(MultiCameraState *cameras, CameraState *cs, process_thread_cb callback)
void cameras_init(VisionIpcServer *v, MultiCameraState *s, cl_device_id device_id, cl_context ctx)
void cameras_open(MultiCameraState *s)
void cameras_run(MultiCameraState *s)
void cameras_close(MultiCameraState *s)
void camerad_thread()
int open_v4l_by_name_and_index(const char name[], int index = 0, int flags = O_RDWR | O_NONBLOCK)

Variables

const int YUV_BUFFER_COUNT = 40
const bool env_disable_road = getenv("DISABLE_ROAD") != NULL
const bool env_disable_wide_road = getenv("DISABLE_WIDE_ROAD") != NULL
const bool env_disable_driver = getenv("DISABLE_DRIVER") != NULL
const bool env_debug_frames = getenv("DEBUG_FRAMES") != NULL
const bool env_log_raw_frames = getenv("LOG_RAW_FRAMES") != NULL
const bool env_ctrl_exp_from_params = getenv("CTRL_EXP_FROM_PARAMS") != NULL
file camera_qcom2.h
#include <cstdint>
#include <map>
#include <utility>
#include <media/cam_req_mgr.h>
#include “common/params.h”
#include “common/util.h”

Defines

FRAME_BUF_COUNT

Typedefs

typedef struct MultiCameraState MultiCameraState
file camera_util.h
#include <map>
#include <mutex>
#include <optional>
#include <queue>
#include <media/cam_req_mgr.h>

Functions

std::optional<int32_t> device_acquire(int fd, int32_t session_handle, void *data, uint32_t num_resources = 1)
int device_config(int fd, int32_t session_handle, int32_t dev_handle, uint64_t packet_handle)
int device_control(int fd, int op_code, int session_handle, int dev_handle)
int do_cam_control(int fd, int op_code, void *handle, int size)
void *alloc_w_mmu_hdl(int video0_fd, int len, uint32_t *handle, int align = 8, int flags = CAM_MEM_FLAG_KMD_ACCESS | CAM_MEM_FLAG_UMD_ACCESS | CAM_MEM_FLAG_CMD_BUF_TYPE, int mmu_hdl = 0, int mmu_hdl2 = 0)
void release(int video0_fd, uint32_t handle)
dir /home/batman/openpilot/system/camerad
dir /home/batman/openpilot/system/camerad/cameras
dir /home/batman/openpilot/system
class LapConv

Public Functions

LapConv(cl_device_id device_id, cl_context ctx, int rgb_width, int rgb_height, int rgb_stride, int filter_size)
~LapConv()
uint16_t Update(cl_command_queue q, const uint8_t *rgb_buf, const int roi_id)

Private Members

cl_mem roi_cl
cl_mem result_cl
cl_mem filter_cl
cl_program prg
cl_kernel krnl
const int width
const int height
const int rgb_stride
std::vector<uint8_t> roi_buf
std::vector<int16_t> result_buf
file utils.h
#include <cstddef>
#include <cstdint>
#include <vector>
#include “common/clutil.h”

Defines

NUM_SEGMENTS_X
NUM_SEGMENTS_Y
ROI_X_MIN
ROI_X_MAX
ROI_Y_MIN
ROI_Y_MAX
LM_THRESH
LM_PREC_THRESH
CONV_LOCAL_WORKSIZE

Functions

bool is_blur(const uint16_t *lapmap, const size_t size)
dir /home/batman/openpilot/system/camerad
dir /home/batman/openpilot/system/camerad/imgproc
dir /home/batman/openpilot/system

locationd

class Localizer

Public Functions

Localizer()
int locationd_thread()
void reset_kalman(double current_time = NAN)
void reset_kalman(double current_time, Eigen::VectorXd init_orient, Eigen::VectorXd init_pos, Eigen::VectorXd init_vel, MatrixXdr init_pos_R, MatrixXdr init_vel_R)
void reset_kalman(double current_time, Eigen::VectorXd init_x, MatrixXdr init_P)
void finite_check(double current_time = NAN)
void time_check(double current_time = NAN)
void update_reset_tracker()
bool isGpsOK()
void determine_gps_mode(double current_time)
kj::ArrayPtr<capnp::byte> get_message_bytes(MessageBuilder &msg_builder, bool inputsOK, bool sensorsOK, bool gpsOK, bool msgValid)
void build_live_location(cereal::LiveLocationKalman::Builder &fix)
Eigen::VectorXd get_position_geodetic()
Eigen::VectorXd get_state()
Eigen::VectorXd get_stdev()
void handle_msg_bytes(const char *data, const size_t size)
void handle_msg(const cereal::Event::Reader &log)
void handle_sensor(double current_time, const cereal::SensorEventData::Reader &log)
void handle_gps(double current_time, const cereal::GpsLocationData::Reader &log, const double sensor_time_offset)
void handle_car_state(double current_time, const cereal::CarState::Reader &log)
void handle_cam_odo(double current_time, const cereal::CameraOdometry::Reader &log)
void handle_live_calib(double current_time, const cereal::LiveCalibrationData::Reader &log)
void input_fake_gps_observations(double current_time)

Private Members

std::unique_ptr<LiveKalman> kf
Eigen::VectorXd calib
MatrixXdr device_from_calib
MatrixXdr calib_from_device
bool calibrated = false
double car_speed = 0.0
double last_reset_time = NAN
std::deque<double> posenet_stds
std::unique_ptr<LocalCoord> converter
int64_t unix_timestamp_millis = 0
double last_gps_fix = 0
double reset_tracker = 0.0
bool device_fell = false
bool gps_mode = false
class UbloxMsgParser

Public Functions

bool add_data(const uint8_t *incoming_data, uint32_t incoming_data_len, size_t &bytes_consumed)
void reset()
int needed_bytes()
std::string data()
std::pair<std::string, kj::Array<capnp::word>> gen_msg()
kj::Array<capnp::word> gen_nav_pvt(ubx_t::nav_pvt_t *msg)
kj::Array<capnp::word> gen_rxm_sfrbx(ubx_t::rxm_sfrbx_t *msg)
kj::Array<capnp::word> gen_rxm_rawx(ubx_t::rxm_rawx_t *msg)
kj::Array<capnp::word> gen_mon_hw(ubx_t::mon_hw_t *msg)
kj::Array<capnp::word> gen_mon_hw2(ubx_t::mon_hw2_t *msg)

Private Functions

bool valid_cheksum()
bool valid()
bool valid_so_far()

Private Members

std::unordered_map<int, std::unordered_map<int, std::string>> gps_subframes
size_t bytes_in_parse_buf = 0
uint8_t msg_parse_buf[ublox::UBLOX_HEADER_SIZE + ublox::UBLOX_MAX_MSG_SIZE]
struct ubx_mga_ini_time_utc_t

Public Members

uint8_t type
uint8_t version
uint8_t ref
int8_t leapSecs
uint16_t year
uint8_t month
uint8_t day
uint8_t hour
uint8_t minute
uint8_t second
uint8_t reserved1
uint32_t ns
uint16_t tAccS
uint16_t reserved2
uint32_t tAccNs
namespace string_literals
namespace ublox

Functions

struct ublox::ubx_mga_ini_time_utc_t ublox::__attribute__((packed))
std::string ubx_add_checksum(const std::string &msg)
std::string build_ubx_mga_ini_time_utc(struct tm time)

Variables

const uint8_t PREAMBLE1 = 0xb5
const uint8_t PREAMBLE2 = 0x62
const int UBLOX_HEADER_SIZE = 6
const int UBLOX_CHECKSUM_SIZE = 2
const int UBLOX_MAX_MSG_SIZE = 65536
file locationd.h
#include <eigen3/Eigen/Dense>
#include <fstream>
#include <memory>
#include <string>
#include “cereal/messaging/messaging.h”
#include “common/transformations/coordinates.hpp”
#include “common/transformations/orientation.hpp”
#include “common/params.h”
#include “common/swaglog.h”
#include “common/timing.h”
#include “common/util.h”
#include “selfdrive/sensord/sensors/constants.h”
#include “selfdrive/locationd/models/live_kf.h”

Defines

VISION_DECIMATION
SENSOR_DECIMATION
POSENET_STD_HIST_HALF

Variables

class Localizer __attribute__
file ublox_msg.h
#include <cassert>
#include <cstdint>
#include <memory>
#include <string>
#include <unordered_map>
#include <ctime>
#include “cereal/messaging/messaging.h”
#include “common/util.h”
#include “selfdrive/locationd/generated/gps.h”
#include “selfdrive/locationd/generated/ubx.h”

Variables

uint8_t type
uint8_t version
uint8_t ref
int8_t leapSecs
uint16_t year
uint8_t month
uint8_t day
uint8_t hour
uint8_t minute
uint8_t second
uint8_t reserved1
uint32_t ns
uint16_t tAccS
uint16_t reserved2
uint32_t tAccNs
dir /home/batman/openpilot/selfdrive/locationd
dir /home/batman/openpilot/selfdrive

ui

struct Alert

Public Functions

bool equal(const Alert &a2)

Public Members

QString text1
QString text2
QString type
cereal::ControlsState::AlertSize size
AudibleAlert sound

Public Static Functions

static Alert get(const SubMaster &sm, uint64_t started_frame)
class Device : public QObject

Public Functions

Device(QObject *parent = 0)

Public Slots

void resetInteractiveTimout()
void update(const UIState &s)

Signals

void displayPowerChanged(bool on)
void interactiveTimout()

Private Functions

void updateBrightness(const UIState &s)
void updateWakefulness(const UIState &s)
bool motionTriggered(const UIState &s)
void setAwake(bool on)

Private Members

bool awake = false
int interactive_timeout = 0
bool ignition_on = false
int last_brightness = 0
FirstOrderFilter brightness_filter
QFuture<void> brightness_future
struct UIScene

Public Members

bool calibration_valid = false
bool calibration_wide_valid = false
bool wide_cam = true
mat3 view_from_calib = DEFAULT_CALIBRATION
mat3 view_from_wide_calib = DEFAULT_CALIBRATION
cereal::PandaState::PandaType pandaType
float lane_line_probs[4]
float road_edge_stds[2]
QPolygonF track_vertices
QPolygonF lane_line_vertices[4]
QPolygonF road_edge_vertices[2]
QPointF lead_vertices[2]
float light_sensor
bool started
bool ignition
bool is_metric
bool map_on_left
bool longitudinal_control
bool end_to_end_long
uint64_t started_frame
class UIState : public QObject

Public Functions

UIState(QObject *parent = 0)
void updateStatus()
bool worldObjectsVisible() const
bool engaged() const

Public Members

int fb_w = 0
int fb_h = 0
std::unique_ptr<SubMaster> sm
UIStatus status
UIScene scene = {}
bool awake
int prime_type
QString language
QTransform car_space_transform
bool wide_cam_only

Signals

void uiUpdate(const UIState &s)
void offroadTransition(bool offroad)
void primeTypeChanged(int prime_type)

Private Members

QTimer *timer
bool started_prev = false
int prime_type_prev = -1

Private Slots

void update()
file ui.h
#include <memory>
#include <string>
#include <optional>
#include <QObject>
#include <QTimer>
#include <QColor>
#include <QFuture>
#include <QPolygonF>
#include <QTransform>
#include “cereal/messaging/messaging.h”
#include “common/modeldata.h”
#include “common/params.h”
#include “common/timing.h”

Typedefs

typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert
typedef enum UIStatus UIStatus
typedef struct UIScene UIScene

Enums

enum UIStatus

Values:

enumerator STATUS_DISENGAGED
enumerator STATUS_OVERRIDE
enumerator STATUS_ENGAGED
enumerator STATUS_WARNING
enumerator STATUS_ALERT

Functions

UIState *uiState()
void ui_update_params(UIState *s)
int get_path_length_idx(const cereal::ModelDataV2::XYZTData::Reader &line, const float path_height)
void update_model(UIState *s, const cereal::ModelDataV2::Reader &model)
void update_leads(UIState *s, const cereal::RadarState::Reader &radar_state, const cereal::ModelDataV2::XYZTData::Reader &line)
void update_line_data(const UIState *s, const cereal::ModelDataV2::XYZTData::Reader &line, float y_off, float z_off, QPolygonF *pvd, int max_idx, bool allow_invert)

Variables

const int bdr_s = 30
const int header_h = 420
const int footer_h = 280
const int UI_FREQ = 20
const mat3 DEFAULT_CALIBRATION = {{0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0}}
const QColor bg_colors [] = {[STATUS_DISENGAGED] =  QColor(0x17, 0x33, 0x49, 0xc8),[STATUS_OVERRIDE] = QColor(0x91, 0x9b, 0x95, 0xf1),[STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),[STATUS_WARNING] = QColor(0xDA, 0x6F, 0x25, 0xf1),[STATUS_ALERT] = QColor(0xC9, 0x22, 0x31, 0xf1),}
dir /home/batman/openpilot/selfdrive
dir /home/batman/openpilot/selfdrive/ui

soundd

class Sound : public QObject

Public Functions

Sound(QObject *parent = 0)

Protected Functions

void update()
void setAlert(const Alert &alert)

Protected Attributes

Alert current_alert = {}
QMap<AudibleAlert, QPair<QSoundEffect*, int>> sounds
SubMaster sm
uint64_t started_frame
file sound.h
#include <QMap>
#include <QSoundEffect>
#include <QString>
#include “system/hardware/hw.h”
#include “selfdrive/ui/ui.h”

Variables

const std::tuple<AudibleAlert, QString, int> sound_list[] = {{AudibleAlert::ENGAGE, "engage.wav", 0}, {AudibleAlert::DISENGAGE, "disengage.wav", 0}, {AudibleAlert::REFUSE, "refuse.wav", 0}, {AudibleAlert::PROMPT, "prompt.wav", 0}, {AudibleAlert::PROMPT_REPEAT, "prompt.wav", QSoundEffect::Infinite}, {AudibleAlert::PROMPT_DISTRACTED, "prompt_distracted.wav", QSoundEffect::Infinite}, {AudibleAlert::WARNING_SOFT, "warning_soft.wav", QSoundEffect::Infinite}, {AudibleAlert::WARNING_IMMEDIATE, "warning_immediate.wav", QSoundEffect::Infinite},}
dir /home/batman/openpilot/selfdrive
dir /home/batman/openpilot/selfdrive/ui/soundd
dir /home/batman/openpilot/selfdrive/ui

replay

struct AVFrameDeleter

Public Functions

void operator()(AVFrame *frame) const
struct Camera

Public Members

CameraType type
VisionStreamType stream_type
int width
int height
std::thread thread
SafeQueue<std::pair<FrameReader*, const cereal::EncodeIndex::Reader>> queue
int cached_id = -1
int cached_seg = -1
VisionBuf *cached_buf
class CameraServer

Public Functions

CameraServer(std::pair<int, int> camera_size[MAX_CAMERAS] = nullptr)
~CameraServer()
void pushFrame(CameraType type, FrameReader *fr, const cereal::EncodeIndex::Reader &eidx)
void waitForSent()

Protected Functions

void startVipcServer()
void cameraThread(Camera &cam)

Protected Attributes

Camera cameras_ [MAX_CAMERAS] = {{.type = RoadCam, .stream_type = VISION_STREAM_ROAD},{.type = DriverCam, .stream_type = VISION_STREAM_DRIVER},{.type = WideRoadCam, .stream_type = VISION_STREAM_WIDE_ROAD},}
std::atomic<int> publishing_ = 0
std::unique_ptr<VisionIpcServer> vipc_server_
class ConsoleUI : public QObject

Public Functions

ConsoleUI(Replay *replay, QObject *parent = 0)
~ConsoleUI()

Signals

void updateProgressBarSignal(uint64_t cur, uint64_t total, bool success)
void logMessageSignal(ReplyMsgType type, const QString &msg)

Private Types

enum Status

Values:

enumerator Waiting
enumerator Playing
enumerator Paused
enum Win

Values:

enumerator Title
enumerator Stats
enumerator Log
enumerator LogBorder
enumerator DownloadBar
enumerator Timeline
enumerator TimelineDesc
enumerator Help
enumerator CarState
enumerator Max

Private Functions

void initWindows()
void handleKey(char c)
void displayHelp()
void displayTimelineDesc()
void updateTimeline()
void updateSummary()
void updateStatus()
void pauseReplay(bool pause)

Private Members

std::array<WINDOW*, Win::Max> w = {}
SubMaster sm
Replay *replay
QBasicTimer getch_timer
QTimer sm_timer
QSocketNotifier notifier = {0, QSocketNotifier::Read, this}
int max_width
int max_height
Status status = Status::Waiting

Private Slots

void readyRead()
void timerEvent(QTimerEvent *ev)
void updateProgressBar(uint64_t cur, uint64_t total, bool success)
void logMessage(ReplyMsgType type, const QString &msg)
class Event

Public Functions

Event(cereal::Event::Which which, uint64_t mono_time)
Event(const kj::ArrayPtr<const capnp::word> &amsg, bool frame = false)
kj::ArrayPtr<const capnp::byte> bytes() const

Public Members

uint64_t mono_time
cereal::Event::Which which
cereal::Event::Reader event
capnp::FlatArrayMessageReader reader
kj::ArrayPtr<const capnp::word> words
bool frame
class FileReader

Public Functions

FileReader(bool cache_to_local, size_t chunk_size = 0, int retries = 3)
virtual ~FileReader()
std::string read(const std::string &file, std::atomic<bool> *abort = nullptr)

Private Functions

std::string download(const std::string &url, std::atomic<bool> *abort)

Private Members

size_t chunk_size_
int max_retries_
bool cache_to_local_
class FrameReader

Public Functions

FrameReader()
~FrameReader()
bool load(const std::string &url, bool no_hw_decoder = false, std::atomic<bool> *abort = nullptr, bool local_cache = false, int chunk_size = -1, int retries = 0)
bool load(const std::byte *data, size_t size, bool no_hw_decoder = false, std::atomic<bool> *abort = nullptr)
bool get(int idx, uint8_t *yuv)
int getYUVSize() const
size_t getFrameCount() const
bool valid() const

Public Members

int width = 0
int height = 0
int aligned_width = 0
int aligned_height = 0

Private Functions

bool initHardwareDecoder(AVHWDeviceType hw_device_type)
bool decode(int idx, uint8_t *yuv)
AVFrame *decodeFrame(AVPacket *pkt)
bool copyBuffers(AVFrame *f, uint8_t *yuv)

Private Members

std::vector<AVPacket*> packets
std::unique_ptr<AVFrame, AVFrameDeleter> av_frame_
std::unique_ptr<AVFrame, AVFrameDeleter> hw_frame
AVFormatContext *input_ctx = nullptr
AVCodecContext *decoder_ctx = nullptr
int key_frames_count_ = 0
bool valid_ = false
AVIOContext *avio_ctx_ = nullptr
AVPixelFormat hw_pix_fmt = AV_PIX_FMT_NONE
AVBufferRef *hw_device_ctx = nullptr
int prev_idx = -1

Private Static Attributes

static std::atomic<bool> has_hw_decoder = true
struct lessThan

Public Functions

bool operator()(const Event *l, const Event *r)
class LogReader

Public Functions

LogReader(size_t memory_pool_block_size = DEFAULT_EVENT_MEMORY_POOL_BLOCK_SIZE)
~LogReader()
bool load(const std::string &url, std::atomic<bool> *abort = nullptr, const std::set<cereal::Event::Which> &allow = {}, bool local_cache = false, int chunk_size = -1, int retries = 0)
bool load(const std::byte *data, size_t size, std::atomic<bool> *abort = nullptr)

Public Members

std::vector<Event*> events

Private Functions

bool parse(const std::set<cereal::Event::Which> &allow, std::atomic<bool> *abort)

Private Members

std::string raw_
class Replay : public QObject

Public Functions

Replay(QString route, QStringList allow, QStringList block, SubMaster *sm = nullptr, uint32_t flags = REPLAY_FLAG_NONE, QString data_dir = "", QObject *parent = 0)
~Replay()
bool load()
void start(int seconds = 0)
void stop()
void pause(bool pause)
void seekToFlag(FindFlag flag)
void seekTo(double seconds, bool relative)
bool isPaused() const
void installEventFilter(replayEventFilter filter, void *opaque)
int segmentCacheLimit() const
void setSegmentCacheLimit(int n)
bool hasFlag(REPLAY_FLAGS flag) const
void addFlag(REPLAY_FLAGS flag)
void removeFlag(REPLAY_FLAGS flag)
const Route *route() const
double currentSeconds() const
uint64_t routeStartTime() const
int toSeconds(uint64_t mono_time) const
int totalSeconds() const
void setSpeed(float speed)
float getSpeed() const
const std::vector<Event*> *events() const
const std::string &carFingerprint() const
const std::vector<std::tuple<int, int, TimelineType>> getTimeline()

Signals

void streamStarted()
void segmentsMerged()

Protected Types

typedef std::map<int, std::unique_ptr<Segment>> SegmentMap

Protected Functions

std::optional<uint64_t> find(FindFlag flag)
void startStream(const Segment *cur_segment)
void stream()
void setCurrentSegment(int n)
void queueSegment()
void mergeSegments(const SegmentMap::iterator &begin, const SegmentMap::iterator &end)
void updateEvents(const std::function<bool()> &lambda)
void publishMessage(const Event *e)
void publishFrame(const Event *e)
void buildTimeline()
bool isSegmentMerged(int n)

Protected Attributes

QThread *stream_thread_ = nullptr
std::mutex stream_lock_
std::condition_variable stream_cv_
std::atomic<bool> updating_events_ = false
std::atomic<int> current_segment_ = 0
SegmentMap segments_
std::atomic<bool> exit_ = false
bool paused_ = false
bool events_updated_ = false
uint64_t route_start_ts_ = 0
std::atomic<uint64_t> cur_mono_time_ = 0
std::unique_ptr<std::vector<Event*>> events_
std::unique_ptr<std::vector<Event*>> new_events_
std::vector<int> segments_merged_
SubMaster *sm = nullptr
std::unique_ptr<PubMaster> pm
std::vector<const char*> sockets_
std::unique_ptr<Route> route_
std::unique_ptr<CameraServer> camera_server_
std::atomic<uint32_t> flags_ = REPLAY_FLAG_NONE
std::mutex timeline_lock
QFuture<void> timeline_future
std::vector<std::tuple<int, int, TimelineType>> timeline
std::set<cereal::Event::Which> allow_list
std::string car_fingerprint_
float speed_ = 1.0
replayEventFilter event_filter = nullptr
void *filter_opaque = nullptr
int segment_cache_limit = 3

Protected Slots

void segmentLoadFinished(bool success)
class Route

Public Functions

Route(const QString &route, const QString &data_dir = {})
bool load()
const QString &name() const
const QString &dir() const
const RouteIdentifier &identifier() const
const std::map<int, SegmentFile> &segments() const
const SegmentFile &at(int n)

Public Static Functions

static RouteIdentifier parseRoute(const QString &str)

Protected Functions

bool loadFromLocal()
bool loadFromServer()
bool loadFromJson(const QString &json)
void addFileToSegment(int seg_num, const QString &file)

Protected Attributes

RouteIdentifier route_ = {}
QString data_dir_
std::map<int, SegmentFile> segments_
struct RouteIdentifier

Public Members

QString dongle_id
QString timestamp
int segment_id
QString str
class Segment : public QObject

Public Functions

Segment(int n, const SegmentFile &files, uint32_t flags, const std::set<cereal::Event::Which> &allow = {})
~Segment()
bool isLoaded() const

Public Members

const int seg_num = 0
std::unique_ptr<LogReader> log
std::unique_ptr<FrameReader> frames[MAX_CAMERAS] = {}

Signals

void loadFinished(bool success)

Protected Functions

void loadFile(int id, const std::string file)

Protected Attributes

std::atomic<bool> abort_ = false
std::atomic<int> loading_ = 0
QFutureSynchronizer<void> synchronizer_
uint32_t flags
std::set<cereal::Event::Which> allow
struct SegmentFile

Public Members

QString rlog
QString qlog
QString road_cam
QString driver_cam
QString wide_road_cam
QString qcamera
file camera.h
#include <unistd.h>
#include “cereal/visionipc/visionipc_server.h”
#include “common/queue.h”
#include “tools/replay/logreader.h
file consoleui.h
#include <array>
#include <QBasicTimer>
#include <QObject>
#include <QSocketNotifier>
#include <QTimer>
#include <QTimerEvent>
#include “tools/replay/replay.h
#include <ncurses.h>
file filereader.h
#include <atomic>
#include <string>

Functions

std::string cacheFilePath(const std::string &url)
file framereader.h
#include <memory>
#include <string>
#include <vector>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
file logreader.h
#include <set>
#include “cereal/gen/cpp/log.capnp.h”
#include “system/camerad/cameras/camera_common.h”

Variables

const CameraType ALL_CAMERAS[] = {RoadCam, DriverCam, WideRoadCam}
const int MAX_CAMERAS = std::size(ALL_CAMERAS)
const int DEFAULT_EVENT_MEMORY_POOL_BLOCK_SIZE = 65000
file replay.h
#include <optional>
#include <QThread>
#include “tools/replay/camera.h
#include “tools/replay/route.h

Typedefs

typedef bool (*replayEventFilter)(const Event*, void*)

Enums

enum REPLAY_FLAGS

Values:

enumerator REPLAY_FLAG_NONE
enumerator REPLAY_FLAG_DCAM
enumerator REPLAY_FLAG_ECAM
enumerator REPLAY_FLAG_NO_LOOP
enumerator REPLAY_FLAG_NO_FILE_CACHE
enumerator REPLAY_FLAG_QCAMERA
enumerator REPLAY_FLAG_NO_HW_DECODER
enumerator REPLAY_FLAG_FULL_SPEED
enumerator REPLAY_FLAG_NO_VIPC
enum FindFlag

Values:

enumerator nextEngagement
enumerator nextDisEngagement
enumerator nextUserFlag
enumerator nextInfo
enumerator nextWarning
enumerator nextCritical
enum TimelineType

Values:

enumerator None
enumerator Engaged
enumerator AlertInfo
enumerator AlertWarning
enumerator AlertCritical
enumerator UserFlag

Variables

const QString DEMO_ROUTE = "4cf7a6ad03080c90|2021-09-29--13-46-36"
constexpr int FORWARD_FETCH_SEGS = 3
file route.h
#include <QFutureSynchronizer>
#include “tools/replay/logreader.h
#include “tools/replay/util.h”
file util.h
#include <atomic>
#include <functional>
#include <string>

Defines

rInfo(fmt, ...)
rDebug(fmt, ...)
rWarning(fmt, ...)
rError(fmt, ...)

Typedefs

typedef std::function<void(ReplyMsgType type, const std::string msg)> ReplayMessageHandler
typedef std::function<void(uint64_t cur, uint64_t total, bool success)> DownloadProgressHandler

Enums

enum ReplyMsgType

Values:

enumerator Info
enumerator Debug
enumerator Warning
enumerator Critical

Functions

void installMessageHandler(ReplayMessageHandler)
void logMessage(ReplyMsgType type, const char *fmt, ...)
std::string sha256(const std::string &str)
void precise_nano_sleep(long sleep_ns)
std::string decompressBZ2(const std::string &in, std::atomic<bool> *abort = nullptr)
std::string decompressBZ2(const std::byte *in, size_t in_size, std::atomic<bool> *abort = nullptr)
std::string getUrlWithoutQuery(const std::string &url)
size_t getRemoteFileSize(const std::string &url, std::atomic<bool> *abort = nullptr)
std::string httpGet(const std::string &url, size_t chunk_size = 0, std::atomic<bool> *abort = nullptr)
void installDownloadProgressHandler(DownloadProgressHandler)
bool httpDownload(const std::string &url, const std::string &file, size_t chunk_size = 0, std::atomic<bool> *abort = nullptr)
std::string formattedDataSize(size_t size)
dir /home/batman/openpilot/tools/replay
dir /home/batman/openpilot/tools

qt

class AdvancedNetworking : public QWidget

Public Functions

AdvancedNetworking(QWidget *parent = 0, WifiManager *wifi = 0)

Public Slots

void toggleTethering(bool enabled)
void refresh()

Signals

void backPress()

Private Members

LabelControl *ipLabel
ToggleControl *tetheringToggle
ToggleControl *roamingToggle
ButtonControl *editApnButton
ToggleControl *meteredToggle
WifiManager *wifi = nullptr
Params params
class DeclinePage : public QFrame

Public Functions

DeclinePage(QWidget *parent = 0)

Signals

void getBack()

Private Functions

void showEvent(QShowEvent *event)
class DevicePanel : public ListWidget

Public Functions

DevicePanel(SettingsWindow *parent)

Signals

void reviewTrainingGuide()
void showDriverView()

Private Members

Params params

Private Slots

void poweroff()
void reboot()
void updateCalibDescription()
class DriverViewScene : public QWidget

Public Functions

DriverViewScene(QWidget *parent)

Public Slots

void frameUpdated()

Protected Functions

void showEvent(QShowEvent *event)
void hideEvent(QHideEvent *event)
void paintEvent(QPaintEvent *event)

Private Members

Params params
SubMaster sm
QPixmap face_img
bool is_rhd = false
bool frame_updated = false
class DriverViewWindow : public QWidget

Public Functions

DriverViewWindow(QWidget *parent)

Signals

void done()

Protected Functions

void mouseReleaseEvent(QMouseEvent *e)

Private Members

CameraWidget *cameraView
DriverViewScene *scene
QStackedLayout *layout
struct Network

Public Members

QByteArray ssid
unsigned int strength
ConnectedType connected
SecurityType security_type
class Networking : public QFrame

Public Functions

Networking(QWidget *parent = 0, bool show_advanced = true)

Public Members

WifiManager *wifi = nullptr

Public Slots

void refresh()

Protected Functions

void showEvent(QShowEvent *event)
void hideEvent(QHideEvent *event)

Private Members

QStackedLayout *main_layout = nullptr
QWidget *wifiScreen = nullptr
AdvancedNetworking *an = nullptr
WifiUI *wifiWidget

Private Slots

void connectToNetwork(const Network &n)
void wrongPassword(const QString &ssid)
class OnboardingWindow : public QStackedWidget

Public Functions

OnboardingWindow(QWidget *parent = 0)
void showTrainingGuide()
bool completed() const

Signals

void onboardingDone()

Private Functions

void updateActiveScreen()

Private Members

Params params
bool accepted_terms = false
bool training_done = false
class SettingsWindow : public QFrame

Public Functions

SettingsWindow(QWidget *parent = 0)

Signals

void closeSettings()
void reviewTrainingGuide()
void showDriverView()

Protected Functions

void showEvent(QShowEvent *event)

Private Members

QPushButton *sidebar_alert_widget
QWidget *sidebar_widget
QButtonGroup *nav_btns
QStackedWidget *panel_widget
class SoftwarePanel : public ListWidget

Public Functions

SoftwarePanel(QWidget *parent = nullptr)

Private Functions

void showEvent(QShowEvent *event)
void updateLabels()
void checkForUpdates()

Private Members

bool is_onroad = false
QLabel *onroadLbl
LabelControl *versionLbl
ButtonControl *installBtn
ButtonControl *downloadBtn
ButtonControl *targetBranchBtn
Params params
QFileSystemWatcher *fs_watch
class TermsPage : public QFrame

Public Functions

TermsPage(QWidget *parent = 0)

Public Slots

void enableAccept()

Signals

void acceptedTerms()
void declinedTerms()

Private Functions

void showEvent(QShowEvent *event)

Private Members

QPushButton *accept_btn
class TogglesPanel : public ListWidget

Public Functions

TogglesPanel(SettingsWindow *parent)
void showEvent(QShowEvent *event)

Private Functions

void updateToggles()

Private Members

Params params
std::map<std::string, ParamControl*> toggles
class TrainingGuide : public QFrame

Public Functions

TrainingGuide(QWidget *parent = 0)

Signals

void completedTraining()

Private Functions

void showEvent(QShowEvent *event)
void paintEvent(QPaintEvent *event)
void mouseReleaseEvent(QMouseEvent *e)

Private Members

QImage image
int currentIndex = 0
const QRect continueBtnStandard = {1620, 0, 300, 1080}
QVector<QRect> boundingRectStandard{QRect(112, 804, 619, 166), continueBtnStandard, continueBtnStandard, QRect(1476, 565, 253, 308), QRect(1501, 529, 184, 108), continueBtnStandard, QRect(1613, 665, 178, 153),