Contents

Rock, Paper, Scissors Commander for KIST

There are two EXEs to command the Home, Rock, Paper and Scissors positions for the Allegro Hand via TCP/IP connection to the AHAS controller
This controller is KIST specific.

To execute these motions, the following integer TCP/IP messages are sent:

01: Ready
10: Rock
11: Paper
12: Scissors

Message

Message ID Data Size Reserved Flag Checksum Data
2 bytes 2 bytes 2 bytes 1 byte 1 byte 4 bytes
1 4 0 0 0 int: 1, 10, 11, 12


Header

8 bytes total

  • Message ID: 1 (2 bytes)
  • Data Size: 4 (2 bytes)
  • Reserved: 0 (2 bytes)
  • Flag: 0 (1 byte)
  • Checksum: 0 (1 byte)

Data

  • Integer: 1, 10, 11 or 12 (4 bytes)


Port

6150

Sampling Time

1000Hz, 1000us



MATLAB Sys Cmd

File:MATLAB callEXE.zip

TCP/IP Comm. Programs

Input:
0: Ready
1: Rock
2: Paper
3: Scissors

Keyboard Input

tcpip_sendMessage.cpp

// kaiTest.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#ifdef WIN32
#include "kai/kai.h"
#else
#include "kai/kai.h"
#endif
#include <stdio.h>
#ifdef WIN32
#include <conio.h>
#endif
#include <string>
#include <iostream>
 
using namespace std;
 
#include <queue>
bool bTCP = true;
unsigned int hExtension = -1;
 
 
 
// rProtocol
#ifdef WIN32
//#include "../../../RoboticsLab/RoboticsLab/dev/include/rProtocol/rProtocol.h"
#else
//#include "../../../RoboticsLab/include/rProtocol/rProtocol.h"
#endif
 
 
/* notice
////////////////////////////////////
1. Set include path : In the place that there is a Kai header file.
ex) #include "kai.h"
2. Create a Class instance
ex) mySocket sock;
3. Define kaiMsg
ex) kaiMsg msg;
 
start!
////////////////////////////////////
*/
 
class mySocket : public kaiSocket
{
public:
	mySocket(){}
	~mySocket(){}
 
protected:
	virtual void onMessage(kaiMsg& msg)
	{	
		printf("msg id:%d, msg size:%d\n", msg.id(), msg.size());
	}
 
	virtual void onSend(int len)
	{
		printf("send message: %d\n", len);
	}
};
 
 
int main(int argc, char* argv[])
{		
	bool bRun = true;
	mySocket sock;
	kaiMsgID id = 0;
	kaiMsg msg;
	msg.allocateMemory();
 
	int cmd = -1;
 
	//if(argc!=2)
	//{
	//	printf("ERROR: You must input just one integer argument\n0: Ready\n1: Rock\n2: Paper\n3: Scissors\n\n");
	//	_getch();
	//	return 0;
	//}
 
	////parse input
	//std::string s = argv[1];
	//sscanf(s.c_str(), "%i", &cmd); //i is 10 after this
	//printf("%i",cmd);
 
 
	kaiInitialize();
 
	if(bTCP)
		sock.create(true, kaiON_MESSAGE|kaiON_SEND);
	else
		sock.create(false, kaiON_MESSAGE|kaiON_SEND);
 
	if (kaiSUCCESS == sock.connect("127.0.0.1", 6150))//sock.connect("192.168.1.98", 5150);
	{
		sock.setBlockingMode(kaiNON_BLOCKING_SOCKET);
	}
	else
	{
		printf("[ERROR] failed to connect to the server application.\n");
		bRun = false;
	}
 
	while (bRun)
	{
		if(bTCP && sock.isValid())
		{
			if (kaiFAIL == sock.recv())
			{
				printf("[ERROR] connection was closed.\n");
				break;
			}
		}
 
		{
 
			int cmd = -1;
			if (_kbhit())
				cmd = _getch();
 
			switch (cmd)
			{
			case '0':
				{
					kaiMsg msg; // define kaiMsg
					msg.allocateMemory(); 
					msg.reset();
					msg.begin();
					//int armID;
					//armID = 1;
 
					int motion = 1;
 
					// msg << is send stream
					msg << motion;//argv[1]; 
					cout << "\n" << motion;
					msg.id(1); // set the msg's id (message packet ID)
					msg.end(); // end message
					sock.send(msg); // Instance send msg
 
					std::cout<<"Ready\n"<<std::endl;
				}
				break;
			case '1':
				{
					kaiMsg msg; // define kaiMsg
					msg.allocateMemory(); 
					msg.reset();
					msg.begin();
					//int armID;
					//armID = 1;
 
					int motion = 10;
 
					// msg << is send stream
					msg << motion; 
					cout << "\n" << motion;
					msg.id(1); // set the msg's id (message packet ID)
					msg.end(); // end message
					sock.send(msg); // Instance send msg
 
					std::cout<<"Rock\n"<<std::endl;
				}
				break;
			case '2':
				{
					kaiMsg msg; // define kaiMsg
					msg.allocateMemory(); 
					msg.reset();
					msg.begin();
					//int armID;
					//armID = 1;
 
					int motion = 11;
 
					// msg << is send stream
					msg << motion;//argv[1]; 
					cout << "\n" << motion;
					msg.id(1); // set the msg's id (message packet ID)
					msg.end(); // end message
					sock.send(msg); // Instance send msg
 
					std::cout<<"Paper\n"<<std::endl;
				}
				break;
			case '3':
				{
					kaiMsg msg; // define kaiMsg
					msg.allocateMemory(); 
					msg.reset();
					msg.begin();
					//int armID;
					//armID = 1;
 
					int motion = 12;
 
					// msg << is send stream
					msg << motion;//argv[1]; 
					cout << "\n" << motion;
					msg.id(1); // set the msg's id (message packet ID)
					msg.end(); // end message
					sock.send(msg); // Instance send msg
 
					std::cout<<"Scissor\n"<<std::endl;
				}
				break;
			case 'q':
				sock.close();
				bRun = false;
				break;
				//default:
 
			}
		}
	}
 
 
	printf("Press Enter to quit.\n");
	getchar();
	return 0;
}


Command Argument

tcpip_sendMessage.cpp

// kaiTest.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#ifdef WIN32
#include "kai/kai.h"
#else
#include "kai/kai.h"
#endif
#include <stdio.h>
#ifdef WIN32
#include <conio.h>
#endif
#include <string>
#include <iostream>
 
using namespace std;
 
#include <queue>
bool bTCP = true;
unsigned int hExtension = -1;
 
 
 
// rProtocol
#ifdef WIN32
//#include "../../../RoboticsLab/RoboticsLab/dev/include/rProtocol/rProtocol.h"
#else
//#include "../../../RoboticsLab/include/rProtocol/rProtocol.h"
#endif
 
 
/* notice
////////////////////////////////////
1. Set include path : In the place that there is a Kai header file.
ex) #include "kai.h"
2. Create a Class instance
ex) mySocket sock;
3. Define kaiMsg
ex) kaiMsg msg;
 
start!
////////////////////////////////////
*/
 
class mySocket : public kaiSocket
{
public:
	mySocket(){}
	~mySocket(){}
 
protected:
	virtual void onMessage(kaiMsg& msg)
	{	
		printf("msg id:%d, msg size:%d\n", msg.id(), msg.size());
	}
 
	virtual void onSend(int len)
	{
		printf("send message: %d\n", len);
	}
};
 
 
int main(int argc, char* argv[])
{		
	bool bRun = true;
	mySocket sock;
	kaiMsgID id = 0;
	kaiMsg msg;
	msg.allocateMemory();
 
	int cmd = -1;
 
	if(argc!=2)
	{
		printf("ERROR: You must input just one integer argument\n0: Ready\n1: Rock\n2: Paper\n3: Scissors\n\n");
		_getch();
		return 0;
	}
 
	//parse input
	std::string s = argv[1];
	sscanf(s.c_str(), "%i", &cmd); //i is 10 after this
	printf("%i",cmd);
 
 
	kaiInitialize();
 
	if(bTCP)
		sock.create(true, kaiON_MESSAGE|kaiON_SEND);
	else
		sock.create(false, kaiON_MESSAGE|kaiON_SEND);
 
	if (kaiSUCCESS == sock.connect("127.0.0.1", 6150))//sock.connect("192.168.1.98", 5150);
	{
		sock.setBlockingMode(kaiNON_BLOCKING_SOCKET);
	}
	else
	{
		printf("[ERROR] failed to connect to the server application.\n");
		bRun = false;
	}
 
	//while (bRun)
	//{
		//if(bTCP && sock.isValid())
		//{
		//	if (kaiFAIL == sock.recv())
		//	{
		//		printf("[ERROR] connection was closed.\n");
		//		getchar();
		//		return 0;
		//	}
		//}
 
		{
 
			//int cmd = -1;
			//if (_kbhit())
			//	cmd = _getch();
 
			switch (cmd)
			{
			case 0:
				{
					kaiMsg msg; // define kaiMsg
					msg.allocateMemory(); 
					msg.reset();
					msg.begin();
					//int armID;
					//armID = 1;
 
					int motion = 1;
 
					// msg << is send stream
					msg << motion;//argv[1]; 
					cout << "\n" << motion;
					msg.id(1); // set the msg's id (message packet ID)
					msg.end(); // end message
					sock.send(msg); // Instance send msg
 
					std::cout<<"Ready\n"<<std::endl;
				}
				break;
			case 1:
				{
					kaiMsg msg; // define kaiMsg
					msg.allocateMemory(); 
					msg.reset();
					msg.begin();
					//int armID;
					//armID = 1;
 
					int motion = 10;
 
					// msg << is send stream
					msg << motion; 
					cout << "\n" << motion;
					msg.id(1); // set the msg's id (message packet ID)
					msg.end(); // end message
					sock.send(msg); // Instance send msg
 
					std::cout<<"Rock\n"<<std::endl;
				}
				break;
			case 2:
				{
					kaiMsg msg; // define kaiMsg
					msg.allocateMemory(); 
					msg.reset();
					msg.begin();
					//int armID;
					//armID = 1;
 
					int motion = 11;
 
					// msg << is send stream
					msg << motion;//argv[1]; 
					cout << "\n" << motion;
					msg.id(1); // set the msg's id (message packet ID)
					msg.end(); // end message
					sock.send(msg); // Instance send msg
 
					std::cout<<"Paper\n"<<std::endl;
				}
				break;
			case 3:
				{
					kaiMsg msg; // define kaiMsg
					msg.allocateMemory(); 
					msg.reset();
					msg.begin();
					//int armID;
					//armID = 1;
 
					int motion = 12;
 
					// msg << is send stream
					msg << motion;//argv[1]; 
					cout << "\n" << motion;
					msg.id(1); // set the msg's id (message packet ID)
					msg.end(); // end message
					sock.send(msg); // Instance send msg
 
					std::cout<<"Scissor\n"<<std::endl;
				}
				break;
			case 'q':
				sock.close();
				bRun = false;
				break;
			//default:
 
			}
		}
	//}
 
 
	printf("Press Enter to quit.\n");
	//getchar();
	return 0;
}

Note: Shift-Right-click folder to start command prompt at that path.

Source




AHAS Installer


RPS Controller Patch

IMPORTANT: Please download this file and move it to your Allegro Hand Application Studio controls directory.

Program Files (x86)\SimLab\Allegro Hand Application Studio\bin\controls

Use this new controller file to overwrite the original located in the controls folder.



Device Offsets / Directions Patch

IMPORTANT: Please download this file and overwrite your Allegro Hand Application Studio devices directory.

Program Files (x86)\SimLab\Allegro Hand Application Studio\bin\models\Etc\ERHand\devices




Debug






avatar

Anonymous user #1

214 days ago
Score 0+

Staggering article. I am so stunned. I think you have a mind blowing data especially while dealings with such subjects. Appreciation for your vehicle; wild style. An overflow of thanks sharing your article. http://www.e...bout-us.html http://www.e...cations.html http://www.e...ervices.html http://www.e...gallery.html

http://www.e...aziabad.html
avatar

Anonymous user #1

214 days ago
Score 0+

You will not really perceive how quickly she makes on you and gives you her person to the evening. http://www.r...service.html http://www.r...service.html http://www.r...service.html http://www.r...service.html

http://www.r...service.html
avatar

Anonymous user #3

207 days ago
Score 0+

Appreciation for the inconceivable post you posted. I like how you portray the remarkable substance. The centers you raise are affirmed and reasonable.

http://www.i...escorts.com/ http://www.i...m/about.html http://www.i...gallery.html http://www.i...m/links.html

http://www.i...contact.html
avatar

Anonymous user #4

200 days ago
Score 0+

Your article is remarkably helpful for me. I need to recognize that you will continue to make such exceptional articles also.


http://www.e...l-girls.html http://www.e...l-girls.html http://www.e...l-girls.html http://www.e...l-girls.html

http://www.e...l-girls.html
avatar

Anonymous user #6

191 days ago
Score 0+
Plan of your site so decision I right now bookmarked https://www.sanakhan.in/ these affiliations in light of confirmed for sharing it.
avatar

Anonymous user #7

186 days ago
Score 0+

The game plan of your site is so noteworthy I right now bookmarked these relationship thinking about the bosses for sharing them.


https://bres...in-Ghaziabad https://back...tails/246175 https://www....in-Ghaziabad https://comm...posts/149532 https://coro...ervices.html https://joyr...in-Ghaziabad https://justpaste.it/7xmt4 https://dege...s/view/93592 https://roll...-Model-Girls https://kaal...-blog/140804 https://www....ll-bookmarks https://trac...elblog/13159 https://www....us-Customers https://www....in-ghaziabad http://finac...ervices.html https://betd...52584070d9cc https://chop...s/post/19046 https://www....s/post/16338 https://www....sian-escorts https://comm...service.html https://www....rent-people/ https://mid-...iabad-776693 https://www....-city-612165 https://www....he-most.html https://talk...ervices.html


https://bres...in-Ghaziabad https://back...tails/246412 https://www....LS-AVAILABLE https://comm...INI-AGGARWAL https://coro...-blog/140921 https://joyr...ked-Pleasure https://justpaste.it/68ht6 https://dege...cs/view/7779 https://roll...r-Mind-Fresh https://kaal...-blog/142068 https://trac...elblog/13306 https://www....In-Ghaziabad https://www....rts-services http://finac...aziabad.html https://betd...47d1bf73620e https://chop...s/post/19080 https://www....s/post/16388 https://www....abad-Escorts https://comm...d-blog/61069 https://www....n-ghaziabad/ https://kath...iabad-776741 https://www....iabad-613515 https://www....aziabad.html https://talk...l-girls.html

https://flag...e-rates.html
avatar

Anonymous user #8

94 days ago
Score 0+
We have https://syed...ne-for-kids/ clear concepts of self-accountability and human rights. Access Shia Islamic Studies online course sitting anywhere.
avatar

Anonymous user #9

71 days ago
Score 0+

<a href="https://google.com">google</a> --- BBCODE --- [URL=https://google.com]google[/URL] [url=https://google.com]google[/url] --- RARE --- [link=https://google.com]google[/link] [link name=google]https://google.com[/link] ((https://google.com)) ((https://google.com google)) google [google] [L=google]https://google.com[/L] "google":https://google.com

[google](https://google.com)
Add your comment
Allegro Hand welcomes all comments. If you do not want to be anonymous, register or log in. It is free.




Copyright & Trademark Notice
Allegro, the Allegro logo, RoboticsLab, the RoboticsLab logo, and all related files and documentation are Copyright ⓒ 2008-2020 Wonik Robotics Co., Ltd. All rights reserved. RoboticsLab and Allegro are trademarks of Wonik Robotics. All other trademarks or registered trademarks mentioned are the properties of their respective owners.

Wonik Robotics's Allegro Hand is based on licensed technology developed by the Humanoid Robot Hand research group at the Korea Institute of Industrial Technology (KITECH).

Any references to the BHand Library or the Allegro Hand Motion and/or Grasping Library refer to a library of humanoid robotic hand grasping algorithms and motions developed and published by KITECH researchers.
J.-H. Bae, S.-W. Park, D. Kim, M.-H. Baeg, and S.-R. Oh, "A Grasp Strategy with the Geometric Centroid of a Groped Object Shape Derived from Contact Spots," Proc. of the 2012 IEEE Int. Conf. on Robotics and Automation (ICRA2012), pp. 3798-3804

Wiki maintained by Sean Yi <seanyi@wonikrobotics.com>

KitechLogo.jpg Wonikrobotics logo.png





Whos here now:   Members 0   Guests 1   Bots & Crawlers 0