23 #include <sys/types.h> 97 curChan->
next = curChan;
104 curChan->
name = name;
106 if ((
min == 0) && (
max == 0)) {
107 curChan->
scale = 1.0;
116 const int BUFSIZE = 1024;
123 GfOut(
"Telemetry: start monitoring\n");
125 snprintf(buf, BUFSIZE,
"telemetry/%s.cmd", filename);
126 fcmd = fopen(buf,
"w");
130 fprintf(fcmd,
"#!/bin/sh\n");
131 fprintf(fcmd,
"gnuplot -persist > telemetry/%s.png <<!!\n", filename);
133 fprintf(fcmd,
" set grid\n");
134 fprintf(fcmd,
" set size 2.5,1.5\n");
135 fprintf(fcmd,
" set terminal png color\n");
136 fprintf(fcmd,
" set data style lines\n");
138 if (curChan != NULL) {
141 curChan = curChan->
next;
143 fprintf(fcmd,
"plot 'telemetry/%s.dat' using %d title '%s'", filename, i, curChan->
name);
145 fprintf(fcmd,
", '' using %d title '%s'", i, curChan->
name);
151 fprintf(fcmd,
"!!\n");
156 snprintf(buf, BUFSIZE,
"telemetry/%s.dat", filename);
162 fprintf(fout,
"time");
163 if (curChan != NULL) {
165 curChan = curChan->
next;
166 fprintf(fout,
" %s", curChan->
name);
184 fprintf(fout,
"%f ", time);
187 if (curChan != NULL) {
189 curChan = curChan->
next;
190 fprintf(fout,
"%f ", curChan->
scale * (*curChan->
val));
200 const int BUFSIZE = 256;
208 GfOut(
"Telemetry: stop monitoring\n");
Scalar max(Scalar x, Scalar y)
void TlmStopMonitoring(void)
void TlmInit(tdble ymin, tdble ymax)
float tdble
Floating point type used in TORCS.
void TlmNewChannel(const char *name, tdble *var, tdble min, tdble max)
The Gaming Framework API.
void TlmStartMonitoring(const char *filename)
void TlmUpdate(double time)
Scalar min(Scalar x, Scalar y)