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

Icub dev #241

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5dca4e7
[TestMultiverse] Fix when multiverse is not found.
omareldardear Nov 19, 2024
6a15414
[adding iCub] first test for robot description
omareldardear Nov 21, 2024
c083502
[development] first valid test on icub (looking)
omareldardear Nov 26, 2024
0632c6c
[feature] icub processing module add move joints motion action
omareldardear Dec 3, 2024
be79bf2
[feature] first test icub on pybullet
omareldardear Dec 4, 2024
3a0f739
[iCub] (WIP) added update part to robot description.
omareldardear Dec 4, 2024
0a788fc
[iCub] updating robot description to include actuated joints
omareldardear Dec 4, 2024
316e7a1
[iCub] updating robot description to include fingers and left camera
omareldardear Dec 4, 2024
b0a980e
[iCub] radian angles - meshes scale - using default simulation method…
omareldardear Dec 5, 2024
6083ad7
[iCub] updating real robot states using yarp updater
omareldardear Dec 6, 2024
087d86d
[iCub] updating real robot states using yarp updater with fingers
omareldardear Dec 6, 2024
05d791c
[iCub] adding gripper close and open fuctionalities in both real and …
omareldardear Dec 9, 2024
8b305fb
Merge branch 'dev' of github.com:cram2/pycram into icub_dev
omareldardear Dec 9, 2024
be8500b
[iCub] rename test
omareldardear Dec 9, 2024
9b62853
clean up
omareldardear Dec 9, 2024
7ba39af
[iCub] adding failure and logging correctly
omareldardear Dec 10, 2024
13e8c5b
[iCub] minor refactoring
omareldardear Dec 11, 2024
9a3b7e3
[iCub] minor refactoring and documentation
omareldardear Dec 11, 2024
8124de0
Merge branch 'dev' into icub_dev
omareldardear Dec 11, 2024
ec1fdb5
[iCub] fix
omareldardear Dec 11, 2024
837e4aa
resolve conflicts
omareldardear Dec 11, 2024
abd246c
Merge remote-tracking branch 'original_pycram/dev' into icub_dev
omareldardear Dec 11, 2024
2a07761
[iCub] by pass yarp
omareldardear Dec 11, 2024
3da3b33
[iCub] minor structure and documentation changes
omareldardear Dec 11, 2024
949efc0
[iCub] minor fix
omareldardear Dec 11, 2024
c78f026
add icub demo
omareldardear Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
672 changes: 672 additions & 0 deletions demos/icub_real_demo.ipynb

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions launch/ik_and_description.launch
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
<param name="robot_description"
textfile="$(find pycram)/resources/robots/boxy.urdf"/>
</group>

<!-- iCub -->
<group if="$(eval robot == 'icub')">
<param name="robot_description"
textfile="$(find icub_model)/urdf/model.urdf"/>
</group>
<!-- Tiago -->
<group if="$(eval robot == 'tiago_dual')">
<param name="robot_description"
Expand Down
3,043 changes: 3,043 additions & 0 deletions resources/robots/icub.urdf

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions src/pycram/external_interfaces/yarp_networking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
from typing_extensions import Tuple,Optional

from pycram.ros.logging import logwarn

try:
import yarp
except ImportError:
logwarn("yarp wasn't found, please check the installation")

if yarp is not None:

ACK_VOCAB = yarp.createVocab32('a','c','k')
NO_ACK_VOCAB = yarp.createVocab32('n','a','c','k')


def init_yarp_network():
"""
Initializes the YARP network.

:param func: Function that should be thread safe
:return bool -> true if the YARP network is successfully initialized.
"""
if not yarp.Network.checkNetwork():
print("Unable to find a yarp server exiting ...")
return False

yarp.Network.init()
return True

def open_rpc_client_port(port_name:str)->Tuple[bool, Optional[yarp.RpcClient]]:
"""
Opens a YARP RpcClient port with the specified name.

:param `port_name` (str): The name of the RPC client port to be opened.
:return Tuple: (bool ( success/ fail ), yarp.RpcClient or None)
"""
handle_port: yarp.RpcClient = yarp.RpcClient()
if not handle_port.open(port_name):
print(f"Can't open the port %s correctly" % port_name)
return False , None
print(f"Port %s opened correctly" % port_name)
return True , handle_port

def open_buffered_bottle_port(port_name:str)->Tuple[bool, Optional[yarp.BufferedPortBottle]]:
"""
Opens a YARP BufferedPortBottle with the specified port name.

:param `port_name` (str): The name of the port to be opened.
:return Tuple: (bool ( success/ fail ), yarp.BufferedPortBottle or None)
"""
opened_port: yarp.BufferedPortBottle = yarp.BufferedPortBottle()
if not opened_port.open(port_name):
print(f"Can't open the port %s correctly" % port_name)
return False , None
print(f"Port %s opened correctly" % port_name)
return True , opened_port


def interrupt_and_close(m_module:yarp.RFModule):
"""
interrupt and close the module
:param m_module: yarp module
"""
m_module.interruptModule()
m_module.close()
print("iCub state updater closed")
11 changes: 11 additions & 0 deletions src/pycram/failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,14 @@ def __init__(self, link_name: str):
class LinkGeometryHasNoMesh(Exception):
def __init__(self, link_name: str, geometry_type: str):
super().__init__(f"Link {link_name} geometry with type {geometry_type} has no mesh.")


class YarpNetworkError(Exception):
def __init__(self):
super().__init__(f"Yarp Network Initialization Failed. Check if yarpserver is already up")


class RobotNotInitialized(Exception):
def __init__(self,robot_name: str):
super().__init__(f"Robot ({robot_name} not correctly initialized")

6 changes: 6 additions & 0 deletions src/pycram/process_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,3 +439,9 @@ def close(self) -> ProcessModule:
"""
raise NotImplementedError(
f"There are no Process Modules for '{inspect.currentframe().f_code.co_name}' for robot '{self.robot_name}'")

def exit(self)->None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The exit method for Process modules is a nice idea.
But the actual code to exit the connection to a robot should be directly in the Process module.
Please also add an exit method to the ProcessModule parent class and then call the currently loaded ProcessModule.exit method from this method

Copy link
Author

Choose a reason for hiding this comment

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

isn't this what i did ?
Would you explain more this part

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes what you did is correct, I was just confused about the structure of the ProcessModuleManager

"""
Exit process module and disconnect from robot
"""
pass
2 changes: 2 additions & 0 deletions src/pycram/process_modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
from .stretch_process_modules import StretchManager
from .robotiq_gripper_process_module import RobotiqManager
from .tiago_process_modules import TiagoManager
from .icub_process_modules import ICubManager

Pr2Manager()
BoxyManager()
DonbotManager()
HSRBManager()
DefaultManager()
StretchManager()
ICubManager()
TiagoManager()
RobotiqManager()
Loading
Loading