Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00034
00035
00036
00037
00038 #include "kobuki_dock_drive/dock_drive.hpp"
00039
00040 namespace kobuki {
00041
00042
00043
00044
00045
00046
00047
00048 void DockDrive::generateDebugMessage(const std::vector<unsigned char>& signal_filt, const unsigned char &bumper, const unsigned char &charger, const ecl::LegacyPose2D<double>& pose_update, const std::string& debug_str)
00049 {
00050
00051 std::ostringstream debug_stream;
00052
00053 std::string far_signal = "[F: ";
00054 std::string near_signal = "[N: ";
00055 for (unsigned int i=0; i<3; i++) {
00056 if (signal_filt[2-i]&DockStationIRState::FAR_LEFT ) far_signal += "L"; else far_signal += "-";
00057 if (signal_filt[2-i]&DockStationIRState::FAR_CENTER ) far_signal += "C"; else far_signal += "-";
00058 if (signal_filt[2-i]&DockStationIRState::FAR_RIGHT ) far_signal += "R"; else far_signal += "-";
00059 if (signal_filt[2-i]&DockStationIRState::NEAR_LEFT ) near_signal += "L"; else near_signal += "-";
00060 if (signal_filt[2-i]&DockStationIRState::NEAR_CENTER) near_signal += "C"; else near_signal += "-";
00061 if (signal_filt[2-i]&DockStationIRState::NEAR_RIGHT ) near_signal += "R"; else near_signal += "-";
00062 far_signal += " ";
00063 near_signal += " ";
00064 }
00065 far_signal += "]";
00066 near_signal += "]";
00067 debug_stream << far_signal << near_signal;
00068
00069
00070 {
00071 std::string out = "[B: ";
00072 if (bumper&4) out += "L"; else out += "-";
00073 if (bumper&2) out += "C"; else out += "-";
00074 if (bumper&1) out += "R"; else out += "-";
00075 out += "]";
00076 debug_stream << out;
00077 }
00078
00079
00080 {
00081 std::ostringstream oss;
00082 oss << "[C:" << std::setw(2) << (unsigned int)charger;
00083 oss << "(";
00084 if (charger) oss << "ON"; else oss << " ";
00085 oss << ")]";
00086 debug_stream << oss.str();
00087 }
00088
00089
00090 debug_stream << "[vx: " << std::setw(7) << vx << ", wz: " << std::setw(7) << wz << "]";
00091 debug_stream << "[S: " << state_str << "]";
00092 debug_stream << "[dock_detecotr: : " << dock_detector << " ]";
00093 debug_stream << "[" << debug_str << "]";
00094
00095 debug_output = debug_stream.str();
00096
00097
00098 }
00099
00100 std::string DockDrive::binary(unsigned char number) const {
00101 std::string ret;
00102 for( unsigned int i=0;i<6; i++){
00103 if (number&1) ret = "1" + ret;
00104 else ret = "0" + ret;
00105 number = number >> 1;
00106 }
00107 return ret;
00108 }
00109
00110 }