-
Notifications
You must be signed in to change notification settings - Fork 27
Add nextage model #616
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
Merged
Merged
Add nextage model #616
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7958ca4
Fix tile shape
Michi-Tsubaki 05d13b6
Add nextage robot model and interface
Michi-Tsubaki 72dbacb
Add nextage examples
Michi-Tsubaki 67d4334
Fix the url for nextage_description
Michi-Tsubaki b28edd6
Fix ruff linting errors
Michi-Tsubaki e6c4673
Fix endcoords and reset_pose
Michi-Tsubaki 707b3e6
Merge branch 'main' into add-nextage-model
iory 43f523d
Fixed end coords and batch_ik_demo's target
iory b661c14
Fix batch_ik_demo for Nextage robot
iory 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
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 |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| from skrobot._lazy_imports import LazyImportClass | ||
|
|
||
|
|
||
| NextageROSRobotInterface = LazyImportClass( | ||
| ".nextage", "NextageROSRobotInterface", "skrobot.interfaces.ros") | ||
| PandaROSRobotInterface = LazyImportClass( | ||
| ".panda", "PandaROSRobotInterface", "skrobot.interfaces.ros") | ||
| PR2ROSRobotInterface = LazyImportClass( | ||
| ".pr2", "PR2ROSRobotInterface", "skrobot.interfaces.ros") | ||
|
|
||
| __all__ = ["PandaROSRobotInterface", "PR2ROSRobotInterface"] | ||
| __all__ = ["NextageROSRobotInterface", "PandaROSRobotInterface", "PR2ROSRobotInterface"] |
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,59 @@ | ||
| import actionlib | ||
| import control_msgs.msg | ||
|
|
||
| from .base import ROSRobotInterfaceBase | ||
|
|
||
|
|
||
| class NextageROSRobotInterface(ROSRobotInterfaceBase): | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| super(NextageROSRobotInterface, self).__init__(*args, **kwargs) | ||
|
|
||
| self.rarm_move = actionlib.SimpleActionClient( | ||
| '/rarm_controller/follow_joint_trajectory_action', | ||
| control_msgs.msg.FollowJointTrajectoryAction | ||
| ) | ||
| self.rarm_move.wait_for_server() | ||
|
|
||
| self.larm_move = actionlib.SimpleActionClient( | ||
| '/larm_controller/follow_joint_trajectory_action', | ||
| control_msgs.msg.FollowJointTrajectoryAction | ||
| ) | ||
| self.larm_move.wait_for_server() | ||
|
|
||
| @property | ||
| def rarm_controller(self): | ||
| return dict( | ||
| controller_type='rarm_controller', | ||
| controller_action='/rarm_controller/follow_joint_trajectory_action', | ||
| controller_state='/rarm_controller/state', | ||
| action_type=control_msgs.msg.FollowJointTrajectoryAction, | ||
| joint_names=[j.name for j in self.robot.rarm.joint_list], | ||
| ) | ||
|
|
||
| @property | ||
| def larm_controller(self): | ||
| return dict( | ||
| controller_type='larm_controller', | ||
| controller_action='/larm_controller/follow_joint_trajectory_action', | ||
| controller_state='/larm_controller/state', | ||
| action_type=control_msgs.msg.FollowJointTrajectoryAction, | ||
| joint_names=[j.name for j in self.robot.larm.joint_list], | ||
| ) | ||
|
|
||
| def default_controller(self): | ||
| return [self.rarm_controller, self.larm_controller] | ||
|
|
||
| def move_arm(self, trajectory, arm='rarm', wait=True): | ||
| if arm == 'rarm': | ||
| self.send_trajectory(self.rarm_move, trajectory, wait) | ||
| elif arm == 'larm': | ||
| self.send_trajectory(self.larm_move, trajectory, wait) | ||
|
|
||
| def send_trajectory(self, client, trajectory, wait=True): | ||
| goal = control_msgs.msg.FollowJointTrajectoryGoal() | ||
| goal.trajectory = trajectory | ||
| if wait: | ||
| client.send_goal_and_wait(goal) | ||
| else: | ||
| client.send_goal(goal) |
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,80 @@ | ||
| from cached_property import cached_property | ||
|
|
||
| from ..data import nextage_urdfpath | ||
| from ..model import RobotModel | ||
| from .urdf import RobotModelFromURDF | ||
|
|
||
|
|
||
| class Nextage(RobotModelFromURDF): | ||
|
|
||
| """ | ||
| - Nextage Open Official Information. | ||
|
|
||
| https://nextage.kawadarobot.co.jp/open | ||
|
|
||
| - Nextage Open Robot Description | ||
|
|
||
| https://github.com/tork-a/rtmros_nextage/tree/indigo-devel/nextage_description/urdf | ||
| """ | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| super(Nextage, self).__init__(*args, **kwargs) | ||
| self.reset_pose() | ||
|
|
||
| @cached_property | ||
| def default_urdf_path(self): | ||
| return nextage_urdfpath() | ||
|
|
||
| def reset_pose(self): | ||
| import numpy as np | ||
| angle_vector = [ | ||
| 0.0, | ||
| -0.5, 0.0, np.deg2rad(-100), np.deg2rad(15.2), np.deg2rad(9.4), np.deg2rad(3.2), | ||
| 0.5, 0.0, np.deg2rad(-100), np.deg2rad(-15.2), np.deg2rad(9.4), np.deg2rad(-3.2), | ||
| 0.0, 0.0 | ||
| ] | ||
| self.angle_vector(angle_vector) | ||
| return self.angle_vector() | ||
|
|
||
| def reset_manip_pose(self): | ||
| """Reset robot to manipulation pose (same as reset_pose for Nextage)""" | ||
| return self.reset_pose() | ||
|
|
||
| @cached_property | ||
| def rarm(self): | ||
| link_names = ['RARM_JOINT{}_Link'.format(i) for i in range(6)] | ||
| links = [getattr(self, n) for n in link_names] | ||
| joints = [l.joint for l in links] | ||
| model = RobotModel(link_list=links, joint_list=joints) | ||
| model.end_coords = self.rarm_end_coords | ||
| return model | ||
|
|
||
| @cached_property | ||
| def larm(self): | ||
| link_names = ['LARM_JOINT{}_Link'.format(i) for i in range(6)] | ||
| links = [getattr(self, n) for n in link_names] | ||
| joints = [l.joint for l in links] | ||
| model = RobotModel(link_list=links, joint_list=joints) | ||
| model.end_coords = self.larm_end_coords | ||
| return model | ||
|
|
||
| @cached_property | ||
| def head(self): | ||
| link_names = ['HEAD_JOINT{}_Link'.format(i) for i in range(2)] | ||
| links = [getattr(self, n) for n in link_names] | ||
| joints = [l.joint for l in links] | ||
| model = RobotModel(link_list=links, joint_list=joints) | ||
| model.end_coords = self.head_end_coords | ||
| return model | ||
|
|
||
| @cached_property | ||
| def rarm_end_coords(self): | ||
| return self.RARM_JOINT5_Link | ||
|
|
||
| @cached_property | ||
| def larm_end_coords(self): | ||
| return self.LARM_JOINT5_Link | ||
|
|
||
| @cached_property | ||
| def head_end_coords(self): | ||
| return self.HEAD_JOINT1_Link |
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.
iory/scikit-robot-models#1
This PR is merged. Please fix the url.