Title: | YoctoPuce USB modules |
---|---|
Description: | Bridge between R and the yoctopuce Python library, making it possible to control and acquire data from YoctoPuce USB interface modules. |
Authors: | Pedro J. Aphalo [aut, cre] |
Maintainer: | Pedro J. Aphalo <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.1 |
Built: | 2024-12-01 05:25:39 UTC |
Source: | https://github.com/aphalo/yoctopuce |
Bridge between R and the yoctopuce Python library, making it possible to control and acquire data from YoctoPuce USB interface modules.
Package 'yoctopuce' provides wrapper functions that call functions in the 'yoctopuce' Python library through package 'reticulate'.
Maintainer: Pedro J. Aphalo [email protected] (ORCID)
The documentation of the 'yoctopuce' Python library is installed together with the library and also available on-line at https://www.yoctopuce.com/ under the Support menu.
Useful links:
Report bugs at https://github.com/aphalo/yoctopuce/issues
Import the API and USB-module-specific functions and register to communicate with USB modules through a virtual or physical hub.
init_yoctopuce(..., hub.url = "localhost:4444", force = FALSE) register_hubs(hub.url = "localhost:4444", force = FALSE)
init_yoctopuce(..., hub.url = "localhost:4444", force = FALSE) register_hubs(hub.url = "localhost:4444", force = FALSE)
... |
character Names of the yoctopuce Python modules to import from the 'yoctopuce' Python library supporting the functions in the USB modules that will be used. |
hub.url |
character vector of URLs to YoctoHubs, including the port on the hub to connect to, defaults to a virtual hub running locally, but hardware and virtual hubs can be accessed through a LAN or the internet. Passing 'NULL' or 'character()' skips hub registration. |
force |
logical Force registration even if the same URL has been already registered. |
This function is used to initialize the API and register to use one or more hubs.
The main API can be accessed through object yocto_api
using the
$
notation, and specific APIs using objects named after the APIs.
Beware that there is more than one level of nesting, so more than one '$' can
be needed. For example, for Python module 'yoctopuce.yocto_relay' the object
yocto_relay
is created and can be used to access its members.
This function uses the Python API to check that the requested API extensions are available, so it should work unchanged with future updates to the YoctoPuce Python library, including after new modules are released as long as the Python library installed is up-to-date.
Although the objects created to access Python library modules can persist from one R session to a later one, their link to the Python library is neither persistent nor restored. Thus, function 'init_yoctopuce()' has to be run at the start of each new R session, and Python modules reimported, even if the objects have been saved. In general it is recommended not to import the same Python modules more than once on a given session, although in practice this does not seem to cause difficulties with the 'yoctopuce' Python library.
Python must be installed before installing the library. You can use 'reticulate::install_python' to install Python. Python and the yoctopuce Python library need to be installed once, when first using R package 'yoctopuce'.
install_yoctopuce(..., envname = "r-yoctopuce")
install_yoctopuce(..., envname = "r-yoctopuce")
... |
additional libraries or named parameters to pass to 'reticulate::py_install'. |
envname |
character The name of a Python environment where to install the library. Not to be confused with R language environments! |