Replies: 3 comments 3 replies
-
See responses inline. I skipped the ones where I think what you are saying is a statement that I agree with.
For processes, not currently. For modules, these can either be configured via Viam configuration for that resource or env variables can be configured as documented here (https://docs.viam.com/registry/configure/#use-environment-variables-with-a-registry-module).
I am not sure I have a specific answer other than to leverage language-specific features like stack traces. If you have a specific example of where you've had issues with debugging let me know and we can try to find solutions together.
Yes, for now. We've discussed adding a product feature to make this easier for any resource. Now that you know our Jira is public, feel free to open a ticket (or I can, but we do want user feedback directly and that's one reason we have a public Jira!)
Check out the example here of using a venv and only doing the install once: https://github.com/viam-labs/detection-dock/blob/main/run.sh This works well with modules since a new version install would wipe out the directory thus triggering a new install. With processes, you'd need to manually delete the .installed file if there were new deps/a new version of the script.
Noted! Again, feel free to open a Jira ticket or let me know and I can.
This works with modules, I don't think processes have lifecycle methods like this. You could use signal handlers: https://www.instructables.com/Learn-How-to-Capture-and-Handle-OS-Signals-Like-SI/ I believe most of what you're looking to build is reusable code, can you give me a few examples of code you'd choose to use processes over modules for? I think these use cases would be interesting for our product team as well. |
Beta Was this translation helpful? Give feedback.
-
The only use case I have for a process at the moment is the execution of the The goal is that when the server starts/stops the robot starts/stops, so that I don't need to configure that manually on the board. That combined with the self-contained architecture of the viam modules should make things a lot cleaner and easier to configure & customise. I think the next step for me is to see what I can use from the registry in place of the current resources in this framework, then create Viam modules for the resources that don't currently exist. It will take a while but I'll tag you with questions (and the occasional code review to make sure i'm on the right track) as I go if that works for you. If you have any suggestions for modules to replace the current list we discussed in #72 feel free to send over some links. Thanks! Edit: adding tag - @mcvella |
Beta Was this translation helpful? Give feedback.
-
Another thing I forgot - do you have examples of how to add controls to a module? I saw a few pages about using the control tab but I may have missed docs around building the controls themselves. |
Beta Was this translation helpful? Give feedback.
-
As part of the development process, we would usually expect to be able to iterate and test code quickly on the Pi platform as dependencies exist there that do not on other platforms like Ubuntu.
The use of Mutagen.io allows us to sync code from a local development environment to the Pi filesystem, and then we can use the Viam server to connect and configure the robot over the web. (SSH and VNC are also an option, but not preferred).
Viam Processes can be created to execute code when the Viam server starts, and can reference modules.
For reusable code, Viam Modules can be created and either configured locally or released on the Viam Registry.
I am looking to get a better understanding of the development process using Viam. Below are my assumptions and questions:
Code sample
tab can be used as a template.Code sample
adapts based on the configuration of your robot to include examples of using modules you have configuredapi_key
,api_key_id
and theRobotClient.ataddress()
first argument.os.getenv
(for examplerobot_api_key = os.getenv('ROBOT_API_KEY') or ''
. We understand that these should be set as shown, is there a simpler approach if the server and script are on the same device?asyncio
. It is an assumption that this is a preferred approach to allow concurrent execution of modules.from viam.logging import getLogger
module and this will surface output to theLogs
tab. What other approaches are recommended to debug when a log output does not explain the cause of the issue?main.py
file is used, we can configure this as a Viam Process. This will then run whenever the Viam Server executes and will restart if it fails. If any changes are made we can either restart the Viam server via the UI (or command line), or kill the specific process on the device, in which case Viam server will restart it. Is this the recommended approach to testing small changes to the code?viam:camera:csi-pi
module outputs a lot of errors to the log that are warnings from the library, it would be good to ignore these.__del__()
handlers to deconstruct any instances and reset hardware to the initial configuration (as required).@mcvella a bit of a brain dump this time, but hopefully helpful to clarify assumptions if you wouldn't mind reviewing. Don't worry about responding to each point, if the assumption is correct it can be ignored. There are some questions peppered in there too.
I'll do another for module specific questions, I need to refresh my memory.
Beta Was this translation helpful? Give feedback.
All reactions