Skip to content
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

Mario #79

Open
wants to merge 7 commits into
base: humble
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
51 changes: 6 additions & 45 deletions firmware/1_servo_set_zero/main/main.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove license

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"
Expand All @@ -30,50 +7,38 @@ 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 = {
.servo_pin = 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 = {
.servo_pin = 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 = {
.servo_pin = 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the indentations

// Initialising the OLED
ESP_ERROR_CHECK(init_oled());
display_logo(MARIO_LOGO);
vTaskDelay(100);
#endif

while (1)
{
Expand All @@ -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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this function removed?

#endif
}
}

Expand Down
35 changes: 0 additions & 35 deletions firmware/2_servo_sweep/main/main.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove license

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"
Expand All @@ -30,39 +7,27 @@ 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 = {
.servo_pin = 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 = {
.servo_pin = 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 = {
.servo_pin = 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
Expand Down
12 changes: 0 additions & 12 deletions firmware/3_microros_rviz/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,39 +61,27 @@ 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 = {
.servo_pin = 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 = {
.servo_pin = 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 = {
.servo_pin = 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,
};


Expand Down
12 changes: 0 additions & 12 deletions firmware/4_microros_gazebo/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down
12 changes: 0 additions & 12 deletions firmware/5_servo_test_webserver/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,27 @@ 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 = {
.servo_pin = 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 = {
.servo_pin = 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 = {
.servo_pin = 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
Expand Down