-
Notifications
You must be signed in to change notification settings - Fork 1
Update model #21
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
Open
MiriamCalafa
wants to merge
9
commits into
jazzy-devel-sygis
Choose a base branch
from
miriam-devel
base: jazzy-devel-sygis
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update model #21
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
76d0126
Merge pull request #20 from robotont/jazzy-devel-sygis
Veix123 56ebee5
metallic color for spacers and new wheels
20ea371
new wheel to motor adapter, encoder button, launch parameters color
10d7f07
OLED screen
f002204
colors parameter
73b94f6
fix scale
187fd9e
add color parameters with different formats
ea644f5
fix readme
45b48ea
typo
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| from ament_index_python.packages import get_package_share_path | ||
|
|
||
| from launch import LaunchDescription | ||
| from launch.actions import DeclareLaunchArgument, OpaqueFunction | ||
| from launch.substitutions import LaunchConfiguration, Command | ||
| from launch_ros.actions import Node | ||
| from launch_ros.parameter_descriptions import ParameterValue | ||
|
|
||
|
|
||
| def _rgba_string_from_user_value(user_value: str) -> str: | ||
| s = (user_value or "").strip() | ||
| if not s: | ||
| raise ValueError("Empty color string") | ||
|
|
||
| # RGBA numeric input (space or comma separated) | ||
| parts = s.replace(",", " ").split() | ||
| if len(parts) == 4: | ||
| nums = [float(p) for p in parts] | ||
| if any(v > 1.0 for v in nums): | ||
| nums = [v / 255.0 for v in nums] | ||
| nums = [min(1.0, max(0.0, v)) for v in nums] | ||
| return f"{nums[0]} {nums[1]} {nums[2]} {nums[3]}" | ||
|
|
||
| # Hex input | ||
| if s.startswith("#") and len(s) in (7, 9): | ||
| hexv = s[1:] | ||
| r = int(hexv[0:2], 16) | ||
| g = int(hexv[2:4], 16) | ||
| b = int(hexv[4:6], 16) | ||
| a = int(hexv[6:8], 16) if len(hexv) == 8 else 255 | ||
| return f"{r/255.0} {g/255.0} {b/255.0} {a/255.0}" | ||
|
|
||
| # Color names | ||
| name = s.lower().replace("_", "").replace("-", "") | ||
| try: | ||
| from PIL import ImageColor | ||
| r, g, b, a = ImageColor.getcolor(name, "RGBA") | ||
| return f"{r/255.0} {g/255.0} {b/255.0} {a/255.0}" | ||
| except Exception: | ||
| fallback = { | ||
| "lightblue": "0.16 0.65 0.98 1.0", | ||
| "blue": "0.00 0.35 0.90 1.0", | ||
| "yellow": "1.00 1.00 0.00 1.0", | ||
| "black": "0.10 0.10 0.10 1.0", | ||
| "purple": "0.45 0.20 0.65 1.0", | ||
| "gray": "0.75 0.75 0.75 1.0", | ||
| "darkgreen": "0.00 0.45 0.25 1.0", | ||
| "green": "0.00 0.80 0.30 1.0", | ||
| } | ||
| if name in fallback: | ||
| return fallback[name] | ||
| raise ValueError( | ||
| f"Unknown color '{user_value}'. Provide RGBA ('0 1 0 1' or '0 255 0 255'), " | ||
| f"hex ('#00ff00' or '#00ff00ff'), or install Pillow for CSS color names." | ||
| ) | ||
|
|
||
|
|
||
| def _setup(context, *args, **kwargs): | ||
| pkg = get_package_share_path("robotont_description") | ||
|
|
||
| model = LaunchConfiguration("model").perform(context).strip() | ||
| generation = LaunchConfiguration("generation").perform(context).strip() | ||
|
|
||
| primary_in = LaunchConfiguration("primary_color").perform(context) | ||
|
|
||
| if model: | ||
| robot_model_path = model | ||
| else: | ||
| if generation == "2.1": | ||
| robot_model_path = str(pkg / "urdf/gen2_1/robotont.urdf.xacro") | ||
| else: | ||
| # Default to gen3 | ||
| robot_model_path = str(pkg / "urdf/gen3/robotont.urdf.xacro") | ||
|
|
||
| primary_rgba = _rgba_string_from_user_value(primary_in) | ||
|
|
||
| robot_description = ParameterValue( | ||
| Command([ | ||
| "xacro ", robot_model_path, | ||
| ' main_color:="', primary_rgba, '"', | ||
| ]), | ||
| value_type=str, | ||
| ) | ||
|
|
||
| rsp = Node( | ||
| package="robot_state_publisher", | ||
| executable="robot_state_publisher", | ||
| parameters=[{"robot_description": robot_description}], | ||
| ) | ||
|
|
||
| jsp = Node( | ||
| package="joint_state_publisher", | ||
| executable="joint_state_publisher", | ||
| ) | ||
|
|
||
| rviz = Node( | ||
| package="rviz2", | ||
| executable="rviz2", | ||
| name="rviz2", | ||
| output="screen", | ||
| arguments=[ | ||
| "-d", LaunchConfiguration("rviz_config"), | ||
| "--fixed-frame", LaunchConfiguration("rviz_fixed_frame"), | ||
| ], | ||
| ) | ||
|
|
||
| return [jsp, rsp, rviz] | ||
|
|
||
|
|
||
| def generate_launch_description(): | ||
| pkg = get_package_share_path("robotont_description") | ||
| default_rviz_config_path = pkg / "config/robotont_description.rviz" | ||
|
|
||
| return LaunchDescription([ | ||
| DeclareLaunchArgument("model", default_value=""), | ||
| DeclareLaunchArgument("rviz_config", default_value=str(default_rviz_config_path)), | ||
| DeclareLaunchArgument("rviz_fixed_frame", default_value="base_link"), | ||
| DeclareLaunchArgument("generation", default_value="3"), | ||
|
|
||
| DeclareLaunchArgument("primary_color", default_value="0.16 0.65 0.98 1.0"), | ||
|
|
||
| OpaqueFunction(function=_setup), | ||
| ]) |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only base_link should be jointed to base_footprint. the spacers should never be jointed to base_footprint. the entire robot should be functional without base_footprint, which is only a virtual helper link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MiriamCalafa i now observe that this is something that is coming from work that was done before you but please try to to fix this. the general issue appears to be that in the file urdf/gen3/base.urdf.xacro the property base_elevation doesn't make sense as-is. i don't know where the origin of your frame_module_pla.STL is but most logical base_link origin location is either at the bottom of this link or in the middle of this link in the z-direction. ground clearance should not matter at all. we don't build a robot from the ground, we build it from its base_link. every link/component of the robot should either directly or via some other link be related to the base_link, and never to the base_footprint. the base_footprint defines where is the ground plane related to the robot's base_link. can you revisit the entire gen3/base.urdf.xacro file and fix geometrical relations than currently make use of this frame_elevation or frame_ground_clearance for no good reason.
it might turn our that the variable frame_elevation is completely useless and can be deleted.
here are some lines that need revising in my opinion but there might be others:
robotont_description/urdf/gen3/base.urdf.xacro
Line 17 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Line 22 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Line 34 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Line 57 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Lines 68 to 70 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Line 89 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Lines 108 to 109 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Line 131 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Line 153 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Line 175 in 45b48ea
robotont_description/urdf/gen3/base.urdf.xacro
Line 197 in 45b48ea