Develop/blinks - #5
Conversation
richassis
left a comment
There was a problem hiding this comment.
Nice job! Requesting some changes and some improvements suggestions.
| blink_left: true | ||
| blink_closed_angle: 140 # Novo: Ângulo para fechar no piscar |
There was a problem hiding this comment.
The key for identifying it as a blinking motor is unnecessary. Keep only one key with the angle value.
Here is my suggestion:
| blink_left: true | |
| blink_closed_angle: 140 # Novo: Ângulo para fechar no piscar | |
| blink_left_angle: 140 #New angle for blinking |
| blink_right: true | ||
| blink_closed_angle: 35 # Novo: Ângulo para fechar no piscar |
There was a problem hiding this comment.
The key for identifying it as a blinking motor is unnecessary. Keep only one key with the angle value. Here is my suggestion:
| 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 |
There was a problem hiding this comment.
Comments on code should be in English
| @@ -35,28 +36,67 @@ def __init__(self, pause=False): | |||
|
|
|||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
|
|
||
| time.sleep(2) | ||
|
|
||
| # ADICIONADO: CALLBACK DO NOVO SERVIÇO (CMD 3) |
| motors_pins: dict = { | ||
| "cmd": 1 | ||
| "cmd": 1, | ||
| "blink_cfg": {} # Novo sub-dicionário para parâmetros de piscagem |
|
|
||
| motors_pins[motor] = self.get_parameter(motor+'.pin').value | ||
|
|
||
| # Verifica se é uma pálpebra configurada para piscar (Busca dinamicamente no YAML) |
| self.declare_parameter(motor+'.'+param, value) | ||
|
|
||
| for motor, params in config.items(): | ||
| # Itera sobre cada sub-item do motor (pin, blink_left, etc) |
| }, | ||
| "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" | ||
| ] |
There was a problem hiding this comment.
This file should not be here
| }, | |
| "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 | |||
|
Hi @richassis, I've updated the PR with the requested changes:
|
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}"