Skip to content

Update ci for v3.0 #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/compile-sketches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ jobs:
platforms: | # ESP32公式のpackage indexを使用する
- name: esp32:esp32
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
version: 2.0.17
version: 3.0.1
libraries: | # RTがカスタマイズしたmicro_ros_arduinoライブラリを使用する
- source-url: https://github.com/rt-net/micro_ros_arduino/archive/refs/tags/esp32s3-230417.zip
cli-compile-flags: | # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する
- --build-property
- "compiler.cpp.extra_flags= \
-Wno-error=type-limits" # micro_ros_arduino側のエラーを防ぐ
sketch-paths: |
- uROS_STEP1_LED
- uROS_STEP2_SWITCH
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pi:Co Classic3用のmicro-ROS Arduinoサンプルスケッチ集です。

## 動作環境

- arduino-esp32 : v2.0.17
- arduino-esp32 : v3.0.1

## サンプルスケッチについて

Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP10_tfMsg/interrupt.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
30 changes: 15 additions & 15 deletions uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -136,7 +136,7 @@ void IRAM_ATTR isrR(void)
portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止
if (g_motor_move) {
if (g_step_hz_r < 30) g_step_hz_r = 30;
timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true);
timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0);
digitalWrite(PWM_R, HIGH);
for (int i = 0; i < 100; i++) {
asm("nop \n");
Expand All @@ -153,7 +153,7 @@ void IRAM_ATTR isrL(void)
portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止
if (g_motor_move) {
if (g_step_hz_l < 30) g_step_hz_l = 30;
timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true);
timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0);
digitalWrite(PWM_L, HIGH);
for (int i = 0; i < 100; i++) {
asm("nop \n");
Expand Down Expand Up @@ -201,20 +201,20 @@ void setup()

delay(2000);

g_timer0 = timerBegin(0, 80, true); //1us
timerAttachInterrupt(g_timer0, &onTimer0, true);
timerAlarmWrite(g_timer0, 1000, true); //1kHz
timerAlarmEnable(g_timer0);
g_timer0 = timerBegin(1000000); //1us
timerAttachInterrupt(g_timer0, &onTimer0);
timerAlarm(g_timer0, 1000, true, 0); //1kHz
timerStart(g_timer0);

g_timer2 = timerBegin(2, 40, true); //0.5us
timerAttachInterrupt(g_timer2, &isrR, true);
timerAlarmWrite(g_timer2, 13333, true); //150Hz
timerAlarmEnable(g_timer2);
g_timer2 = timerBegin(2000000); //0.5us
timerAttachInterrupt(g_timer2, &isrR);
timerAlarm(g_timer2, 13333, true, 0); //150Hz
timerStart(g_timer2);

g_timer3 = timerBegin(3, 40, true); //0.5us
timerAttachInterrupt(g_timer3, &isrL, true);
timerAlarmWrite(g_timer3, 13333, true); //150Hz
timerAlarmEnable(g_timer3);
g_timer3 = timerBegin(2000000); //0.5us
timerAttachInterrupt(g_timer3, &isrL);
timerAlarm(g_timer3, 13333, true, 0); //150Hz
timerStart(g_timer3);

g_allocator = rcl_get_default_allocator();

Expand Down
10 changes: 5 additions & 5 deletions uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -163,10 +163,10 @@ void setup()

delay(2000);

g_timer1 = timerBegin(1, 80, true); //1us
timerAttachInterrupt(g_timer1, &onTimer1, true);
timerAlarmWrite(g_timer1, 250, true); //4kHz
timerAlarmEnable(g_timer1);
g_timer1 = timerBegin(1000000); //1us
timerAttachInterrupt(g_timer1, &onTimer1);
timerAlarm(g_timer1, 250, true, 0); //4kHz
timerStart(g_timer1);

g_allocator = rcl_get_default_allocator();

Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/SPIFFS.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/adjust.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion uROS_STEP12_micromouse/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@
#define SW_CM 2
#define SW_RM 4

#define BUZZER_CH 0

#endif // DEVICE_H_
75 changes: 35 additions & 40 deletions uROS_STEP12_micromouse/device.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -60,7 +60,7 @@ void IRAM_ATTR isrR(void)
portENTER_CRITICAL_ISR(&g_timer_mux);
if (g_motor_move) {
if (g_step_hz_r < 30) g_step_hz_r = 30;
timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true);
timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0);
digitalWrite(PWM_R, HIGH);
for (int i = 0; i < 100; i++) {
asm("nop \n");
Expand All @@ -76,7 +76,7 @@ void IRAM_ATTR isrL(void)
portENTER_CRITICAL_ISR(&g_timer_mux);
if (g_motor_move) {
if (g_step_hz_l < 30) g_step_hz_l = 30;
timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true);
timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0);
digitalWrite(PWM_L, HIGH);
for (int i = 0; i < 100; i++) {
asm("nop \n");
Expand All @@ -87,21 +87,21 @@ void IRAM_ATTR isrL(void)
portEXIT_CRITICAL_ISR(&g_timer_mux);
}

void controlInterruptStart(void) { timerAlarmEnable(g_timer0); }
void controlInterruptStop(void) { timerAlarmDisable(g_timer0); }
void controlInterruptStart(void) { timerStart(g_timer0); }
void controlInterruptStop(void) { timerStop(g_timer0); }

void sensorInterruptStart(void) { timerAlarmEnable(g_timer1); }
void sensorInterruptStop(void) { timerAlarmDisable(g_timer1); }
void sensorInterruptStart(void) { timerStart(g_timer1); }
void sensorInterruptStop(void) { timerStop(g_timer1); }

void PWMInterruptStart(void)
{
timerAlarmEnable(g_timer2);
timerAlarmEnable(g_timer3);
timerStart(g_timer2);
timerStart(g_timer3);
}
void PWMInterruptStop(void)
{
timerAlarmDisable(g_timer2);
timerAlarmDisable(g_timer3);
timerStop(g_timer2);
timerStop(g_timer3);
}

void initDevice(void)
Expand All @@ -118,9 +118,8 @@ void initDevice(void)
pinMode(SW_C, INPUT);
pinMode(SW_R, INPUT);

ledcSetup(0, 440, 10);
ledcAttachPin(BUZZER, 0);
ledcWrite(0, 1024);
ledcAttach(BUZZER, 440, 10);
ledcWrite(BUZZER, 1024);

pinMode(SLED_FR, OUTPUT);
pinMode(SLED_FL, OUTPUT);
Expand Down Expand Up @@ -149,25 +148,25 @@ void initDevice(void)
}
}

g_timer0 = timerBegin(0, 80, true);
timerAttachInterrupt(g_timer0, &onTimer0, false);
timerAlarmWrite(g_timer0, 1000, true);
timerAlarmEnable(g_timer0);
g_timer0 = timerBegin(1000000);
timerAttachInterrupt(g_timer0, &onTimer0);
timerAlarm(g_timer0, 1000, true, 0);
timerStart(g_timer0);

g_timer1 = timerBegin(1, 80, true);
timerAttachInterrupt(g_timer1, &onTimer1, true);
timerAlarmWrite(g_timer1, 500, true);
timerAlarmEnable(g_timer1);
g_timer1 = timerBegin(1000000);
timerAttachInterrupt(g_timer1, &onTimer1);
timerAlarm(g_timer1, 500, true, 0);
timerStart(g_timer1);

g_timer2 = timerBegin(2, 40, true);
timerAttachInterrupt(g_timer2, &isrR, false);
timerAlarmWrite(g_timer2, 13333, true);
timerAlarmEnable(g_timer2);
g_timer2 = timerBegin(2000000);
timerAttachInterrupt(g_timer2, &isrR);
timerAlarm(g_timer2, 13333, true, 0);
timerStart(g_timer2);

g_timer3 = timerBegin(3, 40, true);
timerAttachInterrupt(g_timer3, &isrL, false);
timerAlarmWrite(g_timer3, 13333, true);
timerAlarmEnable(g_timer3);
g_timer3 = timerBegin(2000000);
timerAttachInterrupt(g_timer3, &isrL);
timerAlarm(g_timer3, 13333, true, 0);
timerStart(g_timer3);

Serial.begin(115200);

Expand Down Expand Up @@ -199,10 +198,10 @@ void setBLED(char data)
}

//Buzzer
void enableBuzzer(short f) { ledcWriteTone(BUZZER_CH, f); }
void enableBuzzer(short f) { ledcWriteTone(BUZZER, f); }
void disableBuzzer(void)
{
ledcWrite(BUZZER_CH, 1024); //duty 100% Buzzer OFF
ledcWrite(BUZZER, 1024); //duty 100% Buzzer OFF
}

//motor
Expand Down Expand Up @@ -266,8 +265,7 @@ unsigned short getSensorR(void)
for (int i = 0; i < WAITLOOP_SLED; i++) {
asm("nop \n");
}
// unsigned short tmp = analogRead(AD3);
unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_5);
unsigned short tmp = analogRead(AD3);
digitalWrite(SLED_R, LOW);
return tmp;
}
Expand All @@ -277,8 +275,7 @@ unsigned short getSensorL(void)
for (int i = 0; i < WAITLOOP_SLED; i++) {
asm("nop \n");
}
// unsigned short tmp = analogRead(AD4);
unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_6);
unsigned short tmp = analogRead(AD4);
digitalWrite(SLED_L, LOW);
return tmp;
}
Expand All @@ -288,8 +285,7 @@ unsigned short getSensorFL(void)
for (int i = 0; i < WAITLOOP_SLED; i++) {
asm("nop \n");
}
// unsigned short tmp = analogRead(AD2);
unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_4);
unsigned short tmp = analogRead(AD2);
digitalWrite(SLED_FL, LOW); //LED消灯
return tmp;
}
Expand All @@ -299,8 +295,7 @@ unsigned short getSensorFR(void)
for (int i = 0; i < WAITLOOP_SLED; i++) {
asm("nop \n");
}
// unsigned short tmp = analogRead(AD1);
unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_3);
unsigned short tmp = analogRead(AD1);
digitalWrite(SLED_FR, LOW);
return tmp;
}
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/fast.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/interrupt.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/map_manager.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/microROS.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/misc.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/run.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/search.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP1_LED/uROS_STEP1_LED.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2024 RT Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading
Loading