Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "TestClass.hpp"
00009
00010 #include <ros/ros.h>
00011
00012 #include <telekyb_base/Spaces.hpp>
00013 #include <telekyb_base/TeleKyb.hpp>
00014
00015 #include <telekyb_base/Time.hpp>
00016
00017 #include <iostream>
00018
00019 #include <telekyb_base/ROS/GenericSubscriber.hpp>
00020 #include <std_msgs/Float32.h>
00021
00022 TestOptionContainer::TestOptionContainer()
00023 : OptionContainer("TestOptionContainer")
00024 {
00025 intOp1 = addOption<int>("int1","Bla bla", 10);
00026 intOp2 = addBoundsOption<int>("int2","Bla bla", 20, 50, 5, true, true);
00027 doubleOp1 = addBoundsOption<double>("double", "BlaBla", 3.5, 2.0, 10.3);
00028 Eigen::Matrix3i defaultVal = Eigen::Matrix3i::Zero();
00029 defaultVal.diagonal() = Eigen::Vector3i(1,2,3);
00030 matOp3 = addOption<Eigen::Matrix3i>("matrix","test", defaultVal, false);
00031 levelVarOption = addOption< LevelValBaseEnum< const char * >::Type >("enum23","That's an enum", LevelVal::Debug);
00032 levelOption = addOption< LevelBaseEnum::Type >("enum","That's an enum", Level::Debug, false);
00033 pos3D =
00034 addOption<telekyb::Position3D>("pos3D","test", telekyb::Position3D(), false);
00035 testQuatOption = addOption<Eigen::Quaterniond>("testQuatOption","test", Eigen::Quaterniond(), false);
00036 Eigen::Matrix<double, Eigen::Dynamic, 2> testVal(4,2);
00037 dynamicVec = addOption<Eigen::Matrix<double, Eigen::Dynamic, 2> >(
00038 "dynamicVec",
00039 "test of Dynamic Vector",
00040 testVal, false);
00041 }
00042
00043 void TestListener::optionDidChange(const telekyb::Option<int>* option) {
00044 std::cout << "Option changed! " << option->getValue() << std::endl;
00045 }
00046
00047 void TestListener::optionShouldDelete(const telekyb::Option<int>* option) {
00048 std::cout << "Option about to be deleted! " << option->getValue() << std::endl;
00049 }
00050
00051
00052
00053 int main(int argc, char* argv[])
00054 {
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 telekyb::TeleKyb::init(argc,argv, "TestClass");
00086
00087 TestListener tl;
00088
00089
00090
00091 TestOptionContainer *t = new TestOptionContainer();
00092 t->intOp1->setValue(200);
00093 std::cout << "Value: " << t->intOp1->getValue() << std::endl;
00094 std::cout << "Value: " << t->intOp2->getValue() << std::endl;
00095
00096 t->intOp2->setValue(10);
00097 t->intOp2->setValue(30);
00098 t->intOp2->setValue(50);
00099 t->intOp2->setValue(5);
00100
00101 t->intOp2->setValue(51);
00102 t->intOp2->setValue(4);
00103
00104 t->doubleOp1->setValue(7.03);
00105 t->doubleOp1->setValue(10.3);
00106 t->doubleOp1->setValue(10.4);
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 std::cout << "Dynamic Vector: " << std::endl << t->dynamicVec->getValue() << std::endl;
00117
00118
00119
00120
00121 Level testLevel = t->levelOption->getValue();
00122 ROS_INFO_STREAM("Option: " << t->levelOption->getName() << " Value: " << testLevel.str());
00123
00124
00125
00126
00127
00128
00129 std::cout << t->matOp3->getValue() << std::endl;
00130
00131 std::cout << t->pos3D->getValue() << std::endl;
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 ros::spin();
00163
00164 delete t;
00165
00166
00167
00168
00169
00170
00171
00172
00173 telekyb::TeleKyb::shutdown();
00174
00175 return 0;
00176 }