Skip to content

Instantly share code, notes, and snippets.

View nsubiron's full-sized avatar

Néstor Subirón nsubiron

  • Munich
  • 06:42 (UTC +02:00)
View GitHub Profile
@nsubiron
nsubiron / constexpr_string_methods.hpp
Last active October 21, 2020 18:03
Constexpr methods to handle strings.
#include <cstdint>
#include <string_view>
/// Trim leading chars_to_trim from str.
constexpr std::string_view ltrim(
const std::string_view str,
const std::string_view chars_to_trim = " \t\n\r")
{
if (const auto pos = str.find_first_not_of(chars_to_trim); pos != std::string_view::npos)
{
@nsubiron
nsubiron / SafeDistanceEvent.h
Created July 12, 2019 16:57
Code for tutorial "How to add a new sensor to CARLA Simulator" https://carla.readthedocs.io/en/latest/dev/how_to_add_a_new_sensor/
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
#pragma once
#include "carla/rpc/ActorId.h"
#include "carla/sensor/data/Array.h"
@nsubiron
nsubiron / CarlaSyncMode.py
Created June 27, 2019 14:40
Example of context manager to ease working with CARLA Simulator in synchronous mode.
# Example of context manager to ease working with CARLA Simulator in synchronous
# mode. Creates an object that synchronizes the data of every sensor.
# ==============================================================================
# -- Usage example -------------------------------------------------------------
# ==============================================================================
import carla
@nsubiron
nsubiron / carla-0.9.X-api.py
Last active October 24, 2023 23:13
CARLA 0.9.X API Proposal
# CARLA 0.9.X API Proposal
# ========================
#
# Core concepts:
#
# - World: a loaded map.
# - Blueprint: specifications for creating an actor.
# - Actor: anything that plays a role in the simulation.
# - Sensor: an actor that produces a data stream.
# - Agent: an AI that controls an actor.