Skip to content

Develop/blinks - #5

Open
maninhofurg wants to merge 3 commits into
mainfrom
develop/blinks
Open

Develop/blinks#5
maninhofurg wants to merge 3 commits into
mainfrom
develop/blinks

Conversation

@maninhofurg

Copy link
Copy Markdown

Dynamic Configuration (CMD 1): Implemented logic in main.cpp and emotions_bridge.py to load motor names and blink angles via motors.yaml.

Blink Service (CMD 3): Added the /set_blink service using the std_srvs/srv/SetBool interface for manual control of face autonomy.

Control Logic: Implemented the handleBlinking() function in the firmware with a safety check to prevent movements if parameters are not loaded.

State Persistence: Updated the currentEyelidLeftAngle and currentEyelidRightAngle variables to ensure the eyelid returns to the correct position after blinking, even during emotion execution.

Action: Call the /set_blink service passing the boolean value True.

ros2 service call /set_blink std_srvs/srv/SetBool "{data: true}"

@maninhofurg
maninhofurg requested review from Gui-MB and richassis April 24, 2026 15:52
@maninhofurg maninhofurg self-assigned this Apr 24, 2026

@richassis richassis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice job! Requesting some changes and some improvements suggestions.

Comment thread fbot_head/config/motors.yaml Outdated
Comment on lines +69 to +70
blink_left: true
blink_closed_angle: 140 # Novo: Ângulo para fechar no piscar

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The key for identifying it as a blinking motor is unnecessary. Keep only one key with the angle value.
Here is my suggestion:

Suggested change
blink_left: true
blink_closed_angle: 140 # Novo: Ângulo para fechar no piscar
blink_left_angle: 140 #New angle for blinking

Comment thread fbot_head/config/motors.yaml Outdated
Comment on lines +86 to +87
blink_right: true
blink_closed_angle: 35 # Novo: Ângulo para fechar no piscar

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The key for identifying it as a blinking motor is unnecessary. Keep only one key with the angle value. Here is my suggestion:

Suggested change
blink_right: true
blink_closed_angle: 35 # Novo: Ângulo para fechar no piscar
blink_right_angle: 35 #New angle for blinking


try:
self.serial = serial.Serial('/dev/ttyFACE')
self.serial = serial.Serial('/dev/ttyFACE', 9600, timeout=1) # Mantido conforme padrão ESP32

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comments on code should be in English

@@ -35,28 +36,67 @@ def __init__(self, pause=False):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is interesting to always set a default initial state for blinking. The way it is right now, it won't start nor stop the blinking, so it keeps as it was before launching node.
My suggestion is to add an argument to the emotions.launch.py, where the user sets if blinking should start True or False. Then here at the init, you internally "call" the blinking service as this value, so it starts the way the user set.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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


time.sleep(2)

# ADICIONADO: CALLBACK DO NOVO SERVIÇO (CMD 3)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comments in english

motors_pins: dict = {
"cmd": 1
"cmd": 1,
"blink_cfg": {} # Novo sub-dicionário para parâmetros de piscagem

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comments in english


motors_pins[motor] = self.get_parameter(motor+'.pin').value

# Verifica se é uma pálpebra configurada para piscar (Busca dinamicamente no YAML)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comments in english

self.declare_parameter(motor+'.'+param, value)

for motor, params in config.items():
# Itera sobre cada sub-item do motor (pin, blink_left, etc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comments in english

Comment on lines +11 to +47
},
"python.autoComplete.extraPaths": [
"/home/maninho/fbot_ws/install/fbot_head/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/install/robo_sentidos/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/build/my_py_pkg",
"/home/maninho/ros2_ws/install/my_py_pkg/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/build/meu_fsm_pkg",
"/home/maninho/ros2_ws/install/meu_fsm_pkg/lib/python3.10/site-packages",
"/home/maninho/fbot_ws/install/fbot_behavior/lib/python3.10/site-packages",
"/home/maninho/fbot_ws/install/fbot_agent_msgs/local/lib/python3.10/dist-packages",
"/home/maninho/fbot_ws/install/fbot_agent/lib/python3.10/site-packages",
"/opt/ros/humble/lib/python3.10/site-packages",
"/opt/ros/humble/local/lib/python3.10/dist-packages",
"",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory"
],
"python.analysis.extraPaths": [
"/home/maninho/fbot_ws/install/fbot_head/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/install/robo_sentidos/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/build/my_py_pkg",
"/home/maninho/ros2_ws/install/my_py_pkg/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/build/meu_fsm_pkg",
"/home/maninho/ros2_ws/install/meu_fsm_pkg/lib/python3.10/site-packages",
"/home/maninho/fbot_ws/install/fbot_behavior/lib/python3.10/site-packages",
"/home/maninho/fbot_ws/install/fbot_agent_msgs/local/lib/python3.10/dist-packages",
"/home/maninho/fbot_ws/install/fbot_agent/lib/python3.10/site-packages",
"/opt/ros/humble/lib/python3.10/site-packages",
"/opt/ros/humble/local/lib/python3.10/dist-packages",
"",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory"
]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This file should not be here

Suggested change
},
"python.autoComplete.extraPaths": [
"/home/maninho/fbot_ws/install/fbot_head/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/install/robo_sentidos/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/build/my_py_pkg",
"/home/maninho/ros2_ws/install/my_py_pkg/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/build/meu_fsm_pkg",
"/home/maninho/ros2_ws/install/meu_fsm_pkg/lib/python3.10/site-packages",
"/home/maninho/fbot_ws/install/fbot_behavior/lib/python3.10/site-packages",
"/home/maninho/fbot_ws/install/fbot_agent_msgs/local/lib/python3.10/dist-packages",
"/home/maninho/fbot_ws/install/fbot_agent/lib/python3.10/site-packages",
"/opt/ros/humble/lib/python3.10/site-packages",
"/opt/ros/humble/local/lib/python3.10/dist-packages",
"",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory"
],
"python.analysis.extraPaths": [
"/home/maninho/fbot_ws/install/fbot_head/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/install/robo_sentidos/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/build/my_py_pkg",
"/home/maninho/ros2_ws/install/my_py_pkg/lib/python3.10/site-packages",
"/home/maninho/ros2_ws/build/meu_fsm_pkg",
"/home/maninho/ros2_ws/install/meu_fsm_pkg/lib/python3.10/site-packages",
"/home/maninho/fbot_ws/install/fbot_behavior/lib/python3.10/site-packages",
"/home/maninho/fbot_ws/install/fbot_agent_msgs/local/lib/python3.10/dist-packages",
"/home/maninho/fbot_ws/install/fbot_agent/lib/python3.10/site-packages",
"/opt/ros/humble/lib/python3.10/site-packages",
"/opt/ros/humble/local/lib/python3.10/dist-packages",
"",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory",
"/opt/ros/humble/lib/yasmin_factory"
]
}

@@ -9,101 +9,95 @@
#define SERVOMAX 2500 // Maximum pulse width in microseconds

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

COmments in english

@maninhofurg

Copy link
Copy Markdown
Author

Hi @richassis, I've updated the PR with the requested changes:

  • Simplified motors.yaml by using only the blink angle keys. * Translated all new comments to English. * Removed the local .vscode/settings.json file. * Added a default_blink parameter to set the initial state. Thanks for the review!

@richassis
richassis self-requested a review August 19, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants