2月25日

Dependencies:   uw_28015 mbed ros_lib_kinetic move4wheel2 EC CruizCore_R6093U CruizCore_R1370P

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "EC.h"
00002 #include "R1370P.h"
00003 #include "move4wheel.h"
00004 #include "mbed.h"
00005 #include "math.h"
00006 #include "PathFollowing.h"
00007 #include "movement.h"
00008 #include "manual.h"
00009 #include "can.h"
00010 
00011 #include <ros.h>
00012 #include <geometry_msgs/Point.h>
00013 #include <geometry_msgs/Pose.h>
00014 
00015 ros::NodeHandle nh;
00016 geometry_msgs::Point posi_xyr;
00017 geometry_msgs::Quaternion usw_4info;
00018 
00019 ros::Publisher pub_xyr("/mbed_main1",&posi_xyr);
00020 ros::Publisher pub_usw("/mbed_main2",&usw_4info);
00021 
00022 Ticker cm_pc;
00023 #define PI 3.141592
00024 
00025 void cm_to_pc(){
00026     
00027     copy_xyr_usw();
00028     
00029     posi_xyr.x = info_x;
00030     posi_xyr.y = info_y;
00031     posi_xyr.z = info_r;
00032     
00033     usw_4info.x = usw_data1;
00034     usw_4info.y = usw_data2;
00035     usw_4info.z = usw_data3;
00036     usw_4info.w = usw_data4;
00037     
00038     pub_xyr.publish(&posi_xyr);
00039     pub_usw.publish(&usw_4info);
00040 }
00041 
00042 
00043 //-----mbed led------------------//点灯条件-----------------------//参照場所------------------------------//
00044 //DigitalOut cansend_led(LED1);  //cansend -> on                //can.cpp
00045 //DigitalOut canread_led(LED2);  //canread -> on                //can.cpp
00046 //DigitalOut debug_led(LED3);    //maxon debug programme -> on  //maxonsetting.cpp
00047 
00048 //////////////////////////////////////////////////////////////以下main文/////////////////////////////////////////////////////////////////
00049 
00050 int main()
00051 {
00052     nh.getHardware()->setBaud(115200);
00053     nh.initNode();
00054     nh.advertise(pub_xyr);
00055     nh.advertise(pub_usw);
00056     
00057     cm_pc.attach(&cm_to_pc,0.01);
00058 
00059     UserLoopSetting_sensor();
00060     
00061     while(1) {
00062 
00063         nh.spinOnce();
00064         wait(0.01);
00065 
00066     }
00067 
00068 }