5 * @brief Display-ORTE bridge
7 * Copyright: (c) 2010 CTU Dragons
8 * CTU FEE - Department of Control Engineering
15 #include <roboorte_robottype.h>
16 //#include <pthread.h>
22 #ifdef CONFIG_DEBUG_DISPLAYD
23 /** Used to control verbosity */
29 struct sercom_data* sercom;
31 void rcv_pwr_voltage_cb (const ORTERecvInfo *info, void *vinstance,
32 void *recvCallBackParam)
34 struct robottype_orte_data *orte_data = (struct robottype_orte_data *)recvCallBackParam;
35 switch (info->status) {
37 uoled_display_voltage(&orte_data->pwr_voltage);
40 printf("ORTE deadline occurred - PWR_VOLTAGE receive\n");
45 void rcv_ref_pos_cb (const ORTERecvInfo *info, void *vinstance,
46 void *recvCallBackParam)
48 struct robottype_orte_data *orte_data = (struct robottype_orte_data *)recvCallBackParam;
49 switch (info->status) {
51 uoled_display_position(&orte_data->ref_pos);
54 printf("ORTE deadline occurred - REF_POS receive\n");
59 void rcv_est_pos_odo_cb (const ORTERecvInfo *info, void *vinstance,
60 void *recvCallBackParam)
62 struct robottype_orte_data *orte_data = (struct robottype_orte_data *)recvCallBackParam;
63 switch (info->status) {
65 uoled_display_position(&orte_data->est_pos_odo);
68 printf("ORTE deadline occurred - EST_POS_ODO receive\n");
73 int main(int argc, char *argv[])
76 //struct timeval timeout;
80 struct robottype_orte_data orte;
85 //struct can_frame frame;
86 tty = getenv("DISPLAY_TTY");
90 sercom = uoled_init(tty, NULL);
91 if (strcmp(tty, "/dev/null") != 0) {
93 printf("displayd: init serial communication OK\n");
95 printf("displayd: init serial communication failed\n");
101 /* orte initialization */
102 if(robottype_roboorte_init(&orte)) {
103 printf("Roboorte initialization failed! Exiting...\n");
107 printf("Roboorte OK\n");
109 /* creating publishers */
110 //robottype_publisher_pwr_voltage_create(&orte, NULL, NULL);
111 //robottype_publisher_motion_status_create(&orte, NULL, NULL);
112 //robottype_publisher_odo_data_create(&orte, NULL, NULL);
113 //robottype_publisher_motion_irc_create(&orte, NULL, NULL);
114 //robottype_publisher_robot_cmd_create(&orte, NULL, NULL);
115 //robottype_publisher_corr_trig_create(&orte, NULL, NULL);
116 //robottype_publisher_corr_distances_create(&orte, NULL, NULL);
117 //robottype_publisher_actuator_status_create(&orte, NULL, NULL);
118 //printf("Publishers OK\n");
120 /* creating subscribers */
121 robottype_subscriber_pwr_voltage_create(&orte, rcv_pwr_voltage_cb, &orte);
122 robottype_subscriber_est_pos_odo_create(&orte, rcv_est_pos_odo_cb, &orte);
123 robottype_subscriber_ref_pos_create(&orte, rcv_ref_pos_cb, &orte);
124 //robottype_subscriber_pwr_alert_create(&orte, rcv_pwr_alert_cb, &orte);
125 //robottype_subscriber_motion_speed_create(&orte, rcv_motion_speed_cb, &orte);
126 //robottype_subscriber_can_msg_create(&orte, rcv_can_msg_cb, &orte);
127 //robottype_subscriber_hokuyo_pitch_create(&orte, rcv_hokuyo_pitch_cb, &orte);
129 printf("subscribers created OK\n");
134 if (strcmp(tty, "/dev/null") != 0) {
136 sigwait(&sigset, &sig);
139 // spracovani serioveho portu, pri prijmu dat...