背景
今回のadvent calenderではSphero EDUのScratchとspheroV2の比較を行いました。
動作確認した対比表をまとめます。
Sphero EDUとspheroV2の対比表
すみませんが、値と名前は左右で対応していません。
|
Sphero EDU |
spheroV2 |
LEDライト マトリックス |
 |
set_main_led(Color(r=0, g=255, b=0)) |
LEDライト 前LED |
|
set_front_led(Color(r=0, g=255, b=0)) |
LEDライト 後LED |
|
set_back_led(Color(r=255, g=0, b=0)) |
センサー 明るさセンサ |
 |
ambient_light_data = droid.get_luminosity() ambient_light_data['ambient_light'] |
センサー 傾き |
|
orient = droid.get_orientation() pitch = orient['pitch'] |
イベント 衝撃 |
 |
register_event(EventType.on_collision, on_collision) def on_collision(api)は別途作成 12/6 |
LEDライト フェード |
 |
fade(Color(r=255, g=255, b=255), Color(r=50, g=40, b=255), 1.0) |
LEDライト ストロボ |
 |
strobe(Color(r=255, g=255, b=255), 0.5, 1) |
動作 移動 |
 |
roll(0, 100, 0.5) |
動作 コンパスの調整 |
 |
calibrate_compass() |
動作 向きの変更 |
 |
set_compass_direction(0) |
変数 作成 |
 |
- |
変数 代入 |
 |
a = 0 |
コントロール 回数繰り返し |
 |
for i in range(2): |
マトリクス ピクセル |
 |
set_matrix_pixel(0, 0, Color(250, 250, 250)) |
マトリクス テキスト |
 |
scroll_matrix_text("hello world", Color(r=50, g=50, b=250), 15, True) waitは未実装 |
通信 メッセージ送信 |
 |
未実装 |
通信 メッセージ受信 |
 |
未実装 |
センサー 速度 |
 |
droid.get_velocity() math.sqrt((velocity['x']))^2 + (velocity['y'])^2) |
動作 モーター |
 |
raw_motor(75, -75, 0.6) |
関数 定義 |
 |
def retStr0(num0: int, api: SpheroEduAPI): |
サウンド 再生 |
 |
未実装 pygameで代用 12/19 |
最後に
spheroV2は一部の機能が動作確認できませんでしたが、パソコン経由で入出力を工夫できたり、楽しめそうです。
ニコニコ超会議2025にもこちらの活動を出展予定しています。
それでは、よいお年を。