自动驾驶carla模拟器坐标系转换为icv坐标系[完整版源码]

欢迎点赞转发、一起交流学习

#!/usr/bin/env python

#
# Copyright (c) 2018-2019 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
"""
Tool functions to convert transforms from carla to icv coordinate system
"""

import math
import numpy

import transformations
from geometry_msgs.msg import Vector3, Quaternion, Transform, Pose, Point, Twist, Accel


def carla_location_to_numpy_vector(carla_location):
    """
    Convert a carla location to a icv vector3
    Considers the conversion from left-handed system (unreal) to right-handed
    system (icv)
    :param carla_location: the carla location
    :type carla_location: carla.Location
    :return: a numpy.array with 3 elements
    :rtype: numpy.array
    """
    return numpy.array([
        carla_location.x,
        -carla_location.y,
        carla_location.z
    ])


def carla_location_to_icv_vector3(carla_location):
    """
    Convert a carla location to a icv vector3
    Considers the conversion from left-handed system (unreal) to right-handed
    system (icv)
    :param carla_location: the carla location
    :type carla_location: carla.Location
    :return: a icv vector3
    :rtype: geometry_msgs.msg.Vector3
    """
    icv_translation = Vector3()
    icv_translation.x = carla_location.x
    icv_translation.y = -carla_location.y
    icv_translation.z = carla_location.z

    return icv_translation


def carla_location_to_icv_point(carla_location):
    """
    Convert a carla location to a icv point
    Considers the conversion from left-handed system (unreal) to right-handed
    system (icv)
    :param carla_location: the carla location
    :type carla_location: carla.Location
    :return: a icv point
    :rtype: geometry_msgs.msg.Point
    """
    icv_point = Point()
    icv_point.x = carla_location.x
    icv_point.y = -carla_location.y
    icv_point.z = carla_location.z

    return icv_point


def 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

源代码杀手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值