From b46edfb591e5d7110679a6188342b6b14e9412cd Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Tue, 1 Aug 2023 13:04:38 +0000 Subject: [PATCH] tried to fix samples/tests compilation --- samples/CMakeLists.txt | 16 ++++++++-------- samples/mujinbinpickingtask.cpp | 2 +- samples/mujinexecutetask.cpp | 9 +++------ samples/mujinexecutetask_fast.cpp | 9 +++------ samples/mujinexecutetask_robodia.cpp | 9 +++------ samples/mujinideal_densowave.cpp | 9 +++------ samples/mujinimportscene.cpp | 9 +++------ samples/mujinimportscene_robodia.cpp | 9 +++------ samples/mujinshowresults.cpp | 7 ++----- samples/mujinupdateenvironmentstate.cpp | 1 - test/mujintestutils.h | 7 ++----- test/settaskparameters.cpp | 7 ++----- test/showresults.cpp | 7 ++----- test/uploadregister.cpp | 9 +++------ 14 files changed, 38 insertions(+), 72 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 3413120e..8b8382e9 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -36,19 +36,19 @@ build_sample(mujindeleteallscenes) build_sample(mujindeleteallitlprograms) if (libzmq_FOUND) build_sample(mujinbinpickingtask) - build_sample(mujinjog) + # build_sample(mujinjog) build_sample(mujinupdategeometry) - build_sample(mujinmovetoollinear) + # build_sample(mujinmovetoollinear) build_sample(mujintransform) build_sample(mujinsetdofvalues) - build_sample(mujincreateikparam) - build_sample(mujingetpublishedtaskstate) + # build_sample(mujincreateikparam) + # build_sample(mujingetpublishedtaskstate) build_sample(mujingrabrelease) - build_sample(mujinpointcloud) + # build_sample(mujinpointcloud) build_sample(mujincreateinstobject) - build_sample(mujinmovetohandposition) - build_sample(mujinmoveandcancel) - build_sample(mujinplanexecute) + # build_sample(mujinmovetohandposition) + # build_sample(mujinmoveandcancel) + # build_sample(mujinplanexecute) build_sample(mujincreateitltask) build_sample(mujinlistobjects) build_sample(mujinqueryobject) diff --git a/samples/mujinbinpickingtask.cpp b/samples/mujinbinpickingtask.cpp index db3e7180..3fcc1dac 100644 --- a/samples/mujinbinpickingtask.cpp +++ b/samples/mujinbinpickingtask.cpp @@ -58,6 +58,6 @@ int main(int argc, char ** argv) binpickingzmq->Initialize("", binpickingTaskZmqPort, binpickingTaskHeartbeatPort, zmqcontext); Transform t; - binpickingzmq->GetTransform(testobjectname,t); + binpickingzmq->GetTransform(testobjectname,t,"mm"); std::cout << "testobject " << testobjectname << " pose: [" << t.quaternion[0] << ", " << t.quaternion[1] << ", " << t.quaternion[2] << ", " << t.quaternion[3] << ", " << t.translate[0] << ", " << t.translate[1] << ", " << t.translate[2] << "]"; } diff --git a/samples/mujinexecutetask.cpp b/samples/mujinexecutetask.cpp index 4a0d1359..bc6922bf 100644 --- a/samples/mujinexecutetask.cpp +++ b/samples/mujinexecutetask.cpp @@ -13,7 +13,7 @@ using namespace mujinclient; int main(int argc, char ** argv) { - if( argc < 2 ) { + if( argc < 3 ) { std::cout << "need username:password. Example: mujinclienttest myuser:mypass [url]\n\nurl - [optional] For example https://controller.mujin.co.jp/" << std::endl; return 1; } @@ -22,14 +22,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; diff --git a/samples/mujinexecutetask_fast.cpp b/samples/mujinexecutetask_fast.cpp index 03f99a1b..393194c4 100644 --- a/samples/mujinexecutetask_fast.cpp +++ b/samples/mujinexecutetask_fast.cpp @@ -13,7 +13,7 @@ using namespace mujinclient; int main(int argc, char ** argv) { - if( argc < 2 ) { + if( argc < 3 ) { std::cout << "need username:password. Example: mujinclienttest myuser:mypass [url]\n\nurl - [optional] For example https://controller.mujin.co.jp/" << std::endl; return 1; } @@ -22,14 +22,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; diff --git a/samples/mujinexecutetask_robodia.cpp b/samples/mujinexecutetask_robodia.cpp index 9aa3cfee..f593ecad 100644 --- a/samples/mujinexecutetask_robodia.cpp +++ b/samples/mujinexecutetask_robodia.cpp @@ -13,7 +13,7 @@ using namespace mujinclient; int main(int argc, char ** argv) { - if( argc < 2 ) { + if( argc < 3 ) { std::cout << "need username:password. Example: mujinclienttest myuser:mypass [url]\n\nurl - [optional] For example https://controller.mujin.co.jp/" << std::endl; return 1; } @@ -22,14 +22,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; diff --git a/samples/mujinideal_densowave.cpp b/samples/mujinideal_densowave.cpp index 5187b985..8b00b9cf 100644 --- a/samples/mujinideal_densowave.cpp +++ b/samples/mujinideal_densowave.cpp @@ -13,7 +13,7 @@ using namespace mujinclient; int main(int argc, char ** argv) { - if( argc < 2 ) { + if( argc < 3 ) { std::cout << "need username:password. Example: mujinclienttest myuser:mypass [url]\n\nurl - [optional] For example https://controller.mujin.co.jp/" << std::endl; return 1; } @@ -24,14 +24,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; diff --git a/samples/mujinimportscene.cpp b/samples/mujinimportscene.cpp index 0bf9d147..6d787f9e 100644 --- a/samples/mujinimportscene.cpp +++ b/samples/mujinimportscene.cpp @@ -11,7 +11,7 @@ using namespace mujinclient; int main(int argc, char ** argv) { - if( argc < 2 ) { + if( argc < 3 ) { std::cout << "need username:password. Example: mujinclienttest myuser:mypass [url]\n\nurl - [optional] For example https://controller.mujin.co.jp/" << std::endl; return 1; } @@ -20,14 +20,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; diff --git a/samples/mujinimportscene_robodia.cpp b/samples/mujinimportscene_robodia.cpp index f6024a4c..58ff6706 100644 --- a/samples/mujinimportscene_robodia.cpp +++ b/samples/mujinimportscene_robodia.cpp @@ -11,7 +11,7 @@ using namespace mujinclient; int main(int argc, char ** argv) { - if( argc < 2 ) { + if( argc < 3 ) { std::cout << "need username:password. Example: mujinclienttest myuser:mypass [url]\n\nurl - [optional] For example https://controller.mujin.co.jp/" << std::endl; return 1; } @@ -20,14 +20,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; diff --git a/samples/mujinshowresults.cpp b/samples/mujinshowresults.cpp index 8eef658f..b333ceb2 100644 --- a/samples/mujinshowresults.cpp +++ b/samples/mujinshowresults.cpp @@ -13,7 +13,7 @@ using namespace mujinclient; int main(int argc, char ** argv) { - if( argc < 2 ) { + if( argc < 3 ) { std::cout << "need username:password. Example: mujinclienttest myuser:mypass [url]\n\nurl - [optional] For example https://controller.mujin.co.jp/" << std::endl; return 1; } @@ -22,15 +22,12 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } else if( argc == 3 ) { controller = CreateControllerClient(argv[1], argv[2]); } - else { - controller = CreateControllerClient(argv[1]); - } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; // get all supported keys diff --git a/samples/mujinupdateenvironmentstate.cpp b/samples/mujinupdateenvironmentstate.cpp index f948e90d..6199ddb8 100644 --- a/samples/mujinupdateenvironmentstate.cpp +++ b/samples/mujinupdateenvironmentstate.cpp @@ -165,7 +165,6 @@ int main(int argc, char ** argv) } std::istringstream ss(s); while (ss) { - std::string s; if (!std::getline(ss, s, ',')) { break; } diff --git a/test/mujintestutils.h b/test/mujintestutils.h index 222a3624..c8e0ff1c 100644 --- a/test/mujintestutils.h +++ b/test/mujintestutils.h @@ -11,14 +11,11 @@ mujinclient::ControllerClientPtr CreateControllerFromCommandLine(int argc, char if( argc >= 5 ) { controller = mujinclient::CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = mujinclient::CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = mujinclient::CreateControllerClient(argv[1], argv[2]); - } else { - controller = mujinclient::CreateControllerClient(argv[1]); + controller = mujinclient::CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; return controller; diff --git a/test/settaskparameters.cpp b/test/settaskparameters.cpp index 4acd099c..2399f7f8 100644 --- a/test/settaskparameters.cpp +++ b/test/settaskparameters.cpp @@ -18,14 +18,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; diff --git a/test/showresults.cpp b/test/showresults.cpp index 2f75147f..008f3c41 100644 --- a/test/showresults.cpp +++ b/test/showresults.cpp @@ -18,14 +18,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; std::vector scenekeys; diff --git a/test/uploadregister.cpp b/test/uploadregister.cpp index 6165ef85..78bb6f50 100644 --- a/test/uploadregister.cpp +++ b/test/uploadregister.cpp @@ -12,14 +12,11 @@ int main(int argc, char ** argv) if( argc >= 5 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3], argv[4]); } - if( argc == 4 ) { + else if( argc == 4 ) { controller = CreateControllerClient(argv[1], argv[2], argv[3]); } - else if( argc == 3 ) { - controller = CreateControllerClient(argv[1], argv[2]); - } else { - controller = CreateControllerClient(argv[1]); + controller = CreateControllerClient(argv[1], argv[2]); } std::cout << "connected to controller v" << controller->GetVersion() << std::endl; @@ -35,7 +32,7 @@ int main(int argc, char ** argv) std::string desturi = "mujin:/testupload/hello.txt"; std::vector vdata(5), vtestoutputdata; vdata[0] = 'H'; vdata[1] = 'e'; vdata[2] = 'l'; vdata[3] = 'l'; vdata[4] = 'o'; - controller->UploadDataToController_UTF8(vdata,desturi); + controller->UploadDataToController_UTF8(vdata.data(),vdata.size(),desturi); controller->DownloadFileFromController_UTF8(desturi, vtestoutputdata); BOOST_ASSERT(vdata.size() == vtestoutputdata.size());