Take a look in the testfiles for a specific implementation. Further examples can be found in iCub_simulator_tools->python_scripts
More examples can be found in the Examples folder. Basic examples presenting the usage of each part of the interface:
- perception: example_visual_perception, example_tactile_perception
- action: example_joint_position_control, example_forward_kinematics, example_inverse_kinematics
Non-gRPC version
from ANN_iCub_Interface.iCub import Joint_Reader, Joint_Writer, iCub_Interface, Visual_Reader, Skin_Reader, Kinematic_Reader
iCub = iCub_Interface.ANNiCub_wrapper()
...
jreader = Joint_Reader.PyJointReader()
jwriter = Joint_Writer.PyJointWriter()
sreader = Skin_Reader.PySkinReader()
visreader = Visual_Reader.PyVisualReader()
kinreader = Kinematic_Reader.PyKinematicReader()
...
jreader.init(iCub, name , ...)
jwriter.init(iCub, name , ...)
sreader.init(iCub, name , ...)
visreader.init(iCub, name, ...)
kinreader.init(iCub, name, ...)
...
jreader.method_name(...)
jwriter.method_name(...)
sreader.method_name(...)
visreader.method_name(...)
kinreader.method_name(...)
...
...
jreader.close(iCub)
jwriter.close(iCub)
sreader.close(iCub)
visreader.close(iCub)
kinreader.close(iCub)
gRPC version
import ANNarchy as ann
from ANN_iCub_Interface import __ann_compile_args__, __ann_extra_libs__
from ANN_iCub_Interface.iCub import Joint_Reader, Joint_Writer, iCub_Interface, Visual_Reader, Skin_Reader, Kinematic_Reader
from ANN_iCub_Interface.ANNarchy_Populations import JointReadout, JointControl, SkinPopulation, VisionPopulation, KinematicPopulation
pop_vis = VisionPopulation(geometry = (240, 320))
...
...
ann.compile(directory='annarchy', compiler_flags=__ann_compile_args__, extra_libs=__ann_extra_libs__)
pop_vis.connect()
...
iCub = iCub_Interface.ANNiCub_wrapper()
visreader = Visual_Reader.PyVisualReader()
...
visreader.init_grpc(iCub, "name", 'l', ip_address="0.0.0.0", port=pop_vis.port)
...
visreader.method_name(...)
...
...
visreader.close(iCub)