From 35d1f2adb8e724fd15205b6219f97a1e630d04e2 Mon Sep 17 00:00:00 2001 From: Logical <598669236@qq.com> Date: Tue, 6 Apr 2021 10:54:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=BA=90=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AndroidApp/.idea/workspace.xml | 20 ++------ .../.idea/caches/build_file_checksums.ser | Bin 537 -> 537 bytes src/AndroidApp/android_remocons/build.gradle | 3 ++ .../rocon_remocon/FunctionItem.java | 2 +- .../rocon_remocon/MasterChooser.java | 6 ++- src/Robot/emotion_detector/src/emotion.py | 46 +++++++++--------- 6 files changed, 36 insertions(+), 41 deletions(-) diff --git a/src/AndroidApp/.idea/workspace.xml b/src/AndroidApp/.idea/workspace.xml index 44c953c..ce4a0f9 100644 --- a/src/AndroidApp/.idea/workspace.xml +++ b/src/AndroidApp/.idea/workspace.xml @@ -2,21 +2,9 @@ - - - - - - - - - - - - - - + + - + - + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/.idea/caches/build_file_checksums.ser b/src/AndroidApp/Tbot/.idea/caches/build_file_checksums.ser index 7012f9a238c8af18f9c06917e8739bc418772ed0..9c92fcf13fcb7af998d883564369fcd10ef0a21a 100644 GIT binary patch delta 15 XcmbQqGLvP(43=3(RAo2LsbvHJE~N$1 delta 15 XcmbQqGLvP(43>b5|7jcN)G`79Fj@vr diff --git a/src/AndroidApp/android_remocons/build.gradle b/src/AndroidApp/android_remocons/build.gradle index 64cc8d0..29b6eef 100644 --- a/src/AndroidApp/android_remocons/build.gradle +++ b/src/AndroidApp/android_remocons/build.gradle @@ -29,6 +29,9 @@ buildscript { } repositories { google() + mavenCentral() + maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' } + maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'} } } diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/java/com/github/rosjava/android_remocons/rocon_remocon/FunctionItem.java b/src/AndroidApp/android_remocons/rocon_remocon/src/main/java/com/github/rosjava/android_remocons/rocon_remocon/FunctionItem.java index d874785..baf2710 100644 --- a/src/AndroidApp/android_remocons/rocon_remocon/src/main/java/com/github/rosjava/android_remocons/rocon_remocon/FunctionItem.java +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/java/com/github/rosjava/android_remocons/rocon_remocon/FunctionItem.java @@ -20,4 +20,4 @@ public class FunctionItem { public int getImageId() { return imageId; } -} +} \ No newline at end of file diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/java/com/github/rosjava/android_remocons/rocon_remocon/MasterChooser.java b/src/AndroidApp/android_remocons/rocon_remocon/src/main/java/com/github/rosjava/android_remocons/rocon_remocon/MasterChooser.java index 083fc5b..7fae4fc 100644 --- a/src/AndroidApp/android_remocons/rocon_remocon/src/main/java/com/github/rosjava/android_remocons/rocon_remocon/MasterChooser.java +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/java/com/github/rosjava/android_remocons/rocon_remocon/MasterChooser.java @@ -190,7 +190,8 @@ public class MasterChooser extends Activity { } }).create(); d.show(); - } else if ( concert.getConnectionStatus().equals(RoconDescription.UNAVAILABLE) ) { + } + else if ( concert.getConnectionStatus().equals(RoconDescription.UNAVAILABLE) ) { AlertDialog d = new AlertDialog.Builder(MasterChooser.this) .setTitle("Master Unavailable!") .setCancelable(false) @@ -202,7 +203,8 @@ public class MasterChooser extends Activity { } }).create(); d.show(); - } else { + } + else { Intent resultIntent = new Intent(); resultIntent.putExtra(RoconDescription.UNIQUE_KEY, concert); setResult(RESULT_OK, resultIntent); diff --git a/src/Robot/emotion_detector/src/emotion.py b/src/Robot/emotion_detector/src/emotion.py index f2ddb2b..b75ad66 100644 --- a/src/Robot/emotion_detector/src/emotion.py +++ b/src/Robot/emotion_detector/src/emotion.py @@ -18,10 +18,10 @@ class TakePhoto: img_topic = "/camera/rgb/image_raw" self.image_sub = rospy.Subscriber(img_topic, Image, self.callback) - # Allow up to two second to connection, - # The initial one second is too short for the camera. + # Allow up to two second to connection, + # The initial one second is too short for the camera. # rospy.sleep(1) - # by lcp + # by lcp rospy.sleep(2) def callback(self, data): @@ -45,18 +45,20 @@ class TakePhoto: # Initialize rospy.init_node('take_photo', anonymous=False) -camera = TakePhoto() #构造出TakePhoto类的一个对象, +# 构造出TakePhoto类的一个对象, +camera = TakePhoto() # Take a photo - # Use '_image_title' parameter from command line # Default value is '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: # 如果拍照失败,打印日志"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(secret) data.append('--%s' % boundary) -#用'rb'方式读取文件 -fr=open(filepath,'rb') +# 用'rb'方式读取文件 +fr=open(filepath, 'rb') data.append('Content-Disposition: form-data; name="%s"; filename=" "' % 'image_file') data.append('Content-Type: %s\r\n' % 'application/octet-stream') data.append(fr.read()) @@ -86,31 +88,31 @@ data.append(fr.read()) fr.close() data.append('--%s' % boundary) 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('--%s' % boundary) data.append('Content-Disposition: form-data; name="%s"\r\n' % 'return_attributes') -#请求的数据集(字符串) +# 请求的数据集(字符串) data.append("gender,headpose,emotion,eyegaze") data.append('--%s--\r\n' % boundary) -#python2中data不用decode、encode +# python2中data不用decode、encode http_body='\r\n'.join(data) -#buld http request -req=urllib2.Request(http_url) +# buld http request +req = urllib2.Request(http_url) -#header +# header req.add_header('Content-Type', 'multipart/form-data; boundary=%s' % boundary) req.add_data(http_body) try: - #req.add_header('Referer','http://remotserver.com/') - #post data to server + # req.add_header('Referer','http://remotserver.com/') + # post data to server resp = urllib2.urlopen(req, timeout=5) - #get response - qrcont=resp.read() + # get response + qrcont = resp.read() print qrcont except urllib2.HTTPError as e: - print e.read() + print e.read() \ No newline at end of file