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

Bound values. #156

Closed
wants to merge 11 commits into from
Closed

Bound values. #156

wants to merge 11 commits into from

Conversation

glannuzel
Copy link
Member

Bound values for registers:

  • goal_position -> depending on joint_limit
  • torque_limit -> [0, 100]
  • speed_limit -> I choose values at the moment, I have no info

Note that joint_limit are given in degrees by the server for the moment, while goal_position and present_position are given in degrees. I think all values should be sent in radians by the server, that's why I converted values to degrees.

@glannuzel glannuzel linked an issue Jan 8, 2024 that may be closed by this pull request
@glannuzel glannuzel self-assigned this Jan 9, 2024
Copy link
Contributor

@FabienDanieau FabienDanieau left a comment

Choose a reason for hiding this comment

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

Minor comments. Merge back develop to get some unit tests and new features.
Try to remove as much Any type as possible. So mypy can work for us

@@ -394,6 +395,21 @@ def goto_joints(
response = self._goto_stub.GoToJoints(request)
return response

def _bound_goto_joints_values(self, positions: List[float], degrees: bool = True) -> List[float]:
if not degrees:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a description of the function to explain what is in degree and what's in radian

goal_position = Register(
readonly=False,
type=FloatValue,
label="goal_position",
conversion=(_to_internal_position, _to_position),
)

def __init__(self, initial_state: Dict[str, float], axis_type: str, actuator: Any) -> None:
def __init__(self, initial_state: Dict[str, Any], axis_type: str, actuator: Any) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the types are changed to Any? Can actuator be typed as well?

goal_position = Register(
readonly=False,
type=float,
label="goal_position",
conversion=(_to_internal_position, _to_position),
)

def __init__(self, initial_state: Dict[str, float], axis_type: str, actuator: Any) -> None:
def __init__(self, initial_state: Dict[str, Any], axis_type: str, actuator: Any) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment

new_value = max(self.lower_limit, min(self.upper_limit, value))
if new_value != value:
if self.cvt_to_external is not None:
print(
Copy link
Contributor

Choose a reason for hiding this comment

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

Merge back develop and use log system

Copy link

github-actions bot commented Jan 15, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1355 485 36% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/reachy2_sdk/arm.py 27% 🟢
src/reachy2_sdk/orbita2d.py 19% 🟢
src/reachy2_sdk/orbita3d.py 19% 🟢
src/reachy2_sdk/orbita_utils.py 43% 🟢
src/reachy2_sdk/register.py 33% 🟢
TOTAL 28% 🟢

updated for commit: 6d6c39b by action🐍

@glannuzel glannuzel closed this Apr 22, 2024
@glannuzel glannuzel deleted the 155-bound-values-in-client branch April 22, 2024 12:09
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.

Bound values in client
2 participants