49 n.param(
"loop_rate", rate, 100);
71 if(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_FIRE])
73 if( msg->color_leds[ h4r_x52_joyext::x52_led_color::LED_FIRE ] >2)
74 ROS_WARN(
"WRONG VALUE (%i) FOR LED FOUND! Value must be in the range of 0-2",msg->color_leds[h4r_x52_joyext::x52_led_color::LED_FIRE]);
75 LED[0]=(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_FIRE]>1);
79 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_A] ,&
LED[X52PRO_LED_ARED-1] ,&
LED[X52PRO_LED_AGREEN-1] ,&
updateLED[1]);
80 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_B] ,&
LED[X52PRO_LED_BRED-1] ,&
LED[X52PRO_LED_BGREEN-1] ,&
updateLED[2]);
81 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_D] ,&
LED[X52PRO_LED_DRED-1] ,&
LED[X52PRO_LED_DGREEN-1] ,&
updateLED[3]);
82 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_E] ,&
LED[X52PRO_LED_ERED-1] ,&
LED[X52PRO_LED_EGREEN-1] ,&
updateLED[4]);
83 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_T12] ,&
LED[X52PRO_LED_T1RED-1],&
LED[X52PRO_LED_T1GREEN-1],&
updateLED[5]);
84 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_T34] ,&
LED[X52PRO_LED_T2RED-1],&
LED[X52PRO_LED_T2GREEN-1],&
updateLED[6]);
85 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_T56] ,&
LED[X52PRO_LED_T3RED-1],&
LED[X52PRO_LED_T3GREEN-1],&
updateLED[7]);
86 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_POV2],&
LED[X52PRO_LED_CORED-1],&
LED[X52PRO_LED_COGREEN-1],&
updateLED[8]);
87 setLEDs(msg->color_leds[h4r_x52_joyext::x52_led_color::LED_I] ,&
LED[X52PRO_LED_IRED-1] ,&
LED[X52PRO_LED_IGREEN-1] ,&
updateLED[9]);
92 int curPos=msg->pos+16*msg->line;
102 for (std::string::const_iterator it=msg->data.begin(); it != msg->data.end(); ++it)
108 uint8_t curLine=curPos/16;
109 uint8_t posInLine=curPos-curLine*16;
113 for (curPos = 0; curPos < (curLine+1)*16; ++curPos)
115 posInLine=curPos-curLine*16;
129 ROS_WARN(
"MFD text exceeds display bounds!");
140 Date[2]=msg->date_field_left;
141 Date[1]=msg->date_field_center;
142 Date[0]=msg->date_field_right;
152 Time[0]=msg->time_hours;
153 Time[1]=msg->time_minutes;
156 if(msg->set_offset_0)
164 if(msg->set_offset_1)
186 #define SLEEP_AFTER_COMMAND usleep(5000)
192 while(hdl==0 && ros::ok())
194 ROS_INFO(
"Trying to find joystick...");
198 ROS_INFO(
"Joystick found...");
207 for (
int lednum = 0; lednum < 10; ++lednum)
211 ROS_DEBUG(
"Setting LED: %i",lednum);
215 x52_setled(hdl,led,
LED[led-1]);
216 x52_setled(hdl,led+1,
LED[led]);
220 x52_setled(hdl,1,
LED[0]);
245 for (
int line = 0; line < 3; ++line)
272 for (
int o = 0; o < 2; ++ o)
ros::Subscriber subbrightnessLED
ros::Subscriber submfd_text
void cb_brighnessMFD(const std_msgs::UInt8ConstPtr &msg)
std::string mfd_content[3]
#define SLEEP_AFTER_COMMAND
void cb_brighnessLED(const std_msgs::UInt8ConstPtr &msg)
X52_JoyExt(ros::NodeHandle &n)
void setLEDs(uint8_t inValue, uint8_t *red, uint8_t *green, bool *update)
void cb_mfd_text(const h4r_x52_joyext::x52_mfdConstPtr &msg)
void cb_date(const h4r_x52_joyext::x52_dateConstPtr &msg)
void cb_leds(const h4r_x52_joyext::x52_led_colorConstPtr &msg)
void cb_time(const h4r_x52_joyext::x52_timeConstPtr &msg)
ros::Subscriber subbrightnessMFD