Clearing out the computer before it gets wiped.
This commit is contained in:
parent
12e7a39134
commit
95dcbaf3e4
15 changed files with 2121 additions and 0 deletions
|
|
@ -0,0 +1,266 @@
|
|||
/* --------------------------------------------------------------------------
|
||||
* Baxter arm position sender for Kinect V1
|
||||
* Modified from SimpleOpenNI User Test
|
||||
* To run, send the output to the ROS listening port, e.g.
|
||||
* ./processing > /dev/udp/localhost/15444
|
||||
* --------------------------------------------------------------------------
|
||||
* Processing Wrapper for the OpenNI/Kinect 2 library
|
||||
* http://code.google.com/p/simple-openni
|
||||
* --------------------------------------------------------------------------
|
||||
* Modified by J. Devine and Daniel Gonzalez Castro
|
||||
* Original prog: Max Rheiner / Interaction Design / Zhdk / http://iad.zhdk.ch/
|
||||
* date: 12/12/2012 (m/d/y)
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import SimpleOpenNI.*;
|
||||
|
||||
//import processing.net.*;//network lib
|
||||
|
||||
//Client c; //comms output
|
||||
String SendToServer;
|
||||
SimpleOpenNI context;
|
||||
color[] userClr = new color[]{ color(255,0,0),
|
||||
color(0,255,0),
|
||||
color(0,0,255),
|
||||
color(255,255,0),
|
||||
color(255,0,255),
|
||||
color(0,255,255)
|
||||
};
|
||||
PVector com = new PVector();
|
||||
PVector com2d = new PVector();
|
||||
PVector v1 = new PVector();
|
||||
PVector v2d = new PVector();
|
||||
float dontcare;
|
||||
float Lhandx,Lhandy,Rhandx,Rhandy;
|
||||
float Lelbowx,Lelbowy,Relbowx,Relbowy;
|
||||
float Lshoulderx,Lshouldery,Rshoulderx,Rshouldery;
|
||||
float Langle,Rangle,L2angle,R2angle;
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(640,480);
|
||||
|
||||
context = new SimpleOpenNI(this);
|
||||
if(context.isInit() == false)
|
||||
{
|
||||
//println("Can't init SimpleOpenNI, maybe the camera is not connected!");
|
||||
exit();
|
||||
return;
|
||||
}
|
||||
|
||||
// enable depthMap generation
|
||||
context.enableDepth();
|
||||
|
||||
// enable skeleton generation for all joints
|
||||
context.enableUser();
|
||||
|
||||
background(200,0,0);
|
||||
|
||||
stroke(0,0,255);
|
||||
strokeWeight(3);
|
||||
smooth();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
// update the cam
|
||||
context.update();
|
||||
|
||||
// draw depthImageMap
|
||||
//image(context.depthImage(),0,0);
|
||||
image(context.userImage(),0,0);
|
||||
|
||||
// draw the skeleton if it's available
|
||||
int[] userList = context.getUsers();
|
||||
for(int i=0;i<userList.length;i++)
|
||||
{
|
||||
if(context.isTrackingSkeleton(userList[i]))
|
||||
{
|
||||
stroke(userClr[ (userList[i] - 1) % userClr.length ] );
|
||||
drawSkeleton(userList[i]);
|
||||
}
|
||||
|
||||
// draw the center of mass
|
||||
if(context.getCoM(userList[i],com))
|
||||
{
|
||||
context.convertRealWorldToProjective(com,com2d);
|
||||
stroke(100,255,0);
|
||||
strokeWeight(10);
|
||||
beginShape(LINES);
|
||||
vertex(com2d.x,com2d.y);
|
||||
vertex(com2d.x,com2d.y);
|
||||
|
||||
vertex(com2d.x,com2d.y);
|
||||
vertex(com2d.x,com2d.y);
|
||||
|
||||
endShape();
|
||||
fill(0,255,100);
|
||||
text(Integer.toString(userList[i]),com2d.x,com2d.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw the skeleton with the selected joints
|
||||
void drawSkeleton(int userId)
|
||||
{
|
||||
// to get the 3d joint data
|
||||
/*
|
||||
PVector jointPos = new PVector();
|
||||
context.getJointPositionSkeleton(userId,SimpleOpenNI.SKEL_NECK,jointPos);
|
||||
println(jointPos);
|
||||
*/
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_HEAD, SimpleOpenNI.SKEL_NECK);
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_LEFT_SHOULDER);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_LEFT_ELBOW);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_ELBOW, SimpleOpenNI.SKEL_LEFT_HAND);
|
||||
SendToServer="";
|
||||
context.getCoM(userId,v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print("CoM ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(1);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+("CoM:"+v2d.x+','+v2d.y);
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_LEFT_HAND, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" Left hand ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Lhand:"+v2d.x+','+v2d.y);
|
||||
Lhandx=v2d.x;
|
||||
Lhandy=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_LEFT_ELBOW, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
|
||||
//print(" Lelbow ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Lelbow:"+v2d.x+','+v2d.y);
|
||||
Lelbowx=v2d.x;
|
||||
Lelbowy=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" Left shoulder ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Lshoulder:"+v2d.x+','+v2d.y);
|
||||
Lshoulderx=v2d.x;
|
||||
Lshouldery=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_HAND, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" Right hand ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(255,0,0);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Rhand:"+v2d.x+','+v2d.y);
|
||||
Rhandx=v2d.x;
|
||||
Rhandy=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" right elbow ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Relbow:"+v2d.x+','+v2d.y);
|
||||
Relbowx=v2d.x;
|
||||
Relbowy=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" right shoulder ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//println(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Rshoulder:"+v2d.x+','+v2d.x+"\n");
|
||||
//println(SendToServer);
|
||||
Rshoulderx=v2d.x;
|
||||
Rshouldery=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//println(";diference:"+(Lelbowx-Lshoulderx));
|
||||
Langle=atan2((Lelbowx-Lshoulderx),(Lelbowy-Lshouldery));
|
||||
Rangle=atan2((Relbowx-Rshoulderx),(Relbowy-Rshouldery));
|
||||
L2angle=atan2((Lhandx-Lelbowx),(Lhandy-Lelbowy));
|
||||
R2angle=atan2((Rhandx-Relbowx),(Rhandy-Relbowy));
|
||||
println("parsethis:"+Langle+':'+Rangle+':'+L2angle+':'+R2angle);
|
||||
//println(Rangle);
|
||||
//c.write(SendToServer);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_RIGHT_SHOULDER);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_RIGHT_ELBOW);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW, SimpleOpenNI.SKEL_RIGHT_HAND);
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_TORSO);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_TORSO);
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_LEFT_HIP);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_HIP, SimpleOpenNI.SKEL_LEFT_KNEE);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_KNEE, SimpleOpenNI.SKEL_LEFT_FOOT);
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_RIGHT_HIP);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_HIP, SimpleOpenNI.SKEL_RIGHT_KNEE);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_KNEE, SimpleOpenNI.SKEL_RIGHT_FOOT);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// SimpleOpenNI events
|
||||
|
||||
void onNewUser(SimpleOpenNI curContext, int userId)
|
||||
{
|
||||
//println("onNewUser - userId: " + userId);
|
||||
//println("\tstart tracking skeleton");
|
||||
|
||||
curContext.startTrackingSkeleton(userId);
|
||||
}
|
||||
|
||||
void onLostUser(SimpleOpenNI curContext, int userId)
|
||||
{
|
||||
//println("onLostUser - userId: " + userId);
|
||||
}
|
||||
|
||||
void onVisibleUser(SimpleOpenNI curContext, int userId)
|
||||
{
|
||||
//println("onVisibleUser - userId: " + userId);
|
||||
}
|
||||
|
||||
|
||||
void keyPressed()
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case ' ':
|
||||
context.setMirror(!context.mirror());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,262 @@
|
|||
/* --------------------------------------------------------------------------
|
||||
* SimpleOpenNI User Test
|
||||
* --------------------------------------------------------------------------
|
||||
* Processing Wrapper for the OpenNI/Kinect 2 library
|
||||
* http://code.google.com/p/simple-openni
|
||||
* --------------------------------------------------------------------------
|
||||
* prog: Max Rheiner / Interaction Design / Zhdk / http://iad.zhdk.ch/
|
||||
* date: 12/12/2012 (m/d/y)
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import SimpleOpenNI.*;
|
||||
|
||||
//import processing.net.*;//network lib
|
||||
|
||||
//Client c; //comms output
|
||||
String SendToServer;
|
||||
SimpleOpenNI context;
|
||||
color[] userClr = new color[]{ color(255,0,0),
|
||||
color(0,255,0),
|
||||
color(0,0,255),
|
||||
color(255,255,0),
|
||||
color(255,0,255),
|
||||
color(0,255,255)
|
||||
};
|
||||
PVector com = new PVector();
|
||||
PVector com2d = new PVector();
|
||||
PVector v1 = new PVector();
|
||||
PVector v2d = new PVector();
|
||||
float dontcare;
|
||||
float Lhandx,Lhandy,Rhandx,Rhandy;
|
||||
float Lelbowx,Lelbowy,Relbowx,Relbowy;
|
||||
float Lshoulderx,Lshouldery,Rshoulderx,Rshouldery;
|
||||
float Langle,Rangle,L2angle,R2angle;
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(640,480);
|
||||
|
||||
context = new SimpleOpenNI(this);
|
||||
if(context.isInit() == false)
|
||||
{
|
||||
//println("Can't init SimpleOpenNI, maybe the camera is not connected!");
|
||||
exit();
|
||||
return;
|
||||
}
|
||||
|
||||
// enable depthMap generation
|
||||
context.enableDepth();
|
||||
|
||||
// enable skeleton generation for all joints
|
||||
context.enableUser();
|
||||
|
||||
background(200,0,0);
|
||||
|
||||
stroke(0,0,255);
|
||||
strokeWeight(3);
|
||||
smooth();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
// update the cam
|
||||
context.update();
|
||||
|
||||
// draw depthImageMap
|
||||
//image(context.depthImage(),0,0);
|
||||
image(context.userImage(),0,0);
|
||||
|
||||
// draw the skeleton if it's available
|
||||
int[] userList = context.getUsers();
|
||||
for(int i=0;i<userList.length;i++)
|
||||
{
|
||||
if(context.isTrackingSkeleton(userList[i]))
|
||||
{
|
||||
stroke(userClr[ (userList[i] - 1) % userClr.length ] );
|
||||
drawSkeleton(userList[i]);
|
||||
}
|
||||
|
||||
// draw the center of mass
|
||||
if(context.getCoM(userList[i],com))
|
||||
{
|
||||
context.convertRealWorldToProjective(com,com2d);
|
||||
stroke(100,255,0);
|
||||
strokeWeight(10);
|
||||
beginShape(LINES);
|
||||
vertex(com2d.x,com2d.y);
|
||||
vertex(com2d.x,com2d.y);
|
||||
|
||||
vertex(com2d.x,com2d.y);
|
||||
vertex(com2d.x,com2d.y);
|
||||
|
||||
endShape();
|
||||
fill(0,255,100);
|
||||
text(Integer.toString(userList[i]),com2d.x,com2d.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw the skeleton with the selected joints
|
||||
void drawSkeleton(int userId)
|
||||
{
|
||||
// to get the 3d joint data
|
||||
/*
|
||||
PVector jointPos = new PVector();
|
||||
context.getJointPositionSkeleton(userId,SimpleOpenNI.SKEL_NECK,jointPos);
|
||||
println(jointPos);
|
||||
*/
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_HEAD, SimpleOpenNI.SKEL_NECK);
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_LEFT_SHOULDER);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_LEFT_ELBOW);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_ELBOW, SimpleOpenNI.SKEL_LEFT_HAND);
|
||||
SendToServer="";
|
||||
context.getCoM(userId,v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print("CoM ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(1);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+("CoM:"+v2d.x+','+v2d.y);
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_LEFT_HAND, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" Left hand ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Lhand:"+v2d.x+','+v2d.y);
|
||||
Lhandx=v2d.x;
|
||||
Lhandy=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_LEFT_ELBOW, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
|
||||
//print(" Lelbow ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Lelbow:"+v2d.x+','+v2d.y);
|
||||
Lelbowx=v2d.x;
|
||||
Lelbowy=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" Left shoulder ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Lshoulder:"+v2d.x+','+v2d.y);
|
||||
Lshoulderx=v2d.x;
|
||||
Lshouldery=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_HAND, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" Right hand ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(255,0,0);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Rhand:"+v2d.x+','+v2d.y);
|
||||
Rhandx=v2d.x;
|
||||
Rhandy=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" right elbow ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//print(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Relbow:"+v2d.x+','+v2d.y);
|
||||
Relbowx=v2d.x;
|
||||
Relbowy=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//print(" right shoulder ");
|
||||
//print(v2d.x);
|
||||
//print(' ');
|
||||
//println(v2d.y);
|
||||
fill(0,0,0);
|
||||
stroke(255,255,255);
|
||||
strokeWeight(10);
|
||||
rect(v2d.x, v2d.y, 5, 5);
|
||||
SendToServer = SendToServer+(";Rshoulder:"+v2d.x+','+v2d.x+"\n");
|
||||
//println(SendToServer);
|
||||
Rshoulderx=v2d.x;
|
||||
Rshouldery=v2d.y;
|
||||
context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, v1);
|
||||
context.convertRealWorldToProjective(v1,v2d);
|
||||
//println(";diference:"+(Lelbowx-Lshoulderx));
|
||||
Langle=atan2((Lelbowx-Lshoulderx),(Lelbowy-Lshouldery));
|
||||
Rangle=atan2((Relbowx-Rshoulderx),(Relbowy-Rshouldery));
|
||||
L2angle=atan2((Lhandx-Lelbowx),(Lhandy-Lelbowy));
|
||||
R2angle=atan2((Rhandx-Relbowx),(Rhandy-Relbowy));
|
||||
println("parsethis:"+Langle+':'+Rangle+':'+L2angle+':'+R2angle);
|
||||
//println(Rangle);
|
||||
//c.write(SendToServer);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_RIGHT_SHOULDER);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_RIGHT_ELBOW);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW, SimpleOpenNI.SKEL_RIGHT_HAND);
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_TORSO);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_TORSO);
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_LEFT_HIP);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_HIP, SimpleOpenNI.SKEL_LEFT_KNEE);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_KNEE, SimpleOpenNI.SKEL_LEFT_FOOT);
|
||||
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_RIGHT_HIP);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_HIP, SimpleOpenNI.SKEL_RIGHT_KNEE);
|
||||
//context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_KNEE, SimpleOpenNI.SKEL_RIGHT_FOOT);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// SimpleOpenNI events
|
||||
|
||||
void onNewUser(SimpleOpenNI curContext, int userId)
|
||||
{
|
||||
//println("onNewUser - userId: " + userId);
|
||||
//println("\tstart tracking skeleton");
|
||||
|
||||
curContext.startTrackingSkeleton(userId);
|
||||
}
|
||||
|
||||
void onLostUser(SimpleOpenNI curContext, int userId)
|
||||
{
|
||||
//println("onLostUser - userId: " + userId);
|
||||
}
|
||||
|
||||
void onVisibleUser(SimpleOpenNI curContext, int userId)
|
||||
{
|
||||
//println("onVisibleUser - userId: " + userId);
|
||||
}
|
||||
|
||||
|
||||
void keyPressed()
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case ' ':
|
||||
context.setMirror(!context.mirror());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
the_baxter_mimic/baxter instructions.odt
Normal file
BIN
the_baxter_mimic/baxter instructions.odt
Normal file
Binary file not shown.
191
the_baxter_mimic/baxter_mimic_client.sh
Normal file
191
the_baxter_mimic/baxter_mimic_client.sh
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
#!/bin/bash
|
||||
#Make sure you are running the server and the Processing sketch if you actually want the robot to move. Needs a Kinect V1.
|
||||
#We had it up and running on an ubuntu machine.
|
||||
#The processing sketch throws NaN/Div0 errors every so often, hence the infinite loop.
|
||||
# based on the original from Rethink Robotics
|
||||
|
||||
|
||||
# This file is to be used in the *root* of your Catkin workspace.
|
||||
|
||||
# This is a convenient script which will set up your ROS environment and
|
||||
# should be executed with every new instance of a shell in which you plan on
|
||||
# working with Baxter.
|
||||
|
||||
# Clear any previously set your_ip/your_hostname
|
||||
unset your_ip
|
||||
unset your_hostname
|
||||
#-----------------------------------------------------------------------------#
|
||||
# USER CONFIGURABLE ROS ENVIRONMENT VARIABLES #
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Note: If ROS_MASTER_URI, ROS_IP, or ROS_HOSTNAME environment variables were
|
||||
# previously set (typically in your .bashrc or .bash_profile), those settings
|
||||
# will be overwritten by any variables set here.
|
||||
|
||||
# Specify Baxter's hostname
|
||||
baxter_hostname="baxter.local"
|
||||
|
||||
# Set *Either* your computers ip address or hostname. Please note if using
|
||||
# your_hostname that this must be resolvable to Baxter.
|
||||
your_ip="192.168.1.3"
|
||||
#your_hostname="my_computer.local"
|
||||
|
||||
# Specify ROS distribution (e.g. indigo, hydro, etc.)
|
||||
ros_version="indigo"
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
tf=$(mktemp)
|
||||
trap "rm -f -- '${tf}'" EXIT
|
||||
|
||||
# If this file specifies an ip address or hostname - unset any previously set
|
||||
# ROS_IP and/or ROS_HOSTNAME.
|
||||
# If this file does not specify an ip address or hostname - use the
|
||||
# previously specified ROS_IP/ROS_HOSTNAME environment variables.
|
||||
if [ -n "${your_ip}" ] || [ -n "${your_hostname}" ]; then
|
||||
unset ROS_IP && unset ROS_HOSTNAME
|
||||
else
|
||||
your_ip="${ROS_IP}" && your_hostname="${ROS_HOSTNAME}"
|
||||
fi
|
||||
|
||||
# If argument provided, set baxter_hostname to argument
|
||||
# If argument is sim or local, set baxter_hostname to localhost
|
||||
if [ -n "${1}" ]; then
|
||||
if [[ "${1}" == "sim" ]] || [[ "${1}" == "local" ]]; then
|
||||
baxter_hostname="localhost"
|
||||
if [[ -z ${your_ip} || "${your_ip}" == "192.168.XXX.XXX" ]] && \
|
||||
[[ -z ${your_hostname} || "${your_hostname}" == "my_computer.local" ]]; then
|
||||
your_hostname="localhost"
|
||||
your_ip=""
|
||||
fi
|
||||
else
|
||||
baxter_hostname="${1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
topdir=$(basename $(readlink -f $(dirname ${BASH_SOURCE[0]})))
|
||||
|
||||
cat <<-EOF > ${tf}
|
||||
[ -s "\${HOME}"/.bashrc ] && source "\${HOME}"/.bashrc
|
||||
[ -s "\${HOME}"/.bash_profile ] && source "\${HOME}"/.bash_profile
|
||||
|
||||
# verify this script is moved out of baxter folder
|
||||
if [[ -e "${topdir}/baxter_sdk/package.xml" ]]; then
|
||||
echo -ne "EXITING - This script must be moved from the baxter folder \
|
||||
to the root of your catkin workspace.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify ros_version lowercase
|
||||
ros_version="$(tr [A-Z] [a-z] <<< "${ros_version}")"
|
||||
|
||||
# check for ros installation
|
||||
if [ ! -d "/opt/ros" ] || [ ! "$(ls -A /opt/ros)" ]; then
|
||||
echo "EXITING - No ROS installation found in /opt/ros."
|
||||
echo "Is ROS installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified the baxter_hostname
|
||||
if [ -n ${baxter_hostname} ] && \
|
||||
[[ "${baxter_hostname}" == "baxter_hostname.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'baxter_hostname' variable to reflect Baxter's current hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their ip address (your_ip)
|
||||
if [ -n ${your_ip} ] && [[ "${your_ip}" == "192.168.XXX.XXX" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the 'your_ip' \
|
||||
variable to reflect your current IP address.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their computer hostname (your_hostname)
|
||||
if [ -n ${your_hostname} ] && \
|
||||
[[ "${your_hostname}" == "my_computer.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'your_hostname' variable to reflect your current PC hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify user does not have both their ip *and* hostname set
|
||||
if [ -n "${your_ip}" ] && [ -n "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
*EITHER* your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify that one of your_ip, your_hostname, ROS_IP, or ROS_HOSTNAME is set
|
||||
if [ -z "${your_ip}" ] && [ -z "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify specified ros version is installed
|
||||
ros_setup="/opt/ros/\${ros_version}"
|
||||
if [ ! -d "\${ros_setup}" ]; then
|
||||
echo -ne "EXITING - Failed to find ROS \${ros_version} installation \
|
||||
in \${ros_setup}.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the ros setup.sh file exists
|
||||
if [ ! -s "\${ros_setup}"/setup.sh ]; then
|
||||
echo -ne "EXITING - Failed to find the ROS environment script: \
|
||||
"\${ros_setup}"/setup.sh.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the user is running this script in the root of the catkin
|
||||
# workspace and that the workspace has been compiled.
|
||||
if [ ! -s "devel/setup.bash" ]; then
|
||||
echo -ne "EXITING - \n1) Please verify that this script is being run \
|
||||
in the root of your catkin workspace.\n2) Please verify that your workspace \
|
||||
has been built (source /opt/ros/\${ros_version}/setup.sh; catkin_make).\n\
|
||||
3) Run this script again upon completion of your workspace build.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "${your_ip}" ] && export ROS_IP="${your_ip}"
|
||||
[ -n "${your_hostname}" ] && export ROS_HOSTNAME="${your_hostname}"
|
||||
[ -n "${baxter_hostname}" ] && \
|
||||
export ROS_MASTER_URI="http://${baxter_hostname}:11311"
|
||||
|
||||
# source the catkin setup bash script
|
||||
source devel/setup.bash
|
||||
|
||||
# setup the bash prompt
|
||||
export __ROS_PROMPT=\${__ROS_PROMPT:-0}
|
||||
[ \${__ROS_PROMPT} -eq 0 -a -n "\${PROMPT_COMMAND}" ] && \
|
||||
export __ORIG_PROMPT_COMMAND=\${PROMPT_COMMAND}
|
||||
|
||||
__ros_prompt () {
|
||||
if [ -n "\${__ORIG_PROMPT_COMMAND}" ]; then
|
||||
eval \${__ORIG_PROMPT_COMMAND}
|
||||
fi
|
||||
if ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="\[\033[00;33m\][baxter - \
|
||||
\${ROS_MASTER_URI}]\[\033[00m\] \${PS1}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "\${TERM}" != "dumb" ]; then
|
||||
export PROMPT_COMMAND=__ros_prompt
|
||||
__ROS_PROMPT=1
|
||||
elif ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="[baxter - \${ROS_MASTER_URI}] \${PS1}"
|
||||
fi
|
||||
while true;
|
||||
do rosrun brazos brazo_control.py
|
||||
done
|
||||
|
||||
EOF
|
||||
|
||||
${SHELL} --rcfile ${tf}
|
||||
rm -f -- "${tf}"
|
||||
trap - EXIT
|
||||
|
||||
|
||||
|
||||
# vim: noet
|
||||
|
||||
188
the_baxter_mimic/baxter_mimic_client.sh~
Normal file
188
the_baxter_mimic/baxter_mimic_client.sh~
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) 2013-2015, Rethink Robotics
|
||||
# All rights reserved.
|
||||
|
||||
# This file is to be used in the *root* of your Catkin workspace.
|
||||
|
||||
# This is a convenient script which will set up your ROS environment and
|
||||
# should be executed with every new instance of a shell in which you plan on
|
||||
# working with Baxter.
|
||||
|
||||
# Clear any previously set your_ip/your_hostname
|
||||
unset your_ip
|
||||
unset your_hostname
|
||||
#-----------------------------------------------------------------------------#
|
||||
# USER CONFIGURABLE ROS ENVIRONMENT VARIABLES #
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Note: If ROS_MASTER_URI, ROS_IP, or ROS_HOSTNAME environment variables were
|
||||
# previously set (typically in your .bashrc or .bash_profile), those settings
|
||||
# will be overwritten by any variables set here.
|
||||
|
||||
# Specify Baxter's hostname
|
||||
baxter_hostname="baxter.local"
|
||||
|
||||
# Set *Either* your computers ip address or hostname. Please note if using
|
||||
# your_hostname that this must be resolvable to Baxter.
|
||||
your_ip="192.168.1.3"
|
||||
#your_hostname="my_computer.local"
|
||||
|
||||
# Specify ROS distribution (e.g. indigo, hydro, etc.)
|
||||
ros_version="indigo"
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
tf=$(mktemp)
|
||||
trap "rm -f -- '${tf}'" EXIT
|
||||
|
||||
# If this file specifies an ip address or hostname - unset any previously set
|
||||
# ROS_IP and/or ROS_HOSTNAME.
|
||||
# If this file does not specify an ip address or hostname - use the
|
||||
# previously specified ROS_IP/ROS_HOSTNAME environment variables.
|
||||
if [ -n "${your_ip}" ] || [ -n "${your_hostname}" ]; then
|
||||
unset ROS_IP && unset ROS_HOSTNAME
|
||||
else
|
||||
your_ip="${ROS_IP}" && your_hostname="${ROS_HOSTNAME}"
|
||||
fi
|
||||
|
||||
# If argument provided, set baxter_hostname to argument
|
||||
# If argument is sim or local, set baxter_hostname to localhost
|
||||
if [ -n "${1}" ]; then
|
||||
if [[ "${1}" == "sim" ]] || [[ "${1}" == "local" ]]; then
|
||||
baxter_hostname="localhost"
|
||||
if [[ -z ${your_ip} || "${your_ip}" == "192.168.XXX.XXX" ]] && \
|
||||
[[ -z ${your_hostname} || "${your_hostname}" == "my_computer.local" ]]; then
|
||||
your_hostname="localhost"
|
||||
your_ip=""
|
||||
fi
|
||||
else
|
||||
baxter_hostname="${1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
topdir=$(basename $(readlink -f $(dirname ${BASH_SOURCE[0]})))
|
||||
|
||||
cat <<-EOF > ${tf}
|
||||
[ -s "\${HOME}"/.bashrc ] && source "\${HOME}"/.bashrc
|
||||
[ -s "\${HOME}"/.bash_profile ] && source "\${HOME}"/.bash_profile
|
||||
|
||||
# verify this script is moved out of baxter folder
|
||||
if [[ -e "${topdir}/baxter_sdk/package.xml" ]]; then
|
||||
echo -ne "EXITING - This script must be moved from the baxter folder \
|
||||
to the root of your catkin workspace.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify ros_version lowercase
|
||||
ros_version="$(tr [A-Z] [a-z] <<< "${ros_version}")"
|
||||
|
||||
# check for ros installation
|
||||
if [ ! -d "/opt/ros" ] || [ ! "$(ls -A /opt/ros)" ]; then
|
||||
echo "EXITING - No ROS installation found in /opt/ros."
|
||||
echo "Is ROS installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified the baxter_hostname
|
||||
if [ -n ${baxter_hostname} ] && \
|
||||
[[ "${baxter_hostname}" == "baxter_hostname.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'baxter_hostname' variable to reflect Baxter's current hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their ip address (your_ip)
|
||||
if [ -n ${your_ip} ] && [[ "${your_ip}" == "192.168.XXX.XXX" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the 'your_ip' \
|
||||
variable to reflect your current IP address.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their computer hostname (your_hostname)
|
||||
if [ -n ${your_hostname} ] && \
|
||||
[[ "${your_hostname}" == "my_computer.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'your_hostname' variable to reflect your current PC hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify user does not have both their ip *and* hostname set
|
||||
if [ -n "${your_ip}" ] && [ -n "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
*EITHER* your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify that one of your_ip, your_hostname, ROS_IP, or ROS_HOSTNAME is set
|
||||
if [ -z "${your_ip}" ] && [ -z "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify specified ros version is installed
|
||||
ros_setup="/opt/ros/\${ros_version}"
|
||||
if [ ! -d "\${ros_setup}" ]; then
|
||||
echo -ne "EXITING - Failed to find ROS \${ros_version} installation \
|
||||
in \${ros_setup}.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the ros setup.sh file exists
|
||||
if [ ! -s "\${ros_setup}"/setup.sh ]; then
|
||||
echo -ne "EXITING - Failed to find the ROS environment script: \
|
||||
"\${ros_setup}"/setup.sh.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the user is running this script in the root of the catkin
|
||||
# workspace and that the workspace has been compiled.
|
||||
if [ ! -s "devel/setup.bash" ]; then
|
||||
echo -ne "EXITING - \n1) Please verify that this script is being run \
|
||||
in the root of your catkin workspace.\n2) Please verify that your workspace \
|
||||
has been built (source /opt/ros/\${ros_version}/setup.sh; catkin_make).\n\
|
||||
3) Run this script again upon completion of your workspace build.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "${your_ip}" ] && export ROS_IP="${your_ip}"
|
||||
[ -n "${your_hostname}" ] && export ROS_HOSTNAME="${your_hostname}"
|
||||
[ -n "${baxter_hostname}" ] && \
|
||||
export ROS_MASTER_URI="http://${baxter_hostname}:11311"
|
||||
|
||||
# source the catkin setup bash script
|
||||
source devel/setup.bash
|
||||
|
||||
# setup the bash prompt
|
||||
export __ROS_PROMPT=\${__ROS_PROMPT:-0}
|
||||
[ \${__ROS_PROMPT} -eq 0 -a -n "\${PROMPT_COMMAND}" ] && \
|
||||
export __ORIG_PROMPT_COMMAND=\${PROMPT_COMMAND}
|
||||
|
||||
__ros_prompt () {
|
||||
if [ -n "\${__ORIG_PROMPT_COMMAND}" ]; then
|
||||
eval \${__ORIG_PROMPT_COMMAND}
|
||||
fi
|
||||
if ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="\[\033[00;33m\][baxter - \
|
||||
\${ROS_MASTER_URI}]\[\033[00m\] \${PS1}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "\${TERM}" != "dumb" ]; then
|
||||
export PROMPT_COMMAND=__ros_prompt
|
||||
__ROS_PROMPT=1
|
||||
elif ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="[baxter - \${ROS_MASTER_URI}] \${PS1}"
|
||||
fi
|
||||
while true;
|
||||
do rosrun brazos brazo_control.py
|
||||
done
|
||||
|
||||
EOF
|
||||
|
||||
${SHELL} --rcfile ${tf}
|
||||
rm -f -- "${tf}"
|
||||
trap - EXIT
|
||||
|
||||
|
||||
|
||||
# vim: noet
|
||||
|
||||
185
the_baxter_mimic/baxter_mimic_server.sh
Normal file
185
the_baxter_mimic/baxter_mimic_server.sh
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
#!/bin/bash
|
||||
# Modified from the original by Rethink Robotics
|
||||
# Run this first to get baxter going. Then run ./baxtermimic.sh in a new terminal.
|
||||
|
||||
# Clear any previously set your_ip/your_hostname
|
||||
unset your_ip
|
||||
unset your_hostname
|
||||
#-----------------------------------------------------------------------------#
|
||||
# USER CONFIGURABLE ROS ENVIRONMENT VARIABLES #
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Note: If ROS_MASTER_URI, ROS_IP, or ROS_HOSTNAME environment variables were
|
||||
# previously set (typically in your .bashrc or .bash_profile), those settings
|
||||
# will be overwritten by any variables set here.
|
||||
|
||||
# Specify Baxter's hostname
|
||||
baxter_hostname="baxter.local"
|
||||
|
||||
# Set *Either* your computers ip address or hostname. Please note if using
|
||||
# your_hostname that this must be resolvable to Baxter.
|
||||
your_ip="192.168.1.3"
|
||||
#your_hostname="my_computer.local"
|
||||
|
||||
# Specify ROS distribution (e.g. indigo, hydro, etc.)
|
||||
ros_version="indigo"
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
tf=$(mktemp)
|
||||
trap "rm -f -- '${tf}'" EXIT
|
||||
|
||||
# If this file specifies an ip address or hostname - unset any previously set
|
||||
# ROS_IP and/or ROS_HOSTNAME.
|
||||
# If this file does not specify an ip address or hostname - use the
|
||||
# previously specified ROS_IP/ROS_HOSTNAME environment variables.
|
||||
if [ -n "${your_ip}" ] || [ -n "${your_hostname}" ]; then
|
||||
unset ROS_IP && unset ROS_HOSTNAME
|
||||
else
|
||||
your_ip="${ROS_IP}" && your_hostname="${ROS_HOSTNAME}"
|
||||
fi
|
||||
|
||||
# If argument provided, set baxter_hostname to argument
|
||||
# If argument is sim or local, set baxter_hostname to localhost
|
||||
if [ -n "${1}" ]; then
|
||||
if [[ "${1}" == "sim" ]] || [[ "${1}" == "local" ]]; then
|
||||
baxter_hostname="localhost"
|
||||
if [[ -z ${your_ip} || "${your_ip}" == "192.168.XXX.XXX" ]] && \
|
||||
[[ -z ${your_hostname} || "${your_hostname}" == "my_computer.local" ]]; then
|
||||
your_hostname="localhost"
|
||||
your_ip=""
|
||||
fi
|
||||
else
|
||||
baxter_hostname="${1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
topdir=$(basename $(readlink -f $(dirname ${BASH_SOURCE[0]})))
|
||||
|
||||
cat <<-EOF > ${tf}
|
||||
[ -s "\${HOME}"/.bashrc ] && source "\${HOME}"/.bashrc
|
||||
[ -s "\${HOME}"/.bash_profile ] && source "\${HOME}"/.bash_profile
|
||||
|
||||
# verify this script is moved out of baxter folder
|
||||
if [[ -e "${topdir}/baxter_sdk/package.xml" ]]; then
|
||||
echo -ne "EXITING - This script must be moved from the baxter folder \
|
||||
to the root of your catkin workspace.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify ros_version lowercase
|
||||
ros_version="$(tr [A-Z] [a-z] <<< "${ros_version}")"
|
||||
|
||||
# check for ros installation
|
||||
if [ ! -d "/opt/ros" ] || [ ! "$(ls -A /opt/ros)" ]; then
|
||||
echo "EXITING - No ROS installation found in /opt/ros."
|
||||
echo "Is ROS installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified the baxter_hostname
|
||||
if [ -n ${baxter_hostname} ] && \
|
||||
[[ "${baxter_hostname}" == "baxter_hostname.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'baxter_hostname' variable to reflect Baxter's current hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their ip address (your_ip)
|
||||
if [ -n ${your_ip} ] && [[ "${your_ip}" == "192.168.XXX.XXX" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the 'your_ip' \
|
||||
variable to reflect your current IP address.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their computer hostname (your_hostname)
|
||||
if [ -n ${your_hostname} ] && \
|
||||
[[ "${your_hostname}" == "my_computer.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'your_hostname' variable to reflect your current PC hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify user does not have both their ip *and* hostname set
|
||||
if [ -n "${your_ip}" ] && [ -n "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
*EITHER* your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify that one of your_ip, your_hostname, ROS_IP, or ROS_HOSTNAME is set
|
||||
if [ -z "${your_ip}" ] && [ -z "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify specified ros version is installed
|
||||
ros_setup="/opt/ros/\${ros_version}"
|
||||
if [ ! -d "\${ros_setup}" ]; then
|
||||
echo -ne "EXITING - Failed to find ROS \${ros_version} installation \
|
||||
in \${ros_setup}.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the ros setup.sh file exists
|
||||
if [ ! -s "\${ros_setup}"/setup.sh ]; then
|
||||
echo -ne "EXITING - Failed to find the ROS environment script: \
|
||||
"\${ros_setup}"/setup.sh.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the user is running this script in the root of the catkin
|
||||
# workspace and that the workspace has been compiled.
|
||||
if [ ! -s "devel/setup.bash" ]; then
|
||||
echo -ne "EXITING - \n1) Please verify that this script is being run \
|
||||
in the root of your catkin workspace.\n2) Please verify that your workspace \
|
||||
has been built (source /opt/ros/\${ros_version}/setup.sh; catkin_make).\n\
|
||||
3) Run this script again upon completion of your workspace build.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "${your_ip}" ] && export ROS_IP="${your_ip}"
|
||||
[ -n "${your_hostname}" ] && export ROS_HOSTNAME="${your_hostname}"
|
||||
[ -n "${baxter_hostname}" ] && \
|
||||
export ROS_MASTER_URI="http://${baxter_hostname}:11311"
|
||||
|
||||
# source the catkin setup bash script
|
||||
source devel/setup.bash
|
||||
|
||||
# setup the bash prompt
|
||||
export __ROS_PROMPT=\${__ROS_PROMPT:-0}
|
||||
[ \${__ROS_PROMPT} -eq 0 -a -n "\${PROMPT_COMMAND}" ] && \
|
||||
export __ORIG_PROMPT_COMMAND=\${PROMPT_COMMAND}
|
||||
|
||||
__ros_prompt () {
|
||||
if [ -n "\${__ORIG_PROMPT_COMMAND}" ]; then
|
||||
eval \${__ORIG_PROMPT_COMMAND}
|
||||
fi
|
||||
if ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="\[\033[00;33m\][baxter - \
|
||||
\${ROS_MASTER_URI}]\[\033[00m\] \${PS1}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "\${TERM}" != "dumb" ]; then
|
||||
export PROMPT_COMMAND=__ros_prompt
|
||||
__ROS_PROMPT=1
|
||||
elif ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="[baxter - \${ROS_MASTER_URI}] \${PS1}"
|
||||
fi
|
||||
rosrun baxter_tools enable_robot.py -e
|
||||
rosrun baxter_tools camera_control.py -l
|
||||
rosrun baxter_tools camera_control.py -c right_hand_camera
|
||||
rosrun baxter_tools camera_control.py -o head_camera 640x480
|
||||
rosrun brazos arm_server.py &disown
|
||||
rosrun camara face_server.py
|
||||
|
||||
EOF
|
||||
|
||||
${SHELL} --rcfile ${tf}
|
||||
rm -f -- "${tf}"
|
||||
trap - EXIT
|
||||
|
||||
|
||||
|
||||
# vim: noet
|
||||
|
||||
199
the_baxter_mimic/baxter_talk_client.sh
Normal file
199
the_baxter_mimic/baxter_talk_client.sh
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
#!/bin/bash
|
||||
#This script converts the speech.txt file to a wav and then sends it along with some movements to the Baxter.
|
||||
#Make sure you are running the server!
|
||||
pico2wave -w speech.wav "$(cat speech.txt)"
|
||||
|
||||
|
||||
# Copyright (c) 2013-2015, Rethink Robotics
|
||||
# All rights reserved.
|
||||
|
||||
# This file is to be used in the *root* of your Catkin workspace.
|
||||
|
||||
# This is a convenient script which will set up your ROS environment and
|
||||
# should be executed with every new instance of a shell in which you plan on
|
||||
# working with Baxter.
|
||||
|
||||
# Clear any previously set your_ip/your_hostname
|
||||
unset your_ip
|
||||
unset your_hostname
|
||||
#-----------------------------------------------------------------------------#
|
||||
# USER CONFIGURABLE ROS ENVIRONMENT VARIABLES #
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Note: If ROS_MASTER_URI, ROS_IP, or ROS_HOSTNAME environment variables were
|
||||
# previously set (typically in your .bashrc or .bash_profile), those settings
|
||||
# will be overwritten by any variables set here.
|
||||
|
||||
# Specify Baxter's hostname
|
||||
baxter_hostname="baxter.local"
|
||||
|
||||
# Set *Either* your computers ip address or hostname. Please note if using
|
||||
# your_hostname that this must be resolvable to Baxter.
|
||||
your_ip="192.168.1.3"
|
||||
#your_hostname="my_computer.local"
|
||||
|
||||
# Specify ROS distribution (e.g. indigo, hydro, etc.)
|
||||
ros_version="indigo"
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
tf=$(mktemp)
|
||||
trap "rm -f -- '${tf}'" EXIT
|
||||
|
||||
# If this file specifies an ip address or hostname - unset any previously set
|
||||
# ROS_IP and/or ROS_HOSTNAME.
|
||||
# If this file does not specify an ip address or hostname - use the
|
||||
# previously specified ROS_IP/ROS_HOSTNAME environment variables.
|
||||
if [ -n "${your_ip}" ] || [ -n "${your_hostname}" ]; then
|
||||
unset ROS_IP && unset ROS_HOSTNAME
|
||||
else
|
||||
your_ip="${ROS_IP}" && your_hostname="${ROS_HOSTNAME}"
|
||||
fi
|
||||
|
||||
# If argument provided, set baxter_hostname to argument
|
||||
# If argument is sim or local, set baxter_hostname to localhost
|
||||
if [ -n "${1}" ]; then
|
||||
if [[ "${1}" == "sim" ]] || [[ "${1}" == "local" ]]; then
|
||||
baxter_hostname="localhost"
|
||||
if [[ -z ${your_ip} || "${your_ip}" == "192.168.XXX.XXX" ]] && \
|
||||
[[ -z ${your_hostname} || "${your_hostname}" == "my_computer.local" ]]; then
|
||||
your_hostname="localhost"
|
||||
your_ip=""
|
||||
fi
|
||||
else
|
||||
baxter_hostname="${1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
topdir=$(basename $(readlink -f $(dirname ${BASH_SOURCE[0]})))
|
||||
|
||||
cat <<-EOF > ${tf}
|
||||
[ -s "\${HOME}"/.bashrc ] && source "\${HOME}"/.bashrc
|
||||
[ -s "\${HOME}"/.bash_profile ] && source "\${HOME}"/.bash_profile
|
||||
|
||||
# verify this script is moved out of baxter folder
|
||||
if [[ -e "${topdir}/baxter_sdk/package.xml" ]]; then
|
||||
echo -ne "EXITING - This script must be moved from the baxter folder \
|
||||
to the root of your catkin workspace.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify ros_version lowercase
|
||||
ros_version="$(tr [A-Z] [a-z] <<< "${ros_version}")"
|
||||
|
||||
# check for ros installation
|
||||
if [ ! -d "/opt/ros" ] || [ ! "$(ls -A /opt/ros)" ]; then
|
||||
echo "EXITING - No ROS installation found in /opt/ros."
|
||||
echo "Is ROS installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified the baxter_hostname
|
||||
if [ -n ${baxter_hostname} ] && \
|
||||
[[ "${baxter_hostname}" == "baxter_hostname.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'baxter_hostname' variable to reflect Baxter's current hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their ip address (your_ip)
|
||||
if [ -n ${your_ip} ] && [[ "${your_ip}" == "192.168.XXX.XXX" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the 'your_ip' \
|
||||
variable to reflect your current IP address.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their computer hostname (your_hostname)
|
||||
if [ -n ${your_hostname} ] && \
|
||||
[[ "${your_hostname}" == "my_computer.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'your_hostname' variable to reflect your current PC hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify user does not have both their ip *and* hostname set
|
||||
if [ -n "${your_ip}" ] && [ -n "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
*EITHER* your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify that one of your_ip, your_hostname, ROS_IP, or ROS_HOSTNAME is set
|
||||
if [ -z "${your_ip}" ] && [ -z "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify specified ros version is installed
|
||||
ros_setup="/opt/ros/\${ros_version}"
|
||||
if [ ! -d "\${ros_setup}" ]; then
|
||||
echo -ne "EXITING - Failed to find ROS \${ros_version} installation \
|
||||
in \${ros_setup}.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the ros setup.sh file exists
|
||||
if [ ! -s "\${ros_setup}"/setup.sh ]; then
|
||||
echo -ne "EXITING - Failed to find the ROS environment script: \
|
||||
"\${ros_setup}"/setup.sh.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the user is running this script in the root of the catkin
|
||||
# workspace and that the workspace has been compiled.
|
||||
if [ ! -s "devel/setup.bash" ]; then
|
||||
echo -ne "EXITING - \n1) Please verify that this script is being run \
|
||||
in the root of your catkin workspace.\n2) Please verify that your workspace \
|
||||
has been built (source /opt/ros/\${ros_version}/setup.sh; catkin_make).\n\
|
||||
3) Run this script again upon completion of your workspace build.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "${your_ip}" ] && export ROS_IP="${your_ip}"
|
||||
[ -n "${your_hostname}" ] && export ROS_HOSTNAME="${your_hostname}"
|
||||
[ -n "${baxter_hostname}" ] && \
|
||||
export ROS_MASTER_URI="http://${baxter_hostname}:11311"
|
||||
|
||||
# source the catkin setup bash script
|
||||
source devel/setup.bash
|
||||
|
||||
# setup the bash prompt
|
||||
export __ROS_PROMPT=\${__ROS_PROMPT:-0}
|
||||
[ \${__ROS_PROMPT} -eq 0 -a -n "\${PROMPT_COMMAND}" ] && \
|
||||
export __ORIG_PROMPT_COMMAND=\${PROMPT_COMMAND}
|
||||
|
||||
__ros_prompt () {
|
||||
if [ -n "\${__ORIG_PROMPT_COMMAND}" ]; then
|
||||
eval \${__ORIG_PROMPT_COMMAND}
|
||||
fi
|
||||
if ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="\[\033[00;33m\][baxter - \
|
||||
\${ROS_MASTER_URI}]\[\033[00m\] \${PS1}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "\${TERM}" != "dumb" ]; then
|
||||
export PROMPT_COMMAND=__ros_prompt
|
||||
__ROS_PROMPT=1
|
||||
elif ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="[baxter - \${ROS_MASTER_URI}] \${PS1}"
|
||||
fi
|
||||
rosrun brazos arm_client.py "afraid"
|
||||
sleep 5
|
||||
rosrun camara deliver_speech.py
|
||||
sleep 44
|
||||
#nake this sleep longer to suit the length of the text being read.
|
||||
rosrun brazos arm_client.py "up-down"
|
||||
sleep 5
|
||||
rosrun brazos arm_client.py "stop"
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
${SHELL} --rcfile ${tf}
|
||||
rm -f -- "${tf}"
|
||||
trap - EXIT
|
||||
|
||||
|
||||
|
||||
# vim: noet
|
||||
|
||||
198
the_baxter_mimic/baxter_talk_client.sh~
Normal file
198
the_baxter_mimic/baxter_talk_client.sh~
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
#!/bin/bash
|
||||
#This script converts the speech.txt file to a wav and then sends it along with some movements to the Baxter.
|
||||
pico2wave -w speech.wav "$(cat speech.txt)"
|
||||
|
||||
|
||||
# Copyright (c) 2013-2015, Rethink Robotics
|
||||
# All rights reserved.
|
||||
|
||||
# This file is to be used in the *root* of your Catkin workspace.
|
||||
|
||||
# This is a convenient script which will set up your ROS environment and
|
||||
# should be executed with every new instance of a shell in which you plan on
|
||||
# working with Baxter.
|
||||
|
||||
# Clear any previously set your_ip/your_hostname
|
||||
unset your_ip
|
||||
unset your_hostname
|
||||
#-----------------------------------------------------------------------------#
|
||||
# USER CONFIGURABLE ROS ENVIRONMENT VARIABLES #
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Note: If ROS_MASTER_URI, ROS_IP, or ROS_HOSTNAME environment variables were
|
||||
# previously set (typically in your .bashrc or .bash_profile), those settings
|
||||
# will be overwritten by any variables set here.
|
||||
|
||||
# Specify Baxter's hostname
|
||||
baxter_hostname="baxter.local"
|
||||
|
||||
# Set *Either* your computers ip address or hostname. Please note if using
|
||||
# your_hostname that this must be resolvable to Baxter.
|
||||
your_ip="192.168.1.3"
|
||||
#your_hostname="my_computer.local"
|
||||
|
||||
# Specify ROS distribution (e.g. indigo, hydro, etc.)
|
||||
ros_version="indigo"
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
tf=$(mktemp)
|
||||
trap "rm -f -- '${tf}'" EXIT
|
||||
|
||||
# If this file specifies an ip address or hostname - unset any previously set
|
||||
# ROS_IP and/or ROS_HOSTNAME.
|
||||
# If this file does not specify an ip address or hostname - use the
|
||||
# previously specified ROS_IP/ROS_HOSTNAME environment variables.
|
||||
if [ -n "${your_ip}" ] || [ -n "${your_hostname}" ]; then
|
||||
unset ROS_IP && unset ROS_HOSTNAME
|
||||
else
|
||||
your_ip="${ROS_IP}" && your_hostname="${ROS_HOSTNAME}"
|
||||
fi
|
||||
|
||||
# If argument provided, set baxter_hostname to argument
|
||||
# If argument is sim or local, set baxter_hostname to localhost
|
||||
if [ -n "${1}" ]; then
|
||||
if [[ "${1}" == "sim" ]] || [[ "${1}" == "local" ]]; then
|
||||
baxter_hostname="localhost"
|
||||
if [[ -z ${your_ip} || "${your_ip}" == "192.168.XXX.XXX" ]] && \
|
||||
[[ -z ${your_hostname} || "${your_hostname}" == "my_computer.local" ]]; then
|
||||
your_hostname="localhost"
|
||||
your_ip=""
|
||||
fi
|
||||
else
|
||||
baxter_hostname="${1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
topdir=$(basename $(readlink -f $(dirname ${BASH_SOURCE[0]})))
|
||||
|
||||
cat <<-EOF > ${tf}
|
||||
[ -s "\${HOME}"/.bashrc ] && source "\${HOME}"/.bashrc
|
||||
[ -s "\${HOME}"/.bash_profile ] && source "\${HOME}"/.bash_profile
|
||||
|
||||
# verify this script is moved out of baxter folder
|
||||
if [[ -e "${topdir}/baxter_sdk/package.xml" ]]; then
|
||||
echo -ne "EXITING - This script must be moved from the baxter folder \
|
||||
to the root of your catkin workspace.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify ros_version lowercase
|
||||
ros_version="$(tr [A-Z] [a-z] <<< "${ros_version}")"
|
||||
|
||||
# check for ros installation
|
||||
if [ ! -d "/opt/ros" ] || [ ! "$(ls -A /opt/ros)" ]; then
|
||||
echo "EXITING - No ROS installation found in /opt/ros."
|
||||
echo "Is ROS installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified the baxter_hostname
|
||||
if [ -n ${baxter_hostname} ] && \
|
||||
[[ "${baxter_hostname}" == "baxter_hostname.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'baxter_hostname' variable to reflect Baxter's current hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their ip address (your_ip)
|
||||
if [ -n ${your_ip} ] && [[ "${your_ip}" == "192.168.XXX.XXX" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the 'your_ip' \
|
||||
variable to reflect your current IP address.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their computer hostname (your_hostname)
|
||||
if [ -n ${your_hostname} ] && \
|
||||
[[ "${your_hostname}" == "my_computer.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'your_hostname' variable to reflect your current PC hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify user does not have both their ip *and* hostname set
|
||||
if [ -n "${your_ip}" ] && [ -n "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
*EITHER* your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify that one of your_ip, your_hostname, ROS_IP, or ROS_HOSTNAME is set
|
||||
if [ -z "${your_ip}" ] && [ -z "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify specified ros version is installed
|
||||
ros_setup="/opt/ros/\${ros_version}"
|
||||
if [ ! -d "\${ros_setup}" ]; then
|
||||
echo -ne "EXITING - Failed to find ROS \${ros_version} installation \
|
||||
in \${ros_setup}.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the ros setup.sh file exists
|
||||
if [ ! -s "\${ros_setup}"/setup.sh ]; then
|
||||
echo -ne "EXITING - Failed to find the ROS environment script: \
|
||||
"\${ros_setup}"/setup.sh.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the user is running this script in the root of the catkin
|
||||
# workspace and that the workspace has been compiled.
|
||||
if [ ! -s "devel/setup.bash" ]; then
|
||||
echo -ne "EXITING - \n1) Please verify that this script is being run \
|
||||
in the root of your catkin workspace.\n2) Please verify that your workspace \
|
||||
has been built (source /opt/ros/\${ros_version}/setup.sh; catkin_make).\n\
|
||||
3) Run this script again upon completion of your workspace build.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "${your_ip}" ] && export ROS_IP="${your_ip}"
|
||||
[ -n "${your_hostname}" ] && export ROS_HOSTNAME="${your_hostname}"
|
||||
[ -n "${baxter_hostname}" ] && \
|
||||
export ROS_MASTER_URI="http://${baxter_hostname}:11311"
|
||||
|
||||
# source the catkin setup bash script
|
||||
source devel/setup.bash
|
||||
|
||||
# setup the bash prompt
|
||||
export __ROS_PROMPT=\${__ROS_PROMPT:-0}
|
||||
[ \${__ROS_PROMPT} -eq 0 -a -n "\${PROMPT_COMMAND}" ] && \
|
||||
export __ORIG_PROMPT_COMMAND=\${PROMPT_COMMAND}
|
||||
|
||||
__ros_prompt () {
|
||||
if [ -n "\${__ORIG_PROMPT_COMMAND}" ]; then
|
||||
eval \${__ORIG_PROMPT_COMMAND}
|
||||
fi
|
||||
if ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="\[\033[00;33m\][baxter - \
|
||||
\${ROS_MASTER_URI}]\[\033[00m\] \${PS1}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "\${TERM}" != "dumb" ]; then
|
||||
export PROMPT_COMMAND=__ros_prompt
|
||||
__ROS_PROMPT=1
|
||||
elif ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="[baxter - \${ROS_MASTER_URI}] \${PS1}"
|
||||
fi
|
||||
rosrun brazos arm_client.py "afraid"
|
||||
sleep 5
|
||||
rosrun camara deliver_speech.py
|
||||
sleep 44
|
||||
#nake this sleep longer to suit the length of the text being read.
|
||||
rosrun brazos arm_client.py "up-down"
|
||||
sleep 5
|
||||
rosrun brazos arm_client.py "stop"
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
${SHELL} --rcfile ${tf}
|
||||
rm -f -- "${tf}"
|
||||
trap - EXIT
|
||||
|
||||
|
||||
|
||||
# vim: noet
|
||||
|
||||
192
the_baxter_mimic/baxter_talk_server.sh
Normal file
192
the_baxter_mimic/baxter_talk_server.sh
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
#!/bin/bash
|
||||
#This script accepts connections from the talk client.
|
||||
# Modified from the original by Rethink Robotics
|
||||
|
||||
|
||||
# This file is to be used in the *root* of your Catkin workspace.
|
||||
|
||||
# This is a convenient script which will set up your ROS environment and
|
||||
# should be executed with every new instance of a shell in which you plan on
|
||||
# working with Baxter.
|
||||
|
||||
# Clear any previously set your_ip/your_hostname
|
||||
unset your_ip
|
||||
unset your_hostname
|
||||
#-----------------------------------------------------------------------------#
|
||||
# USER CONFIGURABLE ROS ENVIRONMENT VARIABLES #
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Note: If ROS_MASTER_URI, ROS_IP, or ROS_HOSTNAME environment variables were
|
||||
# previously set (typically in your .bashrc or .bash_profile), those settings
|
||||
# will be overwritten by any variables set here.
|
||||
|
||||
# Specify Baxter's hostname
|
||||
baxter_hostname="baxter.local"
|
||||
|
||||
# Set *Either* your computers ip address or hostname. Please note if using
|
||||
# your_hostname that this must be resolvable to Baxter.
|
||||
your_ip="192.168.1.3"
|
||||
#your_hostname="my_computer.local"
|
||||
|
||||
# Specify ROS distribution (e.g. indigo, hydro, etc.)
|
||||
ros_version="indigo"
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
tf=$(mktemp)
|
||||
trap "rm -f -- '${tf}'" EXIT
|
||||
|
||||
# If this file specifies an ip address or hostname - unset any previously set
|
||||
# ROS_IP and/or ROS_HOSTNAME.
|
||||
# If this file does not specify an ip address or hostname - use the
|
||||
# previously specified ROS_IP/ROS_HOSTNAME environment variables.
|
||||
if [ -n "${your_ip}" ] || [ -n "${your_hostname}" ]; then
|
||||
unset ROS_IP && unset ROS_HOSTNAME
|
||||
else
|
||||
your_ip="${ROS_IP}" && your_hostname="${ROS_HOSTNAME}"
|
||||
fi
|
||||
|
||||
# If argument provided, set baxter_hostname to argument
|
||||
# If argument is sim or local, set baxter_hostname to localhost
|
||||
if [ -n "${1}" ]; then
|
||||
if [[ "${1}" == "sim" ]] || [[ "${1}" == "local" ]]; then
|
||||
baxter_hostname="localhost"
|
||||
if [[ -z ${your_ip} || "${your_ip}" == "192.168.XXX.XXX" ]] && \
|
||||
[[ -z ${your_hostname} || "${your_hostname}" == "my_computer.local" ]]; then
|
||||
your_hostname="localhost"
|
||||
your_ip=""
|
||||
fi
|
||||
else
|
||||
baxter_hostname="${1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
topdir=$(basename $(readlink -f $(dirname ${BASH_SOURCE[0]})))
|
||||
|
||||
cat <<-EOF > ${tf}
|
||||
[ -s "\${HOME}"/.bashrc ] && source "\${HOME}"/.bashrc
|
||||
[ -s "\${HOME}"/.bash_profile ] && source "\${HOME}"/.bash_profile
|
||||
|
||||
# verify this script is moved out of baxter folder
|
||||
if [[ -e "${topdir}/baxter_sdk/package.xml" ]]; then
|
||||
echo -ne "EXITING - This script must be moved from the baxter folder \
|
||||
to the root of your catkin workspace.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify ros_version lowercase
|
||||
ros_version="$(tr [A-Z] [a-z] <<< "${ros_version}")"
|
||||
|
||||
# check for ros installation
|
||||
if [ ! -d "/opt/ros" ] || [ ! "$(ls -A /opt/ros)" ]; then
|
||||
echo "EXITING - No ROS installation found in /opt/ros."
|
||||
echo "Is ROS installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified the baxter_hostname
|
||||
if [ -n ${baxter_hostname} ] && \
|
||||
[[ "${baxter_hostname}" == "baxter_hostname.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'baxter_hostname' variable to reflect Baxter's current hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their ip address (your_ip)
|
||||
if [ -n ${your_ip} ] && [[ "${your_ip}" == "192.168.XXX.XXX" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the 'your_ip' \
|
||||
variable to reflect your current IP address.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their computer hostname (your_hostname)
|
||||
if [ -n ${your_hostname} ] && \
|
||||
[[ "${your_hostname}" == "my_computer.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'your_hostname' variable to reflect your current PC hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify user does not have both their ip *and* hostname set
|
||||
if [ -n "${your_ip}" ] && [ -n "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
*EITHER* your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify that one of your_ip, your_hostname, ROS_IP, or ROS_HOSTNAME is set
|
||||
if [ -z "${your_ip}" ] && [ -z "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify specified ros version is installed
|
||||
ros_setup="/opt/ros/\${ros_version}"
|
||||
if [ ! -d "\${ros_setup}" ]; then
|
||||
echo -ne "EXITING - Failed to find ROS \${ros_version} installation \
|
||||
in \${ros_setup}.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the ros setup.sh file exists
|
||||
if [ ! -s "\${ros_setup}"/setup.sh ]; then
|
||||
echo -ne "EXITING - Failed to find the ROS environment script: \
|
||||
"\${ros_setup}"/setup.sh.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the user is running this script in the root of the catkin
|
||||
# workspace and that the workspace has been compiled.
|
||||
if [ ! -s "devel/setup.bash" ]; then
|
||||
echo -ne "EXITING - \n1) Please verify that this script is being run \
|
||||
in the root of your catkin workspace.\n2) Please verify that your workspace \
|
||||
has been built (source /opt/ros/\${ros_version}/setup.sh; catkin_make).\n\
|
||||
3) Run this script again upon completion of your workspace build.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "${your_ip}" ] && export ROS_IP="${your_ip}"
|
||||
[ -n "${your_hostname}" ] && export ROS_HOSTNAME="${your_hostname}"
|
||||
[ -n "${baxter_hostname}" ] && \
|
||||
export ROS_MASTER_URI="http://${baxter_hostname}:11311"
|
||||
|
||||
# source the catkin setup bash script
|
||||
source devel/setup.bash
|
||||
|
||||
# setup the bash prompt
|
||||
export __ROS_PROMPT=\${__ROS_PROMPT:-0}
|
||||
[ \${__ROS_PROMPT} -eq 0 -a -n "\${PROMPT_COMMAND}" ] && \
|
||||
export __ORIG_PROMPT_COMMAND=\${PROMPT_COMMAND}
|
||||
|
||||
__ros_prompt () {
|
||||
if [ -n "\${__ORIG_PROMPT_COMMAND}" ]; then
|
||||
eval \${__ORIG_PROMPT_COMMAND}
|
||||
fi
|
||||
if ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="\[\033[00;33m\][baxter - \
|
||||
\${ROS_MASTER_URI}]\[\033[00m\] \${PS1}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "\${TERM}" != "dumb" ]; then
|
||||
export PROMPT_COMMAND=__ros_prompt
|
||||
__ROS_PROMPT=1
|
||||
elif ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="[baxter - \${ROS_MASTER_URI}] \${PS1}"
|
||||
fi
|
||||
rosrun baxter_tools enable_robot.py -e
|
||||
rosrun baxter_tools camera_control.py -l
|
||||
rosrun baxter_tools camera_control.py -c right_hand_camera
|
||||
rosrun baxter_tools camera_control.py -o head_camera 640x480
|
||||
rosrun brazos arm_server.py &disown
|
||||
rosrun camara face_server.py
|
||||
|
||||
EOF
|
||||
|
||||
${SHELL} --rcfile ${tf}
|
||||
rm -f -- "${tf}"
|
||||
trap - EXIT
|
||||
|
||||
|
||||
|
||||
# vim: noet
|
||||
|
||||
191
the_baxter_mimic/baxter_talk_server.sh~
Normal file
191
the_baxter_mimic/baxter_talk_server.sh~
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) 2013-2015, Rethink Robotics
|
||||
# All rights reserved.
|
||||
|
||||
# This file is to be used in the *root* of your Catkin workspace.
|
||||
|
||||
# This is a convenient script which will set up your ROS environment and
|
||||
# should be executed with every new instance of a shell in which you plan on
|
||||
# working with Baxter.
|
||||
|
||||
# Clear any previously set your_ip/your_hostname
|
||||
unset your_ip
|
||||
unset your_hostname
|
||||
#-----------------------------------------------------------------------------#
|
||||
# USER CONFIGURABLE ROS ENVIRONMENT VARIABLES #
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Note: If ROS_MASTER_URI, ROS_IP, or ROS_HOSTNAME environment variables were
|
||||
# previously set (typically in your .bashrc or .bash_profile), those settings
|
||||
# will be overwritten by any variables set here.
|
||||
|
||||
# Specify Baxter's hostname
|
||||
baxter_hostname="baxter.local"
|
||||
|
||||
# Set *Either* your computers ip address or hostname. Please note if using
|
||||
# your_hostname that this must be resolvable to Baxter.
|
||||
your_ip="192.168.1.3"
|
||||
#your_hostname="my_computer.local"
|
||||
|
||||
# Specify ROS distribution (e.g. indigo, hydro, etc.)
|
||||
ros_version="indigo"
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
tf=$(mktemp)
|
||||
trap "rm -f -- '${tf}'" EXIT
|
||||
|
||||
# If this file specifies an ip address or hostname - unset any previously set
|
||||
# ROS_IP and/or ROS_HOSTNAME.
|
||||
# If this file does not specify an ip address or hostname - use the
|
||||
# previously specified ROS_IP/ROS_HOSTNAME environment variables.
|
||||
if [ -n "${your_ip}" ] || [ -n "${your_hostname}" ]; then
|
||||
unset ROS_IP && unset ROS_HOSTNAME
|
||||
else
|
||||
your_ip="${ROS_IP}" && your_hostname="${ROS_HOSTNAME}"
|
||||
fi
|
||||
|
||||
# If argument provided, set baxter_hostname to argument
|
||||
# If argument is sim or local, set baxter_hostname to localhost
|
||||
if [ -n "${1}" ]; then
|
||||
if [[ "${1}" == "sim" ]] || [[ "${1}" == "local" ]]; then
|
||||
baxter_hostname="localhost"
|
||||
if [[ -z ${your_ip} || "${your_ip}" == "192.168.XXX.XXX" ]] && \
|
||||
[[ -z ${your_hostname} || "${your_hostname}" == "my_computer.local" ]]; then
|
||||
your_hostname="localhost"
|
||||
your_ip=""
|
||||
fi
|
||||
else
|
||||
baxter_hostname="${1}"
|
||||
fi
|
||||
fi
|
||||
|
||||
topdir=$(basename $(readlink -f $(dirname ${BASH_SOURCE[0]})))
|
||||
|
||||
cat <<-EOF > ${tf}
|
||||
[ -s "\${HOME}"/.bashrc ] && source "\${HOME}"/.bashrc
|
||||
[ -s "\${HOME}"/.bash_profile ] && source "\${HOME}"/.bash_profile
|
||||
|
||||
# verify this script is moved out of baxter folder
|
||||
if [[ -e "${topdir}/baxter_sdk/package.xml" ]]; then
|
||||
echo -ne "EXITING - This script must be moved from the baxter folder \
|
||||
to the root of your catkin workspace.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify ros_version lowercase
|
||||
ros_version="$(tr [A-Z] [a-z] <<< "${ros_version}")"
|
||||
|
||||
# check for ros installation
|
||||
if [ ! -d "/opt/ros" ] || [ ! "$(ls -A /opt/ros)" ]; then
|
||||
echo "EXITING - No ROS installation found in /opt/ros."
|
||||
echo "Is ROS installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified the baxter_hostname
|
||||
if [ -n ${baxter_hostname} ] && \
|
||||
[[ "${baxter_hostname}" == "baxter_hostname.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'baxter_hostname' variable to reflect Baxter's current hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their ip address (your_ip)
|
||||
if [ -n ${your_ip} ] && [[ "${your_ip}" == "192.168.XXX.XXX" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the 'your_ip' \
|
||||
variable to reflect your current IP address.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if set, verify user has modified their computer hostname (your_hostname)
|
||||
if [ -n ${your_hostname} ] && \
|
||||
[[ "${your_hostname}" == "my_computer.local" ]]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying the \
|
||||
'your_hostname' variable to reflect your current PC hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify user does not have both their ip *and* hostname set
|
||||
if [ -n "${your_ip}" ] && [ -n "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
*EITHER* your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify that one of your_ip, your_hostname, ROS_IP, or ROS_HOSTNAME is set
|
||||
if [ -z "${your_ip}" ] && [ -z "${your_hostname}" ]; then
|
||||
echo -ne "EXITING - Please edit this file, modifying to specify \
|
||||
your_ip or your_hostname.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify specified ros version is installed
|
||||
ros_setup="/opt/ros/\${ros_version}"
|
||||
if [ ! -d "\${ros_setup}" ]; then
|
||||
echo -ne "EXITING - Failed to find ROS \${ros_version} installation \
|
||||
in \${ros_setup}.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the ros setup.sh file exists
|
||||
if [ ! -s "\${ros_setup}"/setup.sh ]; then
|
||||
echo -ne "EXITING - Failed to find the ROS environment script: \
|
||||
"\${ros_setup}"/setup.sh.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify the user is running this script in the root of the catkin
|
||||
# workspace and that the workspace has been compiled.
|
||||
if [ ! -s "devel/setup.bash" ]; then
|
||||
echo -ne "EXITING - \n1) Please verify that this script is being run \
|
||||
in the root of your catkin workspace.\n2) Please verify that your workspace \
|
||||
has been built (source /opt/ros/\${ros_version}/setup.sh; catkin_make).\n\
|
||||
3) Run this script again upon completion of your workspace build.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "${your_ip}" ] && export ROS_IP="${your_ip}"
|
||||
[ -n "${your_hostname}" ] && export ROS_HOSTNAME="${your_hostname}"
|
||||
[ -n "${baxter_hostname}" ] && \
|
||||
export ROS_MASTER_URI="http://${baxter_hostname}:11311"
|
||||
|
||||
# source the catkin setup bash script
|
||||
source devel/setup.bash
|
||||
|
||||
# setup the bash prompt
|
||||
export __ROS_PROMPT=\${__ROS_PROMPT:-0}
|
||||
[ \${__ROS_PROMPT} -eq 0 -a -n "\${PROMPT_COMMAND}" ] && \
|
||||
export __ORIG_PROMPT_COMMAND=\${PROMPT_COMMAND}
|
||||
|
||||
__ros_prompt () {
|
||||
if [ -n "\${__ORIG_PROMPT_COMMAND}" ]; then
|
||||
eval \${__ORIG_PROMPT_COMMAND}
|
||||
fi
|
||||
if ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="\[\033[00;33m\][baxter - \
|
||||
\${ROS_MASTER_URI}]\[\033[00m\] \${PS1}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "\${TERM}" != "dumb" ]; then
|
||||
export PROMPT_COMMAND=__ros_prompt
|
||||
__ROS_PROMPT=1
|
||||
elif ! echo \${PS1} | grep '\[baxter' &>/dev/null; then
|
||||
export PS1="[baxter - \${ROS_MASTER_URI}] \${PS1}"
|
||||
fi
|
||||
rosrun baxter_tools enable_robot.py -e
|
||||
rosrun baxter_tools camera_control.py -l
|
||||
rosrun baxter_tools camera_control.py -c right_hand_camera
|
||||
rosrun baxter_tools camera_control.py -o head_camera 640x480
|
||||
rosrun brazos arm_server.py &disown
|
||||
rosrun camara face_server.py
|
||||
|
||||
EOF
|
||||
|
||||
${SHELL} --rcfile ${tf}
|
||||
rm -f -- "${tf}"
|
||||
trap - EXIT
|
||||
|
||||
|
||||
|
||||
# vim: noet
|
||||
|
||||
127
the_baxter_mimic/brazos/arm_server.py
Normal file
127
the_baxter_mimic/brazos/arm_server.py
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/python2
|
||||
|
||||
# Copyright (c) 2013-2015, Rethink Robotics
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the Rethink Robotics nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
import rospy
|
||||
|
||||
from baxter_core_msgs.msg import JointCommand
|
||||
import baxter_interface
|
||||
from std_msgs.msg import String
|
||||
|
||||
state="stop"
|
||||
def state_machine(data):
|
||||
global state
|
||||
state=data.data
|
||||
print state
|
||||
|
||||
def talker():
|
||||
|
||||
print ("hola")
|
||||
global state
|
||||
state="stop"
|
||||
rospy.Subscriber('arm_move', String, state_machine)
|
||||
|
||||
pub_left = rospy.Publisher('robot/limb/left/joint_command', JointCommand, queue_size=1)
|
||||
pub_right = rospy.Publisher('robot/limb/right/joint_command', JointCommand, queue_size=1)
|
||||
rospy.init_node("brazo_control")
|
||||
rate=rospy.Rate(15)
|
||||
contador=0
|
||||
contador_afraid=0
|
||||
|
||||
while not rospy.is_shutdown():
|
||||
|
||||
if (state=="stop"):
|
||||
|
||||
pub_left.publish(mode=1,command=[-0.48, -0.505, 0.041, 1.77, 0.018, 0.266, 3.048],names=['left_s0','left_s1','left_e0','left_e1','left_w0','left_w1','left_w2'])
|
||||
pub_right.publish(mode=1,command=[0.477, -0.4, 0.2, 1.45, 2.75, -0.45, 3.05],names=['right_s0','right_s1','right_e0','right_e1','right_w0','right_w1','right_w2'])
|
||||
if (state=="up-down"):
|
||||
print contador
|
||||
if contador<30:
|
||||
pub_left.publish(mode=1,command=[0.004, 0.265, 3.045, 0.005, 1.787, -0.49, -1.03],names=['left_w0', 'left_w1', 'left_w2', 'left_e0', 'left_e1', 'left_s0', 'left_s1'])
|
||||
pub_right.publish(mode=1,command=[0.34, -0.08, 3.035, -0.066, 3.035, 0.133, 1.55],names=['right_s0', 'right_s1' , 'right_w0', 'right_w1', 'right_w2', 'right_e0', 'right_e1'])
|
||||
contador=contador+1
|
||||
if contador>=30:
|
||||
pub_left.publish(mode=1,command=[0.004, -0.0939, 3.044, 0.0038, 1.699, -0.518, -0.151],names=['left_w0', 'left_w1' , 'left_w2', 'left_e0', 'left_e1', 'left_s0', 'left_s1'])
|
||||
pub_right.publish(mode=1,command=[0.36, -0.82, 2.91, -0.934, 3.05, 0.225, 1.402],names=['right_s0', 'right_s1', 'right_w0', 'right_w1', 'right_w2', 'right_e0', 'right_e1'])
|
||||
contador=contador+1
|
||||
if contador==60:
|
||||
contador=0
|
||||
if (state=="two_hands"):
|
||||
if contador<100:
|
||||
pub_left.publish(mode=1,command=[0.018, -0.204, 3.046, 0.225, -0.044, -0.507, -0.60],names=['left_w0', 'left_w1', 'left_w2', 'left_e0', 'left_e1', 'left_s0', 'left_s1'])
|
||||
pub_right.publish(mode=1,command=[0.5, -0.85, 2.8, 0.22, 3.05, 0.007, 0.406],names=['right_s0', 'right_s1', 'right_w0', 'right_w1', 'right_w2', 'right_e0', 'right_e1'])
|
||||
if contador==100:
|
||||
contador=0
|
||||
state="stop"
|
||||
if (state=="left_hand"):
|
||||
if contador<100:
|
||||
pub_left.publish(mode=1,command=[-1.45, 0.182, 3.018, 0.041, -0.039, -0.777, -0.011],names=['left_w0', 'left_w1', 'left_w2', 'left_e0', 'left_e1', 'left_s0', 'left_s1'])
|
||||
pub_right.publish(mode=1,command=[0.477, -0.4, 0.2, 1.45, 2.75, -0.45, 3.05],names=['right_s0','right_s1','right_e0','right_e1','right_w0','right_w1','right_w2'])
|
||||
if contador==100:
|
||||
contador=0
|
||||
state="stop"
|
||||
if (state=="right_hand"):
|
||||
if contador<100:
|
||||
pub_left.publish(mode=1,command=[-0.48, -0.505, 0.041, 1.77, 0.018, 0.266, 3.048],names=['left_s0','left_s1','left_e0','left_e1','left_w0','left_w1','left_w2'])
|
||||
pub_right.publish(mode=1,command=[0.21, -0.194, 3.059, -0.268, 3.054, 0.923, 0.356],names=['right_s0', 'right_s1', 'right_w0', 'right_w1', 'right_w2', 'right_e0', 'right_e1'])
|
||||
if contador==100:
|
||||
contador=0
|
||||
state="stop"
|
||||
if (state=="afraid"):
|
||||
if contador<50:
|
||||
pub_left.publish(mode=1,command=[-0.238, -0.0329, 3.044, 0.270, -0.0498, -0.49, -1.157],names=['left_w0', 'left_w1', 'left_w2', 'left_e0', 'left_e1', 'left_s0', 'left_s1'])
|
||||
pub_right.publish(mode=1,command=[0.58, -1.1635,3.0579, -0.156, 3.053, -0.0145, -0.0498],names=['right_s0', 'right_s1', 'right_w0', 'right_w1', 'right_w2', 'right_e0', 'right_e1'])
|
||||
contador=contador+1
|
||||
if contador>=50:
|
||||
pub_left.publish(mode=1,command=[-0.711, 0.009, 3.04, 0.287, 0.262, -0.437, -1.0787],names=['left_w0', 'left_w1', 'left_w2', 'left_e0', 'left_e1', 'left_s0', 'left_s1'])
|
||||
pub_right.publish(mode=1,command=[0.091, -1.160, 3.059,-0.333,3.053, 0.1096, 0.365],names=['right_s0', 'right_s1', 'right_w0', 'right_w1', 'right_w2', 'right_e0', 'right_e1'])
|
||||
contador=contador+1
|
||||
if contador==100:
|
||||
contador=0
|
||||
contador_afraid=contador_afraid+1
|
||||
if contador_afraid==2:
|
||||
state="stop"
|
||||
ontador_afraid=0
|
||||
|
||||
|
||||
rate.sleep()
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
|
||||
talker()
|
||||
except rospy.ROSInterruptException:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
20
the_baxter_mimic/camara/deliver_speech.py
Normal file
20
the_baxter_mimic/camara/deliver_speech.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
# license removed for brevity
|
||||
import rospy
|
||||
from std_msgs.msg import String
|
||||
import sys
|
||||
|
||||
def talker():
|
||||
pub = rospy.Publisher('face_type', String, queue_size=10)
|
||||
rospy.init_node('face_client', anonymous=True)
|
||||
rate = rospy.Rate(10) # 10hz
|
||||
audio="speech.wav"
|
||||
|
||||
pub.publish(audio)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
talker()
|
||||
except rospy.ROSInterruptException:
|
||||
pass
|
||||
20
the_baxter_mimic/camara/face_client
Normal file
20
the_baxter_mimic/camara/face_client
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
# license removed for brevity
|
||||
import rospy
|
||||
from std_msgs.msg import String
|
||||
import sys
|
||||
|
||||
def talker():
|
||||
pub = rospy.Publisher('face_type', String, queue_size=10)
|
||||
rospy.init_node('face_client', anonymous=True)
|
||||
rate = rospy.Rate(10) # 10hz
|
||||
audio="src/camara/scripts/"+sys.argv[1]
|
||||
|
||||
pub.publish(audio)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
talker()
|
||||
except rospy.ROSInterruptException:
|
||||
pass
|
||||
72
the_baxter_mimic/camara/face_server.py
Normal file
72
the_baxter_mimic/camara/face_server.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/python2
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import threading
|
||||
import rospy
|
||||
import cv2
|
||||
import cv_bridge
|
||||
import pyaudio
|
||||
import wave
|
||||
import sys
|
||||
import math
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
CHUNK = 1024
|
||||
from std_msgs.msg import String
|
||||
|
||||
from sensor_msgs.msg import (
|
||||
Image,
|
||||
)
|
||||
audio_path="src/camara/scripts/audio.wav"
|
||||
def callback(data):
|
||||
arg1="src/camara/scripts/conversacion/saludo3.png"
|
||||
arg2="src/camara/scripts/conversacion/saludo10.png"
|
||||
img1 = cv2.imread(arg1)
|
||||
img2 = cv2.imread(arg2)
|
||||
msg1 = cv_bridge.CvBridge().cv2_to_imgmsg(img1, encoding="bgr8")
|
||||
msg2 = cv_bridge.CvBridge().cv2_to_imgmsg(img2, encoding="bgr8")
|
||||
pub = rospy.Publisher('/robot/xdisplay', Image, latch=True, queue_size=1)
|
||||
pub.publish(msg1)
|
||||
global audio_path
|
||||
audio_path=data.data
|
||||
wf = wave.open(audio_path, 'rb')
|
||||
# instantiate PyAudio (1)
|
||||
p = pyaudio.PyAudio()
|
||||
# open stream (2)
|
||||
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
|
||||
channels=wf.getnchannels(),
|
||||
rate=wf.getframerate(),
|
||||
output=True)
|
||||
|
||||
data = wf.readframes(CHUNK)
|
||||
# play stream (3)
|
||||
frames=[]
|
||||
while len(data) > 0:
|
||||
stream.write(data)
|
||||
data = wf.readframes(CHUNK)
|
||||
signal = np.fromstring(data, 'Int16')
|
||||
if (math.fabs(np.average(signal))<5):
|
||||
pub.publish(msg1)
|
||||
else:
|
||||
pub.publish(msg2)
|
||||
|
||||
|
||||
|
||||
def manage_audio():
|
||||
rospy.init_node("estado2")
|
||||
rate=rospy.Rate(10)
|
||||
contador=1
|
||||
|
||||
rospy.Subscriber('face_type', String, callback)
|
||||
print ("callback")
|
||||
|
||||
rospy.spin()
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
|
||||
manage_audio()
|
||||
except rospy.ROSInterruptException:
|
||||
pass
|
||||
10
the_baxter_mimic/speech.txt
Normal file
10
the_baxter_mimic/speech.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Hi. I'm Baxter.
|
||||
I very much enjoyed being on the CineGlobe jury.
|
||||
I can tell you, that I, really enjoyed session six.
|
||||
Or I should say you, enjoyed session six.
|
||||
However, I found it very, difficult to make a decision.
|
||||
I don't know how you humans do it.
|
||||
I guess, judging art just isn't, yet, for machines.
|
||||
But I will let, Mohanty, explain to you how I was going to decide my favorite film.
|
||||
Mohanty, would, you, like to come up here?
|
||||
Everyone, Mohanty, Sharada, from the Artificial Intelligence, lab at the, Ecole, Polytechnique, Federale, de Lausanne.
|
||||
Loading…
Reference in a new issue