Skip to content

Commit

Permalink
Merge pull request #331 from rapyuta-robotics/devel
Browse files Browse the repository at this point in the history
🎉 release: v7.6.0
  • Loading branch information
pallabpain authored Jul 4, 2024
2 parents 138ecbc + a3ac73d commit 9f7900f
Show file tree
Hide file tree
Showing 35 changed files with 1,731 additions and 90 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ graphlib-backport = ">=1.0.3"
jinja2 = ">=3.0.1"
munch = ">=2.4.0"
pyyaml = ">=5.4.1"
rapyuta-io = ">=1.15.1"
rapyuta-io = ">=1.16.0"
tabulate = ">=0.8.0"
pyrfc3339 = ">=1.1"
directory-tree = ">=0.0.3.1"
Expand Down
71 changes: 37 additions & 34 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions docs/source/hwil.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Hardware-in-Loop
================

.. toctree::
:maxdepth: 3
:caption: Contents:

.. click:: riocli.hwil:hwildevice
:prog: rio hwil
:nested: full
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Rapyuta CLI has commands for all rapyuta.io resources. You can read more about t
Deployment <deployment>
Device <device>
Disk <disk>
Hardware-in-Loop <hwil>
ManagedService <managedservice>
Network <network>
Organization <organization>
Expand Down
38 changes: 37 additions & 1 deletion riocli/apply/manifests/device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ metadata:
name: "device-docker" # Required
project: "project-guid"
labels:
custom_label_1: label1
custom_label_2: label2
custom_label_3: label3
app: test
spec:
python: "3"
rosDistro: "melodic" # Options: ["kinetic", "melodic" (default), "noetic"]
docker:
enabled: True # Required
rosbagMountPath: "/opt/rapyuta/volumes/rosbag"
configVariables:
custom_config_variable_1: value1
custom_config_variable_2: value2

---
apiVersion: "apiextensions.rapyuta.io/v1"
kind: "Device"
Expand Down Expand Up @@ -42,4 +49,33 @@ spec:
rosbagMountPath: "/opt/rapyuta/volumes/rosbag"
preinstalled:
enabled: True
catkinWorkspace: "/home/rapyuta/catkin_ws"
catkinWorkspace: "/home/rapyuta/catkin_ws"

---
apiVersion: "apiextensions.rapyuta.io/v1"
kind: "Device"
metadata:
name: "virtual-device-docker" # Required
project: "project-guid"
labels:
custom_label_1: label1
custom_label_2: label2
custom_label_3: label3
app: test
spec:
python: "3"
rosDistro: "melodic" # Options: ["kinetic", "melodic" (default), "noetic"]
virtual:
enabled: True # Required
product: "sootballs" # Required Options: ["sootballs", "flaptter", "oks"]
arch: "amd64" # Options: ["amd64" (default), "arm64" ]
os: "ubuntu" # Options: ["ubuntu" (default), "debian" ]
codename: "focal" # Options: ["bionic", "focal" (default), "jammy", "bullseye"]
highperf: False # Optional [True, False (default)]
docker:
enabled: True # Required
rosbagMountPath: "/opt/rapyuta/volumes/rosbag"
configVariables:
custom_config_variable_1: value1
custom_config_variable_2: value2

2 changes: 2 additions & 0 deletions riocli/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from riocli.completion import completion
from riocli.config import Configuration
from riocli.configtree import config_trees
from riocli.hwil import hwildevice
from riocli.constants import Colors, Symbols
from riocli.deployment import deployment
from riocli.device import device
Expand Down Expand Up @@ -138,3 +139,4 @@ def update(silent: bool) -> None:
cli.add_command(vpn)
cli.add_command(usergroup)
cli.add_command(config_trees)
cli.add_command(hwildevice)
7 changes: 7 additions & 0 deletions riocli/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ def new_v2_client(config_inst: Configuration = None, with_project: bool = True):
return config_inst.new_v2_client(with_project=with_project)


def new_hwil_client(config_inst: Configuration = None):
if not config_inst:
config_inst = Configuration()

return config_inst.new_hwil_client()


def get_config_from_context(ctx: click.Context) -> Configuration:
config_obj = ctx.obj

Expand Down
25 changes: 23 additions & 2 deletions riocli/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from click import get_app_dir
from rapyuta_io import Client

from riocli.exceptions import LoggedOut, NoOrganizationSelected, NoProjectSelected
from riocli.exceptions import LoggedOut, NoOrganizationSelected, NoProjectSelected, HwilLoggedOut
from riocli.hwilclient import Client as HwilClient
from riocli.v2client import Client as v2Client


Expand All @@ -43,12 +44,13 @@ class Configuration(object):
"""
APP_NAME = 'rio-cli'
PIPING_SERVER = 'https://piping-server-v0-rapyuta-infra.apps.okd4v2.okd4beta.rapyuta.io'
DIFF_TOOL = 'diff'
MERGE_TOOL = 'vimdiff'

def __init__(self, filepath: Optional[str] = None):
self._filepath = filepath
self.exists = True


# If config file does not exist, then initialize an empty dictionary instead.
if not os.path.exists(self.filepath):
self.exists = False
Expand Down Expand Up @@ -109,6 +111,17 @@ def new_v2_client(self: Configuration, with_project: bool = True) -> v2Client:

return v2Client(self, auth_token=token, project=project)

def new_hwil_client(self: Configuration) -> HwilClient:
if 'hwil_auth_token' not in self.data:
raise HwilLoggedOut

if 'environment' in self.data:
os.environ['RIO_CONFIG'] = self.filepath

token = self.data.get('hwil_auth_token', None)

return HwilClient(auth_token=token)

def get_auth_header(self: Configuration) -> dict:
if not ('auth_token' in self.data and 'project_id' in self.data):
raise LoggedOut
Expand Down Expand Up @@ -155,6 +168,14 @@ def organization_guid(self: Configuration) -> str:
def piping_server(self: Configuration):
return self.data.get('piping_server', self.PIPING_SERVER)

@property
def diff_tool(self: Configuration):
return self.data.get('diff_tool', self.DIFF_TOOL)

@property
def merge_tool(self: Configuration):
return self.data.get('merge_tool', self.MERGE_TOOL)

@property
def machine_id(self: Configuration):
if 'machine_id' not in self.data:
Expand Down
6 changes: 6 additions & 0 deletions riocli/configtree/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import click
from click_help_colors import HelpColorsGroup

from riocli.configtree.diff import diff_revisions
from riocli.configtree.export_keys import export_keys
from riocli.configtree.merge import merge_revisions
from riocli.configtree.revision import revision
from riocli.configtree.tree import clone_tree, create_config_tree, delete_config_tree, list_config_tree_keys, list_config_trees, list_tree_revisions, set_tree_revision
from riocli.configtree.import_keys import import_keys
Expand All @@ -39,6 +42,9 @@ def config_trees() -> None:
config_trees.add_command(list_config_tree_keys)
config_trees.add_command(clone_tree)
config_trees.add_command(import_keys)
config_trees.add_command(export_keys)
config_trees.add_command(set_tree_revision)
config_trees.add_command(list_tree_revisions)
config_trees.add_command(revision)
config_trees.add_command(diff_revisions)
config_trees.add_command(merge_revisions)
Loading

0 comments on commit 9f7900f

Please sign in to comment.