5 #include <boost/thread/thread.hpp>
9 using namespace mujinclient;
11 int main(
int argc,
char ** argv)
14 std::cout <<
"need username:password. Example: mujinclienttest myuser:mypass [url]\n\nurl - [optional] For example https://controller.mujin.co.jp/" << std::endl;
24 else if( argc == 3 ) {
30 std::cout <<
"connected to controller v" << controller->GetVersion() << std::endl;
31 std::string sceneuri =
"mujin:/irex2013.mujin.dae";
32 std::string scenepk = controller->GetScenePrimaryKeyFromURI_UTF8(sceneuri);
34 std::string robotname =
"VP-5243I";
36 std::vector<SceneResource::InstObjectPtr> instobjects;
38 std::cout <<
"scenename: " << scene->Get(
"name") << std::endl;
43 scene->GetInstObjects(instobjects);
44 int robotinstindex = -1;
45 for(
size_t i = 0; i < instobjects.size(); ++i) {
48 if (instobjects[i]->name == robotname)
53 if (robotinstindex == -1) {
54 std::cout <<
"no such kind of robot: " << robotname << std::endl;
57 std::cout <<
"links: " << std::endl;
58 for (
size_t i = 0; i < instobjects[robotinstindex]->links.size(); i++) {
59 std::cout <<
"\tname: " << instobjects[robotinstindex]->links[i].name << std::endl;
60 std::cout <<
"\tquaternion: ";
61 for (
int j = 0; j < 4; j++) {
62 std::cout << instobjects[robotinstindex]->links[i].quaternion[j] <<
", ";
64 std::cout << std::endl;
65 std::cout <<
"\ttranslate: ";
66 for (
int j = 0; j < 3; j++) {
67 std::cout << instobjects[robotinstindex]->links[i].translate[j] <<
", ";
69 std::cout << std::endl;
72 std::cout <<
"instobjects[robotinstindex]->tools: " << std::endl;
73 for (
size_t i = 0; i < instobjects[robotinstindex]->tools.size(); i++) {
74 std::cout <<
"tool" << i << std::endl;
75 std::cout <<
"\tname: " << instobjects[robotinstindex]->tools[i].name << std::endl;
77 std::cout <<
"\tquaternion: ";
78 for (
int j = 0; j < 4; j++) {
79 std::cout << instobjects[robotinstindex]->tools[i].quaternion[j] <<
", ";
81 std::cout << std::endl;
83 std::cout <<
"\ttranslate: ";
84 for (
int j = 0; j < 3; j++) {
85 std::cout << instobjects[robotinstindex]->tools[i].translate[j] <<
", ";
87 std::cout << std::endl;
89 std::cout <<
"\tdirection: ";
90 for (
int j = 0; j < 3; j++) {
91 std::cout << instobjects[robotinstindex]->tools[i].direction[j] <<
", ";
93 std::cout << std::endl;