Skip to content
Snippets Groups Projects
Commit f05c1fdb authored by Tommy Persson's avatar Tommy Persson
Browse files

Work to change port if app is newly started.

parent 5fea9455
No related branches found
No related tags found
No related merge requests found
......@@ -117,11 +117,11 @@ private:
az = bytesToDouble(58);
if (recv_buffer_[0] == 'G') {
have_gyro_flag = true;
// ROS_ERROR(" GYRO: %f - %f %f %f", gtime, gx, gy, gz);
ROS_INFO(" GYRO: %f - %f %f %f", gtime, gx, gy, gz);
}
if (recv_buffer_[33] == 'A') {
have_acc_flag = true;
// ROS_ERROR("ACCELEROMETER: %f - %f %f %f", atime, ax, ay, az);
ROS_INFO("ACCELEROMETER: %f - %f %f %f", atime, ax, ay, az);
}
double ptime = 0.0;
......@@ -133,7 +133,7 @@ private:
ptime = bytesToDouble(67);
pan = bytesToDouble(75);
tilt = bytesToDouble(83);
ROS_ERROR("POSITION TIME - PAN TILT: %f - %f %f", pan, tilt);
ROS_INFO("POSITION TIME - PAN TILT: %f - %f %f", pan, tilt);
}
if (!have_gyro_flag) {
......@@ -277,17 +277,25 @@ int main(int argc, char *argv[]) {
// currently fixed rate out so set div to 0
gyro_div = 0;
accel_div = 0;
gyro_div = 1;
accel_div = 1;
std::ostringstream os;
std::ostringstream osstop;
osstop << "http://" << camera_ip << "/local/motionloggerudp/control.cgi?cmd=stop";
os << "http://" << camera_ip
<< "/local/motionloggerudp/control.cgi?cmd=start&target_ip=" << driver_ip
<< "&target_port=" << port
<< "&accel_enabled=1&accel_rate_div=" << accel_div << "&gyro_enabled=1&gyro_rate_div=" << gyro_div << "&pos_enabled=1";
<< "&accel_enabled=1&accel_rate_div=" << accel_div << "&gyro_enabled=1&gyro_rate_div=" << gyro_div << "&pos_enabled=1"
;
std::string stopurl = osstop.str();
std::string url = os.str();
// ROS_INFO("STOPCOMMAND URL: %s", stopurl.c_str());
ROS_INFO("COMMAND URL: %s", url.c_str());
CURL *curl;
......@@ -313,7 +321,18 @@ int main(int argc, char *argv[]) {
} else {
ROS_INFO("Curl call succeeded");
}
#if 0
sleep(3);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
/* Check for errors */
if(res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
} else {
ROS_INFO("Curl call succeeded");
}
#endif
/* always cleanup */
curl_easy_cleanup(curl);
} else {
......@@ -330,6 +349,8 @@ int main(int argc, char *argv[]) {
ROS_INFO("runUDPServer");
//runUDPServer(port);
runUDPServer(port);
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment