Go to the documentation of this file.00001 #include <ros/ros.h>
00002 #include <string.h>
00003 #include <stdio.h>
00004 #include <math.h>
00005 #include <stdlib.h>
00006 #include <Ivy/ivy.h>
00007 #include <Ivy/ivyloop.h>
00008 #include <Ivy/timer.h>
00009
00010 #define MILLISEC 1000.0
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 int ac_id, period;
00022
00023 void SettingCallback (TimerId id, void *user_data, unsigned long delta)
00024 {
00025 IvySendMsg ("ground_dl SETTING 0 %d 0",ac_id);
00026 IvySendMsg ("ground_dl SETTING 1 %d 3",ac_id);
00027 IvySendMsg ("ground_dl SETTING 2 %d 3",ac_id);
00028 IvySendMsg ("ground_dl SETTING 65 %d 0",ac_id);
00029
00030 if (!ros::ok()) {
00031 IvyStop();
00032 exit(0);
00033 }
00034 }
00035
00036 int main(int argc, char **argv)
00037 {
00038
00039 ros::init(argc, argv, "telemetry_settings");
00040 ros::NodeHandle nh("~");
00041
00042
00043 if (!nh.getParam("ac_id", ac_id))
00044 {
00045 ROS_FATAL("Failed to get param 'AC_ID'");
00046 exit(0);
00047 }
00048 nh.param("period", period, 1);
00049
00050
00051 IvyInit ("telemetry_settings", "'Telemetry Settings' is READY!", 0, 0, 0, 0);
00052 TimerRepeatAfter (TIMER_LOOP, period*MILLISEC, SettingCallback, 0);
00053 IvyStart("127.255.255.255");
00054 IvyMainLoop();
00055 return 0;
00056 }