From dc5844c6547dd39f597353ff45cac2000b7bf562 Mon Sep 17 00:00:00 2001 From: purviyeshi <129578264+purviyeshi@users.noreply.github.com> Date: Sat, 13 Apr 2024 14:33:10 +0545 Subject: [PATCH 1/7] port set servo zero code into esp idf v5.1 --- firmware/1_servo_set_zero/main/main.c | 51 ++++----------------------- 1 file changed, 6 insertions(+), 45 deletions(-) diff --git a/firmware/1_servo_set_zero/main/main.c b/firmware/1_servo_set_zero/main/main.c index e7ebaf9..d7b90ae 100644 --- a/firmware/1_servo_set_zero/main/main.c +++ b/firmware/1_servo_set_zero/main/main.c @@ -1,26 +1,3 @@ -/* -MIT License - -Copyright (c) 2024 Society of Robotics and Automation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ #include "sra_board.h" #define TAG "MCPWM_SERVO_CONTROL" @@ -30,9 +7,6 @@ servo_config servo_a = { .min_pulse_width = CONFIG_SERVO_A_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_A_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_A_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_A, }; servo_config servo_b = { @@ -40,9 +14,6 @@ servo_config servo_b = { .min_pulse_width = CONFIG_SERVO_B_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_B_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_B_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_B, }; servo_config servo_c = { @@ -50,9 +21,6 @@ servo_config servo_c = { .min_pulse_width = CONFIG_SERVO_C_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_C_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_C_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_A, }; servo_config servo_d = { @@ -60,20 +28,17 @@ servo_config servo_d = { .min_pulse_width = CONFIG_SERVO_D_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_D_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_D_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_B, }; static void mcpwm_servo_control(void *arg) { enable_servo(); -#ifdef CONFIG_ENABLE_OLED - // Initialising the OLED - ESP_ERROR_CHECK(init_oled()); - display_logo(MARIO_LOGO); - vTaskDelay(100); -#endif + #ifdef CONFIG_ENABLE_OLED + // Initialising the OLED + ESP_ERROR_CHECK(init_oled()); + display_logo(MARIO_LOGO); + vTaskDelay(100); + #endif while (1) { @@ -85,10 +50,6 @@ static void mcpwm_servo_control(void *arg) vTaskDelay(100); set_angle_servo(&servo_d, 0); vTaskDelay(100); -#ifdef CONFIG_ENABLE_OLED - // Diplaying Servo A, Servo B, Servo C, Servo D values on OLED - display_servo_values(read_servo(&servo_a), read_servo(&servo_b), read_servo(&servo_c), read_servo(&servo_d)); -#endif } } From fc0b70312d5ab2d1a6b9fb2ad4afddf0a2245ac3 Mon Sep 17 00:00:00 2001 From: purviyeshi <129578264+purviyeshi@users.noreply.github.com> Date: Sat, 13 Apr 2024 14:35:12 +0545 Subject: [PATCH 2/7] reconstruct struct according to servo.h --- firmware/2_servo_sweep/main/main.c | 35 ------------------------------ 1 file changed, 35 deletions(-) diff --git a/firmware/2_servo_sweep/main/main.c b/firmware/2_servo_sweep/main/main.c index 2a4cc13..f44cdbc 100644 --- a/firmware/2_servo_sweep/main/main.c +++ b/firmware/2_servo_sweep/main/main.c @@ -1,26 +1,3 @@ -/* -MIT License - -Copyright (c) 2024 Society of Robotics and Automation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ #include "sra_board.h" #define TAG "MCPWM_SERVO_CONTROL" @@ -30,9 +7,6 @@ servo_config servo_a = { .min_pulse_width = CONFIG_SERVO_A_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_A_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_A_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_A, }; servo_config servo_b = { @@ -40,9 +14,6 @@ servo_config servo_b = { .min_pulse_width = CONFIG_SERVO_B_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_B_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_B_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_B, }; servo_config servo_c = { @@ -50,9 +21,6 @@ servo_config servo_c = { .min_pulse_width = CONFIG_SERVO_C_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_C_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_C_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_A, }; servo_config servo_d = { @@ -60,9 +28,6 @@ servo_config servo_d = { .min_pulse_width = CONFIG_SERVO_D_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_D_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_D_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_B, }; #ifdef CONFIG_ENABLE_OLED From 8290fa2ad403e000d9a4a217153f4758a740244b Mon Sep 17 00:00:00 2001 From: purviyeshi <129578264+purviyeshi@users.noreply.github.com> Date: Sat, 13 Apr 2024 14:37:10 +0545 Subject: [PATCH 3/7] Reconstruct struct according to servo.h --- firmware/3_microros_rviz/main/main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/firmware/3_microros_rviz/main/main.c b/firmware/3_microros_rviz/main/main.c index d57306f..0cdda82 100644 --- a/firmware/3_microros_rviz/main/main.c +++ b/firmware/3_microros_rviz/main/main.c @@ -61,9 +61,6 @@ servo_config servo_a = { .min_pulse_width = CONFIG_SERVO_A_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_A_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_A_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_A, }; servo_config servo_b = { @@ -71,9 +68,6 @@ servo_config servo_b = { .min_pulse_width = CONFIG_SERVO_B_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_B_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_B_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_B, }; servo_config servo_c = { @@ -81,9 +75,6 @@ servo_config servo_c = { .min_pulse_width = CONFIG_SERVO_C_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_C_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_C_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_A, }; servo_config servo_d = { @@ -91,9 +82,6 @@ servo_config servo_d = { .min_pulse_width = CONFIG_SERVO_D_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_D_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_D_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_B, }; From 01039c1228e5524dcd6b631f68978d0cb506c534 Mon Sep 17 00:00:00 2001 From: purviyeshi <129578264+purviyeshi@users.noreply.github.com> Date: Sat, 13 Apr 2024 14:38:44 +0545 Subject: [PATCH 4/7] Reconstruct struct according to servo.h --- firmware/4_microros_gazebo/main/main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/firmware/4_microros_gazebo/main/main.c b/firmware/4_microros_gazebo/main/main.c index 63de7ea..1480ab1 100644 --- a/firmware/4_microros_gazebo/main/main.c +++ b/firmware/4_microros_gazebo/main/main.c @@ -61,9 +61,6 @@ static servo_config servo_a = { .min_pulse_width = CONFIG_SERVO_A_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_A_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_A_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_A, }; // configuration for Servo B @@ -72,9 +69,6 @@ static servo_config servo_b = { .min_pulse_width = CONFIG_SERVO_B_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_B_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_B_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_B, }; // configuration for Servo C @@ -83,9 +77,6 @@ static servo_config servo_c = { .min_pulse_width = CONFIG_SERVO_C_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_C_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_C_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_A, }; // configuration for Servo D @@ -94,9 +85,6 @@ static servo_config servo_d = { .min_pulse_width = CONFIG_SERVO_D_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_D_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_D_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_B, }; void subscription_callback(const void * msgin) From 6d9d1c6cf0d53dc3f6c9ef95c62990aeb166e728 Mon Sep 17 00:00:00 2001 From: purviyeshi <129578264+purviyeshi@users.noreply.github.com> Date: Sat, 13 Apr 2024 14:42:29 +0545 Subject: [PATCH 5/7] Reconstruct struct according to servo.h --- firmware/5_servo_test_webserver/main/main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/firmware/5_servo_test_webserver/main/main.c b/firmware/5_servo_test_webserver/main/main.c index 25c7446..5dccecd 100644 --- a/firmware/5_servo_test_webserver/main/main.c +++ b/firmware/5_servo_test_webserver/main/main.c @@ -35,9 +35,6 @@ servo_config servo_a = { .min_pulse_width = CONFIG_SERVO_A_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_A_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_A_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_A, }; servo_config servo_b = { @@ -45,9 +42,6 @@ servo_config servo_b = { .min_pulse_width = CONFIG_SERVO_B_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_B_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_B_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_0, - .gen = MCPWM_OPR_B, }; servo_config servo_c = { @@ -55,9 +49,6 @@ servo_config servo_c = { .min_pulse_width = CONFIG_SERVO_C_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_C_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_C_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_A, }; servo_config servo_d = { @@ -65,9 +56,6 @@ servo_config servo_d = { .min_pulse_width = CONFIG_SERVO_D_MIN_PULSEWIDTH, .max_pulse_width = CONFIG_SERVO_D_MAX_PULSEWIDTH, .max_degree = CONFIG_SERVO_D_MAX_DEGREE, - .mcpwm_num = MCPWM_UNIT_0, - .timer_num = MCPWM_TIMER_1, - .gen = MCPWM_OPR_B, }; #ifdef CONFIG_ENABLE_OLED From 52063db6e4343737f437eccdaef72c65c046e378 Mon Sep 17 00:00:00 2001 From: purviyeshi <129578264+purviyeshi@users.noreply.github.com> Date: Tue, 16 Apr 2024 20:23:33 +0530 Subject: [PATCH 6/7] add license --- firmware/1_servo_set_zero/main/main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/firmware/1_servo_set_zero/main/main.c b/firmware/1_servo_set_zero/main/main.c index d7b90ae..f40bfda 100644 --- a/firmware/1_servo_set_zero/main/main.c +++ b/firmware/1_servo_set_zero/main/main.c @@ -1,3 +1,27 @@ +/* +MIT License + +Copyright (c) 2024 Society of Robotics and Automation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + #include "sra_board.h" #define TAG "MCPWM_SERVO_CONTROL" From c4eab1cc6cabf5374f7ebb8c60a7c5ec26f8cc29 Mon Sep 17 00:00:00 2001 From: purviyeshi <129578264+purviyeshi@users.noreply.github.com> Date: Tue, 16 Apr 2024 20:25:11 +0530 Subject: [PATCH 7/7] add license --- firmware/2_servo_sweep/main/main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/firmware/2_servo_sweep/main/main.c b/firmware/2_servo_sweep/main/main.c index f44cdbc..c881e17 100644 --- a/firmware/2_servo_sweep/main/main.c +++ b/firmware/2_servo_sweep/main/main.c @@ -1,3 +1,27 @@ +/* +MIT License + +Copyright (c) 2024 Society of Robotics and Automation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + #include "sra_board.h" #define TAG "MCPWM_SERVO_CONTROL"