curl_easy_setopt(curl, CURLOPT_URL, (url + (boost::format("/rev.cgi?Cmd=nav&action=18&drive=%d&speed=%d") % dValue % sValue).str()).c_str());
curl_easy_setopt(curl, CURLOPT_URL, (url + "/Jpeg/CamImg.jpg").c_str());
curl_easy_setopt(curl, CURLOPT_URL, (url + "/rev.cgi?Cmd=nav&action=20").c_str());
rvManualDrive rovioParser::manualDrive(int dValue, int sValue)
{
rvManualDrive rv;
string resp;
curl_easy_setopt(curl, CURLOPT_URL, (url + (boost::format("/rev.cgi?Cmd=nav&action=18&drive=%d&speed=%d") % dValue % sValue).str()).c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resp);
curl_easy_perform(curl);
boost::regex expression("Cmd = (\\w+).*\\n*.*responses = (\\d+)");
boost::smatch what;
boost::regex_search(resp, what, expression);
rv.cmd = what[1];
rv.responses = boost::lexical_cast<int>(what[2]);
return rv;
}
cv::Mat rovioParser::getImg()
{
FILE *fp;
fp = fopen("temp.jpg", "w");
curl_easy_setopt(curl, CURLOPT_URL, (url + "/Jpeg/CamImg.jpg").c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_perform(curl);
fclose(fp);
return cv::imread("temp.jpg");
}
Other – GetAudio.cgi
Description
Send audio to server and playback at server side
Grammar
/GetAudio.cgi
Input Parameter
None
Privilege
None
Remark
The data flow is from client to IPCam, which is different from GetData.cgi.
The audio data must be send with HTTP POST method.
Audio format: 16bit PCM, 8000Hz
Movement Control – ManualDrive()
Description
Accepts manual driving commands.
Grammar
/rev.cgi?Cmd=nav&action=value&drive=d_value&speed=s_value
Input Parameter
value = 18
d_value = 0 (Stop)
1 (Forward)
2 (Backward)
3 (Straight left)
4 (Straight right)
5 (Rotate left by speed)
6 (Rotate right by speed)
7 (Diagonal forward left)
8 (Diagonal forward right)
9 (Diagonal backward left)
10 (Diagonal backward right)
11 (Head up)
12 (Head down)
13 (Head middle)
14 (Reserved)
15 (Reserved)
16 (Reserved)
17 (Rotate left by 20 degree angle increments)
18 (Rotate right by 20 degree angle increments)
s_value = 1 (fastest) – 10 (slowest)
Privilege
None
Return Value
response (Please refer to “Response Code Commands Table”)
curl_easy_setopt(curl, CURLOPT_URL, (url + "/Jpeg/CamImg.jpg").c_str());
curl_easy_setopt(curl, CURLOPT_URL, (url + "/rev.cgi?Cmd=nav&action=20").c_str());
rvManualDrive rovioParser::manualDrive(int dValue, int sValue)
{
rvManualDrive rv;
string resp;
curl_easy_setopt(curl, CURLOPT_URL, (url + (boost::format("/rev.cgi?Cmd=nav&action=18&drive=%d&speed=%d") % dValue % sValue).str()).c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resp);
curl_easy_perform(curl);
boost::regex expression("Cmd = (\\w+).*\\n*.*responses = (\\d+)");
boost::smatch what;
boost::regex_search(resp, what, expression);
rv.cmd = what[1];
rv.responses = boost::lexical_cast<int>(what[2]);
return rv;
}
cv::Mat rovioParser::getImg()
{
FILE *fp;
fp = fopen("temp.jpg", "w");
curl_easy_setopt(curl, CURLOPT_URL, (url + "/Jpeg/CamImg.jpg").c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_perform(curl);
fclose(fp);
return cv::imread("temp.jpg");
}
Other – GetAudio.cgi
Description
Send audio to server and playback at server side
Grammar
/GetAudio.cgi
Input Parameter
None
Privilege
None
Remark
The data flow is from client to IPCam, which is different from GetData.cgi.
The audio data must be send with HTTP POST method.
Audio format: 16bit PCM, 8000Hz
Movement Control – ManualDrive()
Description
Accepts manual driving commands.
Grammar
/rev.cgi?Cmd=nav&action=value&drive=d_value&speed=s_value
Input Parameter
value = 18
d_value = 0 (Stop)
1 (Forward)
2 (Backward)
3 (Straight left)
4 (Straight right)
5 (Rotate left by speed)
6 (Rotate right by speed)
7 (Diagonal forward left)
8 (Diagonal forward right)
9 (Diagonal backward left)
10 (Diagonal backward right)
11 (Head up)
12 (Head down)
13 (Head middle)
14 (Reserved)
15 (Reserved)
16 (Reserved)
17 (Rotate left by 20 degree angle increments)
18 (Rotate right by 20 degree angle increments)
s_value = 1 (fastest) – 10 (slowest)
Privilege
None
Return Value
response (Please refer to “Response Code Commands Table”)