Lerobot-Dataset-Ruby 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 244035b2c7eb6cf559933949e548ad146bf5b5fc4f85741cc583d0d663f2df0a
4
- data.tar.gz: 4ecb290a52027bb0d1c250a61f4a31474e95e290e39b79b59084ae913caa8c52
3
+ metadata.gz: 46b187339341ea39b9482e55744dd2bc61b6ea5fe66c40ecd2fce3862781cb76
4
+ data.tar.gz: e8de384c72390d6a2aa1a65629967b6eadb6aa049351b34d864c48bc6dda37f9
5
5
  SHA512:
6
- metadata.gz: 2ffbe6e6b3c0a3b226eef5b065010b281b26ac7c6e98edca3519087d6ed018bac646ddb79472d06757a094d513d538c24cf148cff33aaac2a6b80dd0a87f8866
7
- data.tar.gz: 677f955ef392be20c35159ca73d49d33b87578b16b2b144c8b944b4b6baf4c4e0b24934693284c35203984b887907470981090a3b266e367bae89421ff07b8c6
6
+ metadata.gz: cd625cb1018498777126c4a68e9c5c8cec29cc823dbcefe7dfbae3de42f9ff37577cccb83a7830b6bbed1eb530ce6deef8d76ad11151a1026b01995d56b1d5b9
7
+ data.tar.gz: c1003fa30554f991b832b78897e4a1ccf97854e23dadbf7ea10a4de640d798c48906c46fba65c108bd8936418fc9f481c8946e3ea0b77b346d924ddd9a7be385
data/Rakefile CHANGED
@@ -3,19 +3,17 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "rake/testtask"
5
5
 
6
- desc "Compile native extension"
6
+ desc "Compile C++ extension"
7
7
  task :compile do
8
- so_file = File.expand_path("ext/opencv/libopencv.so", __dir__)
9
- unless File.exist?(so_file)
10
- system("cd #{File.expand_path('ext/opencv', __dir__)} && ruby extconf.rb && make", exception: true)
8
+ Dir.chdir("ext/opencv") do
9
+ system("ruby extconf.rb", exception: true) unless File.exist?("Makefile")
10
+ system("make", exception: true)
11
11
  end
12
12
  end
13
13
 
14
- Rake::TestTask.new(:test) do |t|
15
- t.libs << "test"
16
- t.libs << "lib"
14
+ Rake::TestTask.new(:test => :compile) do |t|
15
+ t.libs << "test" << "lib"
17
16
  t.test_files = FileList["test/test_*.rb"]
18
17
  end
19
18
 
20
- task test: :compile
21
- task default: :test
19
+ task default: :test
@@ -31,11 +31,6 @@ module Lerobot
31
31
 
32
32
  # 録画開始(内部でLibopencvを呼び出す)
33
33
  def start_recording(path = nil, fps = nil)
34
- begin
35
- require 'libopencv'
36
- rescue LoadError
37
- require_relative '../../../../ext/opencv/libopencv'
38
- end
39
34
  path ||= File.join(@output_dir, 'videos', 'rgb', 'chunk-000', 'file-000.mp4')
40
35
  Libopencv.start_recording(path, fps || @fps)
41
36
  image_bytes = Libopencv.take_picture
@@ -161,17 +156,15 @@ module Lerobot
161
156
  video_path = File.join(video_dir, 'file-000.mp4')
162
157
  FileUtils.mkdir_p(video_dir)
163
158
 
164
- sample_candidates = [
165
- File.expand_path('../../../../test/test.mp4', __dir__),
166
- File.expand_path('../../../../public/test.mp4', __dir__),
167
- File.join(__dir__, 'test', 'test.mp4'),
168
- File.join(__dir__, 'public', 'test.mp4')
169
- ]
170
- sample_path = sample_candidates.find { |path| File.exist?(path) }
159
+ return video_path if File.exist?(video_path)
171
160
 
172
- if !File.exist?(video_path) && sample_path
173
- FileUtils.cp(sample_path, video_path)
174
- end
161
+ gem_root = File.expand_path('../../../..', __dir__)
162
+ sample_path = [
163
+ File.join(gem_root, 'test', 'test.mp4'),
164
+ File.join(gem_root, 'public', 'test.mp4')
165
+ ].find { |path| File.exist?(path) }
166
+
167
+ FileUtils.cp(sample_path, video_path) if sample_path
175
168
  video_path
176
169
  end
177
170
 
@@ -1,12 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "Ruby/version"
3
+ begin
4
+ require "libopencv"
5
+ rescue LoadError
6
+ ext_so = File.expand_path("../../../ext/opencv/libopencv", __dir__)
7
+ require ext_so if File.exist?("#{ext_so}.so")
8
+ end
9
+
4
10
  require_relative "Ruby/reader"
5
11
  require_relative "Ruby/writer"
6
12
 
7
13
  module Lerobot
8
14
  module Dataset
9
15
  module Ruby
16
+ VERSION = "0.2.0"
10
17
  class Error < StandardError; end
11
18
  end
12
19
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "Lerobot/Dataset/Ruby"
data/lib/lerobot.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "Lerobot/Dataset/Ruby"
@@ -2,8 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'fileutils'
5
- require_relative '../lerobot_dataset_writer'
6
- require_relative '../ext/opencv/libopencv'
5
+ require_relative '../lib/lerobot'
7
6
 
8
7
  root = File.expand_path('../output_dataset/robot_dataset', __dir__)
9
8
  FileUtils.rm_rf(root)
data/test/sample.rb CHANGED
@@ -1,5 +1,4 @@
1
- require_relative '../lerobot_dataset_writer'
2
- require_relative '../ext/opencv/libopencv'
1
+ require_relative '../lib/lerobot'
3
2
 
4
3
  # データセット書き込みインスタンス作成
5
4
  writer = LeRobotDatasetWriter.new(output_dir: File.expand_path('../output_dataset/robot_dataset', __dir__), fps: 30)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Lerobot-Dataset-Ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harutodesu
@@ -70,8 +70,9 @@ files:
70
70
  - ext/opencv/libopencv.cpp
71
71
  - lib/Lerobot/Dataset/Ruby.rb
72
72
  - lib/Lerobot/Dataset/Ruby/reader.rb
73
- - lib/Lerobot/Dataset/Ruby/version.rb
74
73
  - lib/Lerobot/Dataset/Ruby/writer.rb
74
+ - lib/lerobot-dataset-ruby.rb
75
+ - lib/lerobot.rb
75
76
  - sig/Lerobot/Dataset/Ruby.rbs
76
77
  - test/minimal_lerobot_check.rb
77
78
  - test/sample.rb
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Lerobot
4
- module Dataset
5
- module Ruby
6
- VERSION = "0.1.0"
7
- end
8
- end
9
- end