forked from jsk-ros-pkg/jsk_3rdparty
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
265 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule ".travis"] | ||
path = .travis | ||
url = git://github.com/jsk-ros-pkg/jsk_travis | ||
url = https://github.com/jsk-ros-pkg/jsk_travis |
Submodule .travis
updated
8 files
+27 −0 | .github/workflows/main.yml | |
+0 −0 | CATKIN_IGNORE | |
+18 −0 | CHANGELOG.rst | |
+1 −0 | CMakeLists.txt | |
+5 −0 | docker/Dockerfile.ros-ubuntu:14.04-pcl1.8 | |
+3 −1 | package.xml | |
+18 −0 | test/test_lxml.py | |
+10 −0 | travis.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(ros::load-ros-manifest "gdrive_ros") | ||
|
||
(defun wait-for-gdrive-server (&rest args) | ||
(if args | ||
(ros::wait-for-service "/gdrive_server/upload" args) | ||
(ros::wait-for-service "/gdrive_server/upload") | ||
) | ||
) | ||
|
||
(defun upload-file (file-path | ||
file-title | ||
&key | ||
(parents-path nil) | ||
(parents-id nil) | ||
(use-timestamp-folder nil) | ||
(use-timestamp-file-title nil)) | ||
(let ((req (instance gdrive_ros::UploadRequest :init)) | ||
(res nil)) | ||
(send req :file_path file-path) | ||
(send req :file_title file-title) | ||
(send req :parents_path parents-path) | ||
(send req :parents_id parents-id) | ||
(send req :use_timestamp_folder use-timestamp-folder) | ||
(send req :use_timestamp_file_title use-timestamp-file-title) | ||
(setq res (ros::service-call "/gdrive_server/upload" req t)) | ||
(list (send res :success) | ||
(send res :file_id) | ||
(send res :file_url) | ||
(send res :parents_id) | ||
(send res :parents_url)) | ||
)) | ||
|
||
(defun upload-multiple-files | ||
(file-paths | ||
file-titles | ||
&key | ||
(parents-path nil) | ||
(parents-id nil) | ||
(use-timestamp-folder nil) | ||
(use-timestamp-file-title nil)) | ||
(let ((req (instance gdrive_ros::MultipleUploadRequest :init)) | ||
(res nil)) | ||
(send req :file_paths file-paths) | ||
(send req :file_titles file-titles) | ||
(send req :parents_path parents-path) | ||
(send req :parents_id parents-id) | ||
(send req :use_timestamp_folder use-timestamp-folder) | ||
(send req :use_timestamp_file_title use-timestamp-file-title) | ||
(setq res (ros::service-call "/gdrive_server/upload_multi" req t)) | ||
(list (send res :successes) | ||
(send res :file_ids) | ||
(send res :file_urls) | ||
(send res :parents_id) | ||
(send res :parents_url)) | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env roseus | ||
|
||
(require "package://gdrive_ros/euslisp/gdrive-ros-utils.l") | ||
|
||
(ros::roseus "sample_gdrive_roseus_client") | ||
|
||
(wait-for-gdrive-server) | ||
(ros::ros-info "Gdrive server ready.") | ||
|
||
(setq file-name (ros::get-param "~file_name")) | ||
(setq file-title (ros::get-param "~file_title")) | ||
(setq parents-path (ros::get-param "~parents_path")) | ||
|
||
(ros::ros-info "Uploading files...") | ||
(setq res (upload-file file-name file-title :parents-path parents-path)) | ||
(ros::ros-info "Response: ~A" res) | ||
|
||
(ros::ros-info "Uploading multiple files...") | ||
(setq res (upload-multiple-files (list file-name) (list file-title) :parents-path parents-path)) | ||
(ros::ros-info "Response: ~A" res) | ||
|
||
(ros::roseus "shutdown") | ||
(exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
|
||
import rospy | ||
from gdrive_ros.gdrive_ros_client import GDriveROSClient | ||
|
||
|
||
def main(): | ||
|
||
rospy.init_node('sample_gdrive_rospy_client') | ||
|
||
file_name = rospy.get_param('~file_name') | ||
file_title = rospy.get_param('~file_title') | ||
parents_path = rospy.get_param('~parents_path') | ||
|
||
client = GDriveROSClient() | ||
|
||
client.wait_for_gdrive_server() | ||
|
||
rospy.loginfo('Uploading files...') | ||
ret = client.upload_file(file_name, file_title, parents_path=parents_path) | ||
rospy.loginfo('Result: {}'.format(ret)) | ||
|
||
rospy.loginfo('Uploading files...') | ||
ret = client.upload_multiple_files([file_name], [file_title], parents_path=parents_path) | ||
rospy.loginfo('Result: {}'.format(ret)) | ||
|
||
rospy.loginfo('Successfully finished.') | ||
|
||
|
||
if __name__=='__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<launch> | ||
<arg name="file_name" /> | ||
<arg name="file_title" /> | ||
<arg name="parents_path" default="/example_folder" /> | ||
|
||
<include file="$(find gdrive_ros)/launch/gdrive_server.launch" /> | ||
|
||
<node name="sample_gdrive_roseus_client" pkg="gdrive_ros" type="sample-gdrive-roseus-client.l" | ||
output="screen" required="true"> | ||
<rosparam subst_value="true"> | ||
file_name: $(arg file_name) | ||
file_title: $(arg file_title) | ||
parents_path: $(arg parents_path) | ||
</rosparam> | ||
</node> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<launch> | ||
<arg name="file_name" /> | ||
<arg name="file_title" /> | ||
<arg name="parents_path" default="/example_folder" /> | ||
|
||
<include file="$(find gdrive_ros)/launch/gdrive_server.launch" /> | ||
|
||
<node name="sample_gdrive_rospy_client" pkg="gdrive_ros" type="sample_gdrive_rospy_client.py" | ||
output="screen" required="true"> | ||
<rosparam subst_value="true"> | ||
file_name: $(arg file_name) | ||
file_title: $(arg file_title) | ||
parents_path: $(arg parents_path) | ||
</rosparam> | ||
</node> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from distutils.core import setup | ||
from catkin_pkg.python_setup import generate_distutils_setup | ||
|
||
d = generate_distutils_setup( | ||
packages=['gdrive_ros'], | ||
package_dir={'': 'src'} | ||
) | ||
|
||
setup(**d) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import rospy | ||
from gdrive_ros.srv import MultipleUpload | ||
from gdrive_ros.srv import MultipleUploadRequest | ||
from gdrive_ros.srv import Upload | ||
from gdrive_ros.srv import UploadRequest | ||
|
||
|
||
class GDriveROSClient: | ||
|
||
def __init__(self): | ||
|
||
self.srv_upload = rospy.ServiceProxy( | ||
'/gdrive_server/upload', | ||
Upload | ||
) | ||
self.srv_upload_multi = rospy.ServiceProxy( | ||
'/gdrive_server/upload_multi', | ||
MultipleUpload | ||
) | ||
|
||
def wait_for_gdrive_server(self,timeout=None): | ||
if timeout is None: | ||
rospy.wait_for_service('/gdrive_server/upload') | ||
rospy.wait_for_service('/gdrive_server/upload_multi') | ||
|
||
try: | ||
rospy.wait_for_service('/gdrive_server/upload', timeout=timeout) | ||
rospy.wait_for_service('/gdrive_server/upload_multi', timeout=timeout) | ||
return True | ||
except rospy.ROSException as e: | ||
rospy.logerr('Error: {}'.format(e)) | ||
return False | ||
|
||
def upload_file(self, | ||
file_path, | ||
file_title, | ||
parents_path='', | ||
parents_id='', | ||
use_timestamp_folder=False, | ||
use_timestamp_file_title=False | ||
): | ||
# | ||
req = UploadRequest() | ||
req.file_path = file_path | ||
req.file_title = file_title | ||
req.parents_path = parents_path | ||
req.parents_id = parents_id | ||
req.use_timestamp_folder = use_timestamp_folder | ||
req.use_timestamp_file_title = use_timestamp_file_title | ||
# | ||
res = self.srv_upload(req) | ||
# | ||
return (res.success, | ||
res.file_id, | ||
res.file_url, | ||
res.parents_id, | ||
res.parents_url) | ||
|
||
def upload_multiple_files(self, | ||
file_paths, | ||
file_titles, | ||
parents_path='', | ||
parents_id='', | ||
use_timestamp_folder=False, | ||
use_timestamp_file_title=False | ||
): | ||
# | ||
req = MultipleUploadRequest() | ||
req.file_paths = file_paths | ||
req.file_titles = file_titles | ||
req.parents_path = parents_path | ||
req.parents_id = parents_id | ||
req.use_timestamp_folder = use_timestamp_folder | ||
req.use_timestamp_file_title = use_timestamp_file_title | ||
# | ||
res = self.srv_upload_multi(req) | ||
# | ||
return (res.successes, | ||
res.file_ids, | ||
res.file_urls, | ||
res.parents_id, | ||
res.parents_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters