apirrone commited on
Commit
4df0c4f
·
1 Parent(s): 10574ef
.gitignore CHANGED
@@ -1 +1,2 @@
1
- __pycache__/
 
 
1
+ __pycache__/
2
+ *.egg-info/
reachy_mini_clock.egg-info/PKG-INFO DELETED
@@ -1,19 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: reachy_mini_clock
3
- Version: 0.1.0
4
- Summary: Add your description here
5
- Keywords: reachy-mini-app
6
- Requires-Python: >=3.10
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: reachy-mini
9
-
10
- ---
11
- title: Reachy Mini Clock
12
- emoji: 👋
13
- colorFrom: red
14
- colorTo: blue
15
- sdk: static
16
- pinned: false
17
- tags:
18
- - reachy_mini
19
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
reachy_mini_clock.egg-info/SOURCES.txt DELETED
@@ -1,10 +0,0 @@
1
- README.md
2
- pyproject.toml
3
- reachy_mini_clock/__init__.py
4
- reachy_mini_clock/main.py
5
- reachy_mini_clock.egg-info/PKG-INFO
6
- reachy_mini_clock.egg-info/SOURCES.txt
7
- reachy_mini_clock.egg-info/dependency_links.txt
8
- reachy_mini_clock.egg-info/entry_points.txt
9
- reachy_mini_clock.egg-info/requires.txt
10
- reachy_mini_clock.egg-info/top_level.txt
 
 
 
 
 
 
 
 
 
 
 
reachy_mini_clock.egg-info/dependency_links.txt DELETED
@@ -1 +0,0 @@
1
-
 
 
reachy_mini_clock.egg-info/entry_points.txt DELETED
@@ -1,2 +0,0 @@
1
- [reachy_mini_apps]
2
- reachy_mini_clock = reachy_mini_clock.main:ReachyMiniClock
 
 
 
reachy_mini_clock.egg-info/requires.txt DELETED
@@ -1 +0,0 @@
1
- reachy-mini
 
 
reachy_mini_clock.egg-info/top_level.txt DELETED
@@ -1 +0,0 @@
1
- reachy_mini_clock
 
 
reachy_mini_clock/main.py CHANGED
@@ -96,6 +96,8 @@ def is_close(a: float, b: float, tol: float = 0.2) -> bool:
96
 
97
  def apply_time_to_antennas(reachy_mini: ReachyMini, hour: int, minute: int):
98
  # Example: map hour/minute to antenna positions
 
 
99
  hour_angle = (hour % 12) / 12.0 # 0.0 to 1.0
100
  minute_angle = minute / 60.0 # 0.0 to 1.0
101
 
@@ -103,8 +105,14 @@ def apply_time_to_antennas(reachy_mini: ReachyMini, hour: int, minute: int):
103
  target_minute_angle = minute_angle * 2 * np.pi
104
  target_hour_angle = hour_angle * 2 * np.pi + (minute_angle * 2 * np.pi) / 12.0
105
 
 
 
 
 
 
106
  _, (current_hour, current_minute) = reachy_mini.get_current_joint_positions()
107
 
 
108
  if is_close(current_hour, target_hour_angle) and is_close(
109
  current_minute, target_minute_angle
110
  ):
 
96
 
97
  def apply_time_to_antennas(reachy_mini: ReachyMini, hour: int, minute: int):
98
  # Example: map hour/minute to antenna positions
99
+
100
+ print("raw", hour, minute)
101
  hour_angle = (hour % 12) / 12.0 # 0.0 to 1.0
102
  minute_angle = minute / 60.0 # 0.0 to 1.0
103
 
 
105
  target_minute_angle = minute_angle * 2 * np.pi
106
  target_hour_angle = hour_angle * 2 * np.pi + (minute_angle * 2 * np.pi) / 12.0
107
 
108
+ if target_minute_angle > np.pi:
109
+ target_minute_angle -= 2 * np.pi
110
+ if target_hour_angle > np.pi:
111
+ target_hour_angle -= 2 * np.pi
112
+
113
  _, (current_hour, current_minute) = reachy_mini.get_current_joint_positions()
114
 
115
+ print(np.rad2deg(target_hour_angle), np.rad2deg(target_minute_angle))
116
  if is_close(current_hour, target_hour_angle) and is_close(
117
  current_minute, target_minute_angle
118
  ):