gusimplewhiteboard
wb_pixel_to_robot_relative_coord.h
Go to the documentation of this file.
1/*
2 * file wb_pixel_to_robot_relative_coord.h
3 *
4 * This file was generated by classgenerator from pixel_to_robot_relative_coord.gen.
5 * DO NOT CHANGE MANUALLY!
6 *
7 * Copyright © 2021 Carl Lusty. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials
19 * provided with the distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgement:
23 *
24 * This product includes software developed by Carl Lusty.
25 *
26 * 4. Neither the name of the author nor the names of contributors
27 * may be used to endorse or promote products derived from this
28 * software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
34 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 *
42 * -----------------------------------------------------------------------
43 * This program is free software; you can redistribute it and/or
44 * modify it under the above terms or under the terms of the GNU
45 * General Public License as published by the Free Software Foundation;
46 * either version 2 of the License, or (at your option) any later version.
47 *
48 * This program is distributed in the hope that it will be useful,
49 * but WITHOUT ANY WARRANTY; without even the implied warranty of
50 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51 * GNU General Public License for more details.
52 *
53 * You should have received a copy of the GNU General Public License
54 * along with this program; if not, see http://www.gnu.org/licenses/
55 * or write to the Free Software Foundation, Inc., 51 Franklin Street,
56 * Fifth Floor, Boston, MA 02110-1301, USA.
57 *
58 */
59
60#ifndef wb_pixel_to_robot_relative_coord_h
61#define wb_pixel_to_robot_relative_coord_h
62
63#pragma clang diagnostic push
64#pragma clang diagnostic ignored "-Wreserved-id-macro"
65
66#ifdef __linux
67# ifndef _POSIX_SOURCE
68# define _POSIX_SOURCE 200112L
69# endif
70#endif
71#ifndef _XOPEN_SOURCE
72# define _XOPEN_SOURCE 700
73#endif
74#ifdef __APPLE__
75# ifndef _DARWIN_C_SOURCE
76# define _DARWIN_C_SOURCE 200112L
77# endif
78# ifndef __DARWIN_C_LEVEL
79# define __DARWIN_C_LEVEL 200112L
80# endif
81#endif
82
83#pragma clang diagnostic pop
84
85#include <gu_util.h>
86#include <stdint.h>
87
91#include "gu_util.h"
92#include <stdlib.h> //abs
93
94#define CAMERA_HFOV (60.97*M_PI/180)
95#define CAMERA_VFOV (47.64*M_PI/180)
96
97#define BOTTOM_CAMERA_ANGLE (-39.7*M_PI/180)
98#define TOP_CAMERA_ANGLE (-1.2*M_PI/180)
99
100//#define HEAD_BASE_HEIGHT 0.45959
101#define HEAD_BASE_HEIGHT 0.417
102#define HEAD_BASE_HEIGHT_KNEELING 0.377
103
104#define BOTTOM_CAMERA_OFFSET_Z 0.01774
105#define TOP_CAMERA_OFFSET_Z 0.06364
106#define BOTTOM_CAMERA_OFFSET_X 0.05071
107#define TOP_CAMERA_OFFSET_X 0.05871
108
109#ifdef __cplusplus
110extern "C" {
111#endif
112
113#ifdef __cplusplus
114# define CONV_TO_IMG(x, r) (static_cast<uint16_t>((x + INT16_MAX) / ((INT16_MAX * 2) / r)))
115#else
116# define CONV_TO_IMG(x, r) ((uint16_t)((x + INT16_MAX) / ((INT16_MAX * 2) / r)))
117#endif
118
119#pragma clang diagnostic push
120#pragma clang diagnostic ignored "-Wunused-function"
121#pragma clang diagnostic ignored "-Wdouble-promotion"
122#pragma clang diagnostic ignored "-Wunused-parameter"
123
124double get_camera_height(enum VisionCamera camera, struct wb_sensors_torsojointsensors *joints, bool kneeling);
125
126// x: image X coord
127// y: image Y coord
128// camera: which camera you want this related to
129// vs: the vision status message, needed for resolution
130// joints: the nao joint positions
131// *distance: output pararm, populated with the calculated distance
132// *angle: the bearing to the object in the image. Relative to the robot torso.
133void pixel_to_rr_coord(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, double *distance, double *angle);
134
135void pixel_to_rr_coord_legs(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, struct wb_sensors_legjointsensors *leg_sensors, double *distance, double *angle);
136
137void pixel_to_rr_coord_legs_no_conv(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, struct wb_sensors_legjointsensors *leg_sensors, double *distance, double *angle);
138
139void pixel_to_rr_coord_kneeling(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, double *distance, double *angle, bool kneeling);
140
141void pixel_to_rr_coord_kneeling_conv(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, double *distance, double *angle, bool kneeling, bool conv);
142
143void pixel_to_rr_coord_no_conv(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, double *distance, double *angle);
144
145void rr_to_pixel_coord(double angle, double distance, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, int32_t *sx, int32_t *sy, bool kneeling);
146
147#pragma clang diagnostic pop
148
149#ifdef __cplusplus
150} //extern "C"
151#endif
152
153#define PIXEL_TO_ROBOT_RELATIVE_COORD_GENERATED
154#define PIXEL_TO_ROBOT_RELATIVE_COORD_C_STRUCT wb_pixel_to_robot_relative_coord
155#define PIXEL_TO_ROBOT_RELATIVE_COORD_NUMBER_OF_VARIABLES 1
156
157#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
158#define PIXEL_TO_ROBOT_RELATIVE_COORD_DESC_BUFFER_SIZE 14
159#define PIXEL_TO_ROBOT_RELATIVE_COORD_TO_STRING_BUFFER_SIZE 12
160#endif
161
162#ifdef __cplusplus
163extern "C" {
164#endif
165
170{
171
175 int i;
176
177};
178
179#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
180
184const char* wb_pixel_to_robot_relative_coord_description(const struct wb_pixel_to_robot_relative_coord* self, char* descString, size_t bufferSize);
185
189const char* wb_pixel_to_robot_relative_coord_to_string(const struct wb_pixel_to_robot_relative_coord* self, char* toString, size_t bufferSize);
190
195
196#endif
197
198/*#ifdef WHITEBOARD_SERIALISATION*/
199
204
209
210/*#endif /// WHITEBOARD_SERIALISATION*/
211
212#ifdef __cplusplus
213}
214#endif
215
216#endif
WHITEBOARD_POSTER_STRING_CONVERSION.
WHITEBOARD_POSTER_STRING_CONVERSION.
WHITEBOARD_POSTER_STRING_CONVERSION.
WHITEBOARD_POSTER_STRING_CONVERSION.
const char * wb_pixel_to_robot_relative_coord_to_string(const struct wb_pixel_to_robot_relative_coord *self, char *toString, size_t bufferSize)
Convert to a string.
void pixel_to_rr_coord_no_conv(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, double *distance, double *angle)
size_t wb_pixel_to_robot_relative_coord_from_network_serialised(const char *src, struct wb_pixel_to_robot_relative_coord *dst)
Network stream deserialisation.
const char * wb_pixel_to_robot_relative_coord_description(const struct wb_pixel_to_robot_relative_coord *self, char *descString, size_t bufferSize)
Convert to a description string.
void rr_to_pixel_coord(double angle, double distance, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, int32_t *sx, int32_t *sy, bool kneeling)
void pixel_to_rr_coord_kneeling(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, double *distance, double *angle, bool kneeling)
double get_camera_height(enum VisionCamera camera, struct wb_sensors_torsojointsensors *joints, bool kneeling)
void pixel_to_rr_coord(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, double *distance, double *angle)
void pixel_to_rr_coord_kneeling_conv(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, double *distance, double *angle, bool kneeling, bool conv)
void pixel_to_rr_coord_legs_no_conv(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, struct wb_sensors_legjointsensors *leg_sensors, double *distance, double *angle)
struct wb_pixel_to_robot_relative_coord * wb_pixel_to_robot_relative_coord_from_string(struct wb_pixel_to_robot_relative_coord *self, const char *str)
Convert from a string.
void pixel_to_rr_coord_legs(int32_t sx, int32_t sy, enum VisionCamera camera, struct wb_vision_control_status *vs, struct wb_sensors_torsojointsensors *joints, struct wb_sensors_legjointsensors *leg_sensors, double *distance, double *angle)
size_t wb_pixel_to_robot_relative_coord_to_network_serialised(const struct wb_pixel_to_robot_relative_coord *self, char *dst)
WHITEBOARD_POSTER_STRING_CONVERSION.
VisionCamera
Enum of available camera's that can be used by vision.