增加源,可编译了

master
Logical 4 years ago
parent 014959494b
commit 35d1f2adb8

@ -2,21 +2,9 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="dfd94b2a-6d7a-49b9-9f27-735b64fff405" name="Default" comment=""> <list default="true" id="dfd94b2a-6d7a-49b9-9f27-735b64fff405" name="Default" comment="">
<change afterPath="$PROJECT_DIR$/Tbot/.idea/caches/build_file_checksums.ser" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Tbot/.idea/codeStyles/Project.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Tbot/.idea/dbnavigator.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Tbot/.idea/encodings.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Tbot/.idea/jarRepositories.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Tbot/.idea/vcs.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tbot/.idea/gradle.xml" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/.idea/gradle.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Tbot/.idea/caches/build_file_checksums.ser" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/.idea/caches/build_file_checksums.ser" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tbot/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/.idea/misc.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../Robot/emotion_detector/src/emotion.py" beforeDir="false" afterPath="$PROJECT_DIR$/../Robot/emotion_detector/src/emotion.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tbot/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/.idea/modules.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tbot/app/src/main/java/me/wshuo/tbot/AudioCall.java" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/app/src/main/java/me/wshuo/tbot/AudioCall.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tbot/app/src/main/java/me/wshuo/tbot/Falldown.java" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/app/src/main/java/me/wshuo/tbot/Falldown.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tbot/app/src/main/java/me/wshuo/tbot/IPConnect.java" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/app/src/main/java/me/wshuo/tbot/IPConnect.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tbot/app/src/main/java/me/wshuo/tbot/Settings.java" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/app/src/main/java/me/wshuo/tbot/Settings.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tbot/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/Tbot/build.gradle" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -92,9 +80,9 @@
<servers /> <servers />
</component> </component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="700" y="302" key="FileChooserDialogImpl" timestamp="1612340452944"> <state x="700" y="302" key="FileChooserDialogImpl" timestamp="1617503949717">
<screen x="0" y="0" width="1920" height="1040" /> <screen x="0" y="0" width="1920" height="1040" />
</state> </state>
<state x="700" y="302" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1612340452944" /> <state x="700" y="302" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1617503949717" />
</component> </component>
</project> </project>

@ -29,6 +29,9 @@ buildscript {
} }
repositories { repositories {
google() google()
mavenCentral()
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
} }
} }

@ -20,4 +20,4 @@ public class FunctionItem {
public int getImageId() { public int getImageId() {
return imageId; return imageId;
} }
} }

@ -190,7 +190,8 @@ public class MasterChooser extends Activity {
} }
}).create(); }).create();
d.show(); d.show();
} else if ( concert.getConnectionStatus().equals(RoconDescription.UNAVAILABLE) ) { }
else if ( concert.getConnectionStatus().equals(RoconDescription.UNAVAILABLE) ) {
AlertDialog d = new AlertDialog.Builder(MasterChooser.this) AlertDialog d = new AlertDialog.Builder(MasterChooser.this)
.setTitle("Master Unavailable!") .setTitle("Master Unavailable!")
.setCancelable(false) .setCancelable(false)
@ -202,7 +203,8 @@ public class MasterChooser extends Activity {
} }
}).create(); }).create();
d.show(); d.show();
} else { }
else {
Intent resultIntent = new Intent(); Intent resultIntent = new Intent();
resultIntent.putExtra(RoconDescription.UNIQUE_KEY, concert); resultIntent.putExtra(RoconDescription.UNIQUE_KEY, concert);
setResult(RESULT_OK, resultIntent); setResult(RESULT_OK, resultIntent);

@ -18,10 +18,10 @@ class TakePhoto:
img_topic = "/camera/rgb/image_raw" img_topic = "/camera/rgb/image_raw"
self.image_sub = rospy.Subscriber(img_topic, Image, self.callback) self.image_sub = rospy.Subscriber(img_topic, Image, self.callback)
# Allow up to two second to connection, # Allow up to two second to connection,
# The initial one second is too short for the camera. # The initial one second is too short for the camera.
# rospy.sleep(1) # rospy.sleep(1)
# by lcp # by lcp
rospy.sleep(2) rospy.sleep(2)
def callback(self, data): def callback(self, data):
@ -45,18 +45,20 @@ class TakePhoto:
# Initialize # Initialize
rospy.init_node('take_photo', anonymous=False) rospy.init_node('take_photo', anonymous=False)
camera = TakePhoto() #构造出TakePhoto类的一个对象 # 构造出TakePhoto类的一个对象
camera = TakePhoto()
# Take a photo # Take a photo
# Use '_image_title' parameter from command line # Use '_image_title' parameter from command line
# Default value is 'photo.jpg' # Default value is 'photo.jpg'
# 照片的名字默认为'photo.jpg' # 照片的名字默认为'photo.jpg'
img_title = rospy.get_param('~image_title', 'photo.jpg') img_title = rospy.get_param('~image_title', 'photo.jpg')
# 调用camera的成员函数take_picture
if camera.take_picture(img_title):
# 如果拍照成功,打印日志"Saved image photo.jpg"
rospy.loginfo("Saved image " + img_title)
if camera.take_picture(img_title): #调用camera的成员函数take_picture
# 如果拍照成功,打印日志"Saved image photo.jpg"
rospy.loginfo("Saved image " + img_title)
else: else:
# 如果拍照失败,打印日志"No images received" # 如果拍照失败,打印日志"No images received"
rospy.loginfo("No images received") rospy.loginfo("No images received")
@ -77,8 +79,8 @@ data.append('--%s' % boundary)
data.append('Content-Disposition: form-data; name="%s"\r\n' % 'api_secret') data.append('Content-Disposition: form-data; name="%s"\r\n' % 'api_secret')
data.append(secret) data.append(secret)
data.append('--%s' % boundary) data.append('--%s' % boundary)
#用'rb'方式读取文件 # 用'rb'方式读取文件
fr=open(filepath,'rb') fr=open(filepath, 'rb')
data.append('Content-Disposition: form-data; name="%s"; filename=" "' % 'image_file') data.append('Content-Disposition: form-data; name="%s"; filename=" "' % 'image_file')
data.append('Content-Type: %s\r\n' % 'application/octet-stream') data.append('Content-Type: %s\r\n' % 'application/octet-stream')
data.append(fr.read()) data.append(fr.read())
@ -86,31 +88,31 @@ data.append(fr.read())
fr.close() fr.close()
data.append('--%s' % boundary) data.append('--%s' % boundary)
data.append('Content-Disposition: form-data; name="%s"\r\n' % 'return_landmark') data.append('Content-Disposition: form-data; name="%s"\r\n' % 'return_landmark')
#人脸特征点:'2'返回106个'1'返回83个'0'不返回 # 人脸特征点:'2'返回106个'1'返回83个'0'不返回
data.append('0') data.append('0')
data.append('--%s' % boundary) data.append('--%s' % boundary)
data.append('Content-Disposition: form-data; name="%s"\r\n' % 'return_attributes') data.append('Content-Disposition: form-data; name="%s"\r\n' % 'return_attributes')
#请求的数据集(字符串) # 请求的数据集(字符串)
data.append("gender,headpose,emotion,eyegaze") data.append("gender,headpose,emotion,eyegaze")
data.append('--%s--\r\n' % boundary) data.append('--%s--\r\n' % boundary)
#python2中data不用decode、encode # python2中data不用decode、encode
http_body='\r\n'.join(data) http_body='\r\n'.join(data)
#buld http request # buld http request
req=urllib2.Request(http_url) req = urllib2.Request(http_url)
#header # header
req.add_header('Content-Type', 'multipart/form-data; boundary=%s' % boundary) req.add_header('Content-Type', 'multipart/form-data; boundary=%s' % boundary)
req.add_data(http_body) req.add_data(http_body)
try: try:
#req.add_header('Referer','http://remotserver.com/') # req.add_header('Referer','http://remotserver.com/')
#post data to server # post data to server
resp = urllib2.urlopen(req, timeout=5) resp = urllib2.urlopen(req, timeout=5)
#get response # get response
qrcont=resp.read() qrcont = resp.read()
print qrcont print qrcont
except urllib2.HTTPError as e: except urllib2.HTTPError as e:
print e.read() print e.read()
Loading…
Cancel
Save