{"id":28509835,"url":"https://github.com/gramaziokohler/clamp_controller","last_synced_at":"2025-07-03T01:31:11.444Z","repository":{"id":265345864,"uuid":"256270792","full_name":"gramaziokohler/clamp_controller","owner":"gramaziokohler","description":"High-level controller to monitor and command a network of distributed clamps.","archived":false,"fork":false,"pushed_at":"2022-06-24T13:19:56.000Z","size":8514,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-27T09:10:02.613Z","etag":null,"topics":["270","clamps","timber"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gramaziokohler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-16T16:31:15.000Z","updated_at":"2023-10-24T07:37:58.000Z","dependencies_parsed_at":"2024-11-29T02:23:29.419Z","dependency_job_id":"dbaba66b-31f6-489a-a837-7fcf3028c97c","html_url":"https://github.com/gramaziokohler/clamp_controller","commit_stats":null,"previous_names":["gramaziokohler/clamp_controller"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gramaziokohler/clamp_controller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramaziokohler%2Fclamp_controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramaziokohler%2Fclamp_controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramaziokohler%2Fclamp_controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramaziokohler%2Fclamp_controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gramaziokohler","download_url":"https://codeload.github.com/gramaziokohler/clamp_controller/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramaziokohler%2Fclamp_controller/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263243587,"owners_count":23436330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["270","clamps","timber"],"created_at":"2025-06-08T22:37:28.412Z","updated_at":"2025-07-03T01:31:11.434Z","avatar_url":"https://github.com/gramaziokohler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clamp_controller\nPython-based high-level controller to monitor and command a network of distributed clamps.\n\nThis repo is part of the [Robotic Assembled Timber Structures with Integral Timber Joints](https://github.com/gramaziokohler/integral_timber_joints) project.\n\n## Repo folder structure\n\n**/src/clamp_controller** - Contains all the import-able class and functions.\n\n**/src/controller_instances** - Contains instances of customized controllers for different projects.\n\n**/src/serial_radio_transport_driver** - A light weight library for transporting Serial Message to the [USB Dongle](https://github.com/gramaziokohler/clamp_electronics/blob/master/00_USBRadioDongle/00_USBRadioDongle.md), the message format is described in the [radio firmware](https://github.com/gramaziokohler/clamp_firmware/tree/master/serial_radio).\n\n## Design Goals\n\n**ClampModel**\n\nDigital twin of a clamp. Contains all the properties (e.g. step/mm conversion, soft limit, address) of a clamp and the telemetry reading.\n\nAlso contain functions to:\n\n- Decode received telemetry\n\n- Conversion between linear position and step position.\n\n**SerialCommander**\n\nThe main model of the application. Contains:\n\n- Instance of all available `ClampModel`\n- Instance of the `SerialPort` that connects to the USBRadioDongle\n- Instance of the `RosClampCommandListener` that connects to a ROS core via roslibpy\n\nFunctions to:\n\n- Accept high-level synchronized move command for multiple clamps.\n- Create low level move, home, speed-set and stop command.\n- Send low level command to clamp with resend-on-Nack option.\n\n**RosClampCommandListener**\n\nA class that maintains the connection with ROS via roslibpy and listens-for (and replies-to) commands received as a rostopic.\n\n**CommanderGUI**\n\nA long function that create the tkinter UI for monitoring and control. This UI\n\nAlternatively, it is possible to run the `SerialCommander` directly without UI, all the connections and settings can be accessed by code.\n\n**RemoteClampFunctionCall**\n\nA class for calling the clamp function from a remote process via roslibpy and ROS.\n\n## Installation\n\n1. Clone the [this repository](https://github.com/gramaziokohler/clamp_controller).\n2. Change directory `cd` to the local location of this repository.\n3. Activate your virtual environment (optional).\n4. Install the packages in the /src folder and the dependencies:\n\n```\npip install -r requirements-dev.txt\n```\n\n## Network Setup\n\nMultiple devices need to cooperate with each other during robotic execution. A number of networks are present to connect the devices to the control computer (which is my Laptop) running the Process Execution Controller. Below is a typical network configuration for the devices on the network.\n\n**Laptop (Ethernet Port)** - connection to RFL ethernet network (192.168.0.0/24 subnet)\n\n- Linux Virtual Machine running [ROS Master, ROS Bridge and ROS RRC_Driver](https://compas-rrc.github.io/compas_rrc/latest/reference/index.html) (192.168.0.117)\n- ABB Robot Controller running RRC\n- Routable Internet via ETH guest network\n\n**Laptop (Wireless Adapter)** - connection to ESP32 camera network (192.168.1.0/24 subnet)\n\n- 4 (or more) ESP32 cameras (192.168.1.100 to 192.168.1.103)\n\n**Laptop (USB COM Port)** - connection to USB Radio Dongle (proprietary network)\n\n- 4 Clamps (address 1-4)\n- 4 Screwdrivers (address 5-8)\n\n(there are alternative network setup possible, for example using USB-Ethernet Adapter for connecting to the Wireless AP)\n\n(the ROS instances can also be run from my Laptop's VMware Workstation Ubuntu 16 Virtual Machine bridged to the RFL network)\n\n## Usage\n\n### Controller with front end user interface:\n\n1. To start the controller UI. Change directory to where you want the log files to be placed.\n2. Run one of the controller UI instance, for example:\n\n```\ncd local_directory_for_log_files\npython local_path_to_repo\\src\\controller_instances\\08_TokyoCommander_UI+ROS.py\npython -m controller_instances.10_Commander4Clamps4Screws\n```\n\nUI like this should appear:\n\n![UI_Tokyo_JustStarted](doc/UI_Tokyo_JustStarted.jpg)\n\n### Remote calling clamp functions\n\nTo remotely call clamp functions from a separate python execution/process (e.g. [itj_process](https://github.com/gramaziokohler/itj_process) controllers), you need to import **RemoteClampFunctionCall**. The following things should be started before making calls:\n\n- ros and ros_bridge is started on the linux machine, for example: ` roslaunch rosbridge_server rosbridge_websocket.launch`\n- the calling machine and the ros machine is on the same local network.\n- a clamp_controller Controller Instance has started and is already connected to ROS\n\nExample code:\n\n```\n# Connect to ROS via roslibpy\n   hostip = '192.168.43.141'\n   clamps_connection = RemoteClampFunctionCall(hostip)\n\n# Command to send clamp to target (non-blocking)\n   clamps_connection.sendD(ROS_VEL_GOTO_COMMAND)\n# Command to send clamp to target (blocking)\n   success = clamps_connection.send_and_wait(ROS_VEL_GOTO_COMMAND, 1000)\n# Command to stop clamps (non-blocking)\nself.\n   clamps_connection.send(ROS_STOP_COMMAND(['1','2']))\n```\n\nRead the [RemoteClampFunctionCall.py](src\\clamp_controller\\RemoteClampFunctionCall.py) for available functions.\n\n\n\nAddresses\n-------------\n\nIn the latest use case, 4 Clamps and 4 Screwdrivers are used, also including 4 cameras on Clamps and 1 camera on Toolcanger. The addresses are as follows:\n\n| Type       | id   | radio address | camera address |\n| ---------- | ---- | ------------- | -------------- |\n| CL3        | c1   | 1             | 192.168.1.101  |\n| CL3        | c2   | 2             | 192.168.1.102  |\n| CL3M       | c3   | 3             | 192.168.1.103  |\n| CL3M       | c4   | 4             | 192.168.1.104  |\n| SL1        | s1   | 5             |                |\n| SL1        | s2   | 6             |                |\n| SL1        | s3   | 7             |                |\n| SL1_G200   | s4   | 8             |                |\n| TC4_Camera |      |               | 192.168.1.100  |\n\nCredits\n-------------\n\nThis repository was created by Pok Yin Victor Leung \u003cleung@arch.ethz.ch\u003e [@yck011522 ](https://github.com/yck011522) at [@gramaziokohler](https://github.com/gramaziokohler)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgramaziokohler%2Fclamp_controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgramaziokohler%2Fclamp_controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgramaziokohler%2Fclamp_controller/lists"}