int RosPublish::publish() { if ( ros::ok() ) { trick_msgs::Num tn ; tn.first_name = "Hakeem" ; tn.last_name = "Olajuwon" ; tn.date = "March 29, 1990" ; tn.points = 18 ; tn.rebounds = 16 ; tn.blocks = 11 ; tn.assists = 10 ; std::cout << tn << std::endl ; msg_pub.publish(tn) ; ros::spinOnce() ; } else { exec_terminate(__FILE__, "ros not ok") ; } return 0 ; }
int cannon_pre_master( /* RETURN: -- Always return zero */ CANNON_AERO* C, /* INOUT: -- Parameter */ AMOEBA* A) { while ( 1 ) { switch ( A->state ) { case VERTICES: A->curr_point = A->vertices[A->curr_vertex] ; if ( A->curr_vertex == A->num_vertices ) { A->state = CALC_CENTROID_POINT ; } else { fprintf(stderr, "V[%d] ", A->curr_vertex); } A->curr_vertex++ ; break ; case CALC_CENTROID_POINT: fprintf(stderr, "CENT "); amoeba_order( A ) ; A->curr_point = A->x_cent ; A->state = CALC_REFLECTION_POINT ; break ; case CALC_REFLECTION_POINT: fprintf(stderr, "REFL "); amoeba_calc_reflection_point( A ) ; A->curr_point = A->x_refl ; A->state = REFLECT ; break ; case REFLECT: if ( amoeba_reflect( A ) ) { A->state = CALC_CENTROID_POINT ; } else { fprintf(stderr, "EXPA "); amoeba_calc_expansion_point( A ) ; A->curr_point = A->x_expa ; A->state = EXPAND ; } break ; case EXPAND: if ( amoeba_expand( A ) ) { A->state = CALC_CENTROID_POINT ; } else { fprintf(stderr, "CONT "); amoeba_calc_contraction_point( A ) ; A->curr_point = A->x_cont ; A->state = CONTRACT ; } break ; case CONTRACT: if ( amoeba_contract( A ) ) { A->state = CALC_CENTROID_POINT ; } else { A->state = SHRINK ; } break ; case SHRINK: amoeba_shrink( A ) ; fprintf(stderr, "V[0] "); A->curr_point = A->vertices[0] ; A->curr_vertex = 1 ; A->state = VERTICES ; break ; } if ( amoeba_satisfied( A ) && A->state != VERTICES ) { exec_terminate( "cannon_pre_master", "Amoeba has found a solution." ) ; } if ( A->state == CALC_CENTROID_POINT || A->state == SHRINK ) { continue ; } else { break ; } } C->time_to_fire_jet_1 = A->curr_point[0] ; C->time_to_fire_jet_2 = A->curr_point[1] ; C->time_to_fire_jet_3 = A->curr_point[2] ; C->time_to_fire_jet_4 = A->curr_point[3] ; return(0) ; }