YARP
Yet Another Robot Platform
LaserMeasurementData.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3
* All rights reserved.
4
*
5
* This software may be modified and distributed under the terms of the
6
* BSD-3-Clause license. See the accompanying LICENSE file for details.
7
*/
8
9
#include <
yarp/dev/LaserMeasurementData.h
>
10
#include <cmath>
11
12
using namespace
yarp::dev
;
13
14
LaserMeasurementData::LaserMeasurementData
()
15
{
16
stored_x = stored_y = stored_angle = stored_distance = 0;
17
}
18
19
void
LaserMeasurementData::set_cartesian
(
const
double
x,
const
double
y)
20
{
21
stored_x = x; stored_y = y; stored_distance = sqrt(x*x + y*y); stored_angle = atan2(y, x);
22
}
23
24
void
LaserMeasurementData::set_polar
(
const
double
rho,
const
double
theta)
25
{
26
stored_angle = theta; stored_distance = rho; stored_y = rho*sin(theta); stored_x = rho*cos(theta);
27
}
28
29
void
LaserMeasurementData::get_cartesian
(
double
& x,
double
& y)
30
{
31
x = stored_x; y = stored_y;
32
}
33
34
void
LaserMeasurementData::get_polar
(
double
& rho,
double
& theta)
35
{
36
rho = stored_distance; theta = stored_angle;
37
}
yarp::dev::LaserMeasurementData::get_polar
void get_polar(double &rho, double &theta)
Definition:
LaserMeasurementData.cpp:34
yarp::dev::LaserMeasurementData::get_cartesian
void get_cartesian(double &x, double &y)
Definition:
LaserMeasurementData.cpp:29
yarp::dev::LaserMeasurementData::set_polar
void set_polar(const double rho, const double theta)
Definition:
LaserMeasurementData.cpp:24
yarp::dev
An interface for the device drivers.
Definition:
audioBufferSizeData.cpp:17
LaserMeasurementData.h
yarp::dev::LaserMeasurementData::LaserMeasurementData
LaserMeasurementData()
Definition:
LaserMeasurementData.cpp:14
yarp::dev::LaserMeasurementData::set_cartesian
void set_cartesian(const double x, const double y)
Definition:
LaserMeasurementData.cpp:19
YARP
3.4.100+20201223.2+gitb8ea4d712
src
libYARP_dev
src
yarp
dev
LaserMeasurementData.cpp
Generated on Sun Jan 3 2021 02:46:24 for YARP by
1.8.20