Retrieving phase 1 nodes through remote APIs.

Typically: "How do I... ", "How can I... " questions
Post Reply
enddl22
Posts: 5
Joined: 05 May 2015, 13:05

Retrieving phase 1 nodes through remote APIs.

Post by enddl22 »

Dear, All
I am trying to obtain all possible reachable points(x,y,z) of a robotic arm (e.g., Jaco ro Baxter model) through remote APIs(MATLAB). I can visualise phase1 nodes by navigating, tools -> Calculation model properties -> Motion planning -> Compute phase1 nodes -> Visualize phase 1 nodes.
I want these nodes in MATLAB through remote APIs. Anyone attempted this? any comments would be appreciate.
Best,
I.

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Retrieving phase 1 nodes through remote APIs.

Post by coppelia »

Hello,

the phase1 nodes are simply precalculated configurations that could be reached in theory. The precalculation simply makes a relationship between joint positions and tooltip pose. Nodes that collide are also used (the calculation of the phase1 nodes doesn't do any collision detection, since this would take way too much time (imagine 5 million configurations that need to be collision-tested!).

You cannot access those phase1 nodes. But they are are computed in a very simply way:

for each joint, make it move from its low-limit to its high-limit with the given amount of steps. Do this for all joints in the mechanism. e.g., for a 2-joint mechanism, where each joint has a low limit at 0, and a high-limit at 20, with a range subdivision of 2:

Code: Select all

joint1=0
joint2=0

joint1=0
joint2=10

joint1=0
joint2=20

joint1=10
joint2=0

joint1=10
joint2=10

joint1=10
joint2=20

joint1=20
joint2=0

joint1=20
joint2=10

joint1=20
joint2=20
Cheers

enddl22
Posts: 5
Joined: 05 May 2015, 13:05

Re: Retrieving phase 1 nodes through remote APIs.

Post by enddl22 »

Thank you for reply!
I could manage this by compiling and modifying path-planning plug-in.
For anyone wants to do this, the following changes will allow you to store phase1 node into a text file.
I think this phase1 nodes are robot platform dependent and you don't need to calculate every time for the same robot.
Modifications are very simple but it took some time to explore many files.. (How awesome VREP is...)
in mpObject.cpp file from path-planning plugin

Code: Select all

char CmpObject::calculateNodes(const char* serializationData,int serializationDataSize)
{
	printf("Opening file\n");
	_fp=fopen("./phase1node.txt","w+");
       ....
       printf("Close file\n");
       fclose(_fp);

Code: Select all

void CmpObject::_prepareNodes(int loopIndex,int* loopsProgress,int* loopNeighbourStepSize,float* jointPositions,const float* jointRangesSpecial,const C7Vector& baseInverse,const CDummy3DObject* tipObject)
{
	// add the node:
	_allNodes.push_back(newNode);
	_pos[0]=newNode->tipPose.X.data[0];
	_pos[1]=newNode->tipPose.X.data[1];
	_pos[2]=newNode->tipPose.X.data[2];
	fprintf(_fp,"%f %f %f\n",_pos[0],_pos[1],_pos[2]);
appending the following to mpObject.h file at the end (before '};'

Code: Select all

	FILE* _fp;
	float _pos[3];
Image
Image

In order to save phase1 ndoes, navigate to tools -> Calculation model properties -> Motion planning -> Compute phase1 nodes
and "phase1node.txt" file will be in your VREP installed folder.
Cheers,

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Retrieving phase 1 nodes through remote APIs.

Post by coppelia »

Thanks for mentioning this Inkyu!

Cheers

Post Reply