{"id":26866476,"url":"https://github.com/mtconnect/ros_bridge","last_synced_at":"2025-05-07T01:23:37.227Z","repository":{"id":5638882,"uuid":"6847265","full_name":"mtconnect/ros_bridge","owner":"mtconnect","description":"ROS Python Adapter and Ruby Robot Simulator","archived":false,"fork":false,"pushed_at":"2015-04-25T04:31:06.000Z","size":1891,"stargazers_count":9,"open_issues_count":8,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-31T04:54:37.898Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.ros.org/wiki/mtconnect","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtconnect.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-25T03:43:46.000Z","updated_at":"2025-01-29T10:41:33.000Z","dependencies_parsed_at":"2022-08-24T20:51:34.951Z","dependency_job_id":null,"html_url":"https://github.com/mtconnect/ros_bridge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtconnect%2Fros_bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtconnect%2Fros_bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtconnect%2Fros_bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtconnect%2Fros_bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtconnect","download_url":"https://codeload.github.com/mtconnect/ros_bridge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252794380,"owners_count":21805188,"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":[],"created_at":"2025-03-31T04:54:43.897Z","updated_at":"2025-05-07T01:23:37.169Z","avatar_url":"https://github.com/mtconnect.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Python Adapter for MTConnect C++ Agent\n-------\n\nThis is a simple adapter library written in Python to support the ROS\nrobotics integration project. The adapter supports multiple connections,\nheartbeats and the following MTConnect data item types:\n\n* Event  - A simple data item that usually contains with either a controlled\n           vocabulary like ControllerMode or Execution, or text like Program.\n\n* Sample - A numeric valued data item for values that are continuously changing\n           like position, angle, or temperatures\n\n* ThreeDSample - A sample that represents a three dimensional position like\n            a path position. The path is represented by a three space list or\n            tuple: (1.0, 2.0, 3.0)\n\n* Condition - A condition is a data item that describes the current normal, fault, or\n            warning state of a component for a certain type of problem. A warning is\n            a situation that may self correct, whereas a fault needs manual intervention.\n            Conditions assume a sweep of a set of error codes where the errors will be\n            checked each time the adapter polls. This is usually how most PLCs operate\n            and there is no specific message to say when an alarm becomes active or\n            clears. If there is an alarm messaging mechanism, use the SimpleCondition.\n            Conditions rely on a native code to distinguish themselves. Other systems\n            can be used, but this is the current assumption of the agent for its\n            condition management.\n\n* SimpleCondition - Similar to Condition, except that when the alarm is cleared, use\n            the remove method with the code.\n\n\nAdapter Creation\n------\n\nTo create an adapter, import the Adapter from the mtconnect_adapter and add\ndata items. You need to tell it what host and port it should bind to. The default\nport is 7878:\n\n    adapter = Adapter(('0.0.0.0', 7878))\n    di = Event('event_1')\n    adapter.add_data_item(di)\n    adapter.start()\n\nThis creates an adapter, adds an Event and then starts the adapter. To change\nvalues of the data item, you need to begin gathering data and then complete the\ndata gathering process to send all the data.\n\n    adapter.begin_gather()\n    di.set_value('hello')\n    adapter.complete_gather()\n\nWorking with conditions are very similar to the events:\n\n    c1 = SimpleCondition('c1')\n    adapter.add_data_item(c1)\n\n    ...\n\nAdd a fault\n\n    adapter.begin_gather()\n    c1.add('fault', 'A fault', '123')\n    adapter.complete_gather()\n\nAnd to clear the condition:\n\n    adapter.begin_gather()\n    c1.remove('123')\n    adapter.complete_gather()\n\nThere are two additional arguments that are options, qualifier and severity.\nThe qualifier represents extra information like HIGH or LOW and the severity\nis a native severity if available.\n\nThere are more examples in the simple_adapter.py.\n\nROS Example\n------\nThere is an example for the ROS turtlesim tutorial that subscribes to the ROS\nposes and then sends them to the MTConnect agent as PATH_POSITION data items. \nTo run the demo, install the turtlesim and then run the adapter: (this assumes\nthe python_adapter is cloned under ~/)\n\nInstall the turtle sim -- see ros wiki...\n\n    roscore\u0026\n    rosrun turtlesim turtlesim_node\n\nThere is an example for the ROS turtlesim tutorial that subscribes to the ROS\nposes and then sends them to the MTConnect agent as PATH_POSITION data items. \nTo run the demo, install the turtlesim and then run the adapter: (this assumes\nthe python_adapter is cloned under ~/)\n\n    cd ~/python_adapter/examples\n    python ros_adapter.py\n    \nNext, install the MTConnect agent in another directory:\n\n    cd ~\n    git clone http://github.com/mtconnect/cppagent.git\n    mkdir agent_build\n    cd agent_build\n    cmake ../cppagent\n    make\n    \nRun the agent:\n\n    cd ~/python_adapter/examples\n    ~/agent_build/agent/agent debug\n    \nNow your done, test the agent:\n\n    curl http://localhost:5000/current\n    \nYou should see an MTConnect streams document with Availabity AVAILABLE and a PathPosition for the Path.\n\nSimulator\n------\n\nThe simulator directory contains a ruby script to simulate the functionality of a \ncnc with minimal information only required for the Robot control. The simulator\nwill process the steps required by the CNC assuming there is a robot that can accept\nmaterial related requests. The states will be similar to the states in the \nBar Feeder project but adapted for to mimic a CNC cell. This technique can be \nused to simulate other MTConnect related devices as well.\n\nThe simulator acts as both an agent and an adapter monitoring an external device and\ntaking actions based on the state and commands. A commandline is also provided to \nallow for actions to be sent that are not initiated by an external device.\n\nRunning CNC Simulator\n------\n\nThe CNC simulator requires ruby 1.9.x and the statemachine gem. Install\nruby and the type\n\n    gem install statemachine\n\nOnce you have installed the ruby gem you can use a pre-compiled agent with\nthe agent.cfg file and the BothDevices.xml to represent a CNC and a robot.\nThere is a robot response file which just goes through a series of pre-canned\nactions and will drive some states on the simulator.\n\nTo run the CNC simulator, cd to the simulator directory and start the agent\n(assuming it is in the same simulator directory):\n\n    ./agent debug\n\nNext start the CNC simulator:\n\n    ruby cnc_simulator.rb\n\nYou will need to type the following commands to enable the cnc, the first puts\nit in automatic mode and the second enables the link:\n\n    auto\n    enable\n\nNext you will need to start the robot sim:\n\n    ruby robot.rb\n\nWithin five seconds give the following command to the CNC:\n\n    run\n\nThis process will be made simplier as the CNC becomes more complete. This is the\nfirst step to a fully functioning sim.\n\nLicense\n------\nCopyright 2012, System Insights, Inc.\nAll rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\nExternal Licenses\n-------\n\nWe have included the scanner.py module Copyright (c) 2011, Mark Watkinson.\nAdditional licensing and copyright information are in the file: src/scanner.py.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtconnect%2Fros_bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtconnect%2Fros_bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtconnect%2Fros_bridge/lists"}