Skip to content

Commit 8b8d20a

Browse files
committed
Added licicense.md
1 parent dd95c77 commit 8b8d20a

File tree

4 files changed

+114
-5
lines changed

4 files changed

+114
-5
lines changed

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Daniel Mascarenhas de Andrade
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,63 @@
1-
# octoROS
2-
Integration between OctoPrint and ROS
1+
# OctoROS
2+
This projects aims to be a bridge between 3d printers and ROS.
3+
It uses OctoPrint to control the printer, and get the info that is sent to ROS topics.
4+
5+
6+
## Getting Started
7+
8+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
9+
10+
### Prerequisites
11+
12+
First you'll need to install OctoPrint, the instructions are available at https://github.com/foosel/OctoPrint. But the easiest way that I see is with the following instructions
13+
14+
1. Checkout OctoPrint: ```$ git clone https://github.com/foosel/OctoPrint.git```
15+
2. Change into the OctoPrint folder: ```$ cd OctoPrint```
16+
3. Create a user-owned virtual environment therein: ```$ virtualenv venv```
17+
4. Install OctoPrint into that virtual environment: ```$ ./venv/bin/pip install .```
18+
5. After installing OctoPrint, you should run it using:```$ octoprint serve```
19+
6. Now you should verify your installation opening a web browser and going to http://localhost:5000
20+
7. If everything went right you should see the OctoPrint home screen
21+
22+
If the printer that you're using is a MakerBot, now it's time to install the GPX plug-in, that will enable us to to send gcode to octoprint, that will take care of the conversion to x3g. To that do the following:
23+
1. In the octoPrint home screen go to configurations/Plugin manager/Get More
24+
2. Search for GPX and click install
25+
3. Go to GPX settings and click enable GPX
26+
4. Choose your machine, gcode flavor and other settings
27+
28+
29+
### Installing
30+
31+
This project should be run from source, to do so just go to your ROS workspace and clone it with ```git clone https://github.com/ielson/octoROS.git```. After that you can't forget to make the file executable, or ROS won't find it.
32+
33+
### Usage
34+
To use it, you need to have your octoprint server running, have a model uploaded to it, and then run the octoROS.py file, changing the file name in the 59th line to the uploaded file name.
35+
36+
So it will start printing the model and outputting the progress and some printer measurements to the ```/printer3d``` ROS topic until finish printing. When it happens the file will send a boolean to ```printer3d/finishedPrinting```.
37+
38+
Example of usage:
39+
```
40+
$ roscore
41+
# in another terminal run
42+
$ rosrun octoROS octoROS.py
43+
44+
45+
```
46+
```
47+
Give an example
48+
```
49+
50+
51+
## Authors
52+
53+
* **Daniel Mascarenhas** - *Initial work* - [ielson](https://github.com/ielson)
54+
55+
See also the list of [contributors](https://github.com/ielson/octoROS/contributors) who participated in this project.
56+
57+
## License
58+
59+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
60+
61+
## Acknowledgments
62+
63+
Many thank to the octoprint team, that made this awesome software

src/messenger.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env python2.7
22

3+
""" octoROS - integrating octoprint with ROS, so it's possible to control your 3d printer from your robot
4+
This library is based in the octoprint api, more info can be found here:
5+
http://docs.octoprint.org/en/master/api/index.html
6+
"""
7+
8+
39
import requests
410

511
octoIP = "http://127.0.0.1"
@@ -9,14 +15,14 @@
915

1016
standardHeader = {'X-Api-Key': apiKey}
1117

12-
18+
# Connection handling
1319
def connectToPrinter():
1420
connectionData = {"command": "connect", "port": "/dev/ttyACM0", "baudrate": 115200, "printerProfile": "_default",
1521
"save": True, "autoconnect": True}
1622
return requests.post(_url("connection"), json=connectionData, headers=standardHeader, timeout=5)
1723

1824

19-
25+
# File operations
2026
def modelSelection():
2127
pass
2228

@@ -28,10 +34,30 @@ def printModel(modelName):
2834
return requests.post(url, json=printData, headers=standardHeader, timeout=5)
2935

3036

37+
# Job operations
3138
def progressTracking():
3239
response = requests.get(_url('job'), headers=standardHeader, timeout=5)
3340
return (response.json()['progress']['completion'])
3441

42+
def cancelPrinting():
43+
jsonData = {'command':'cancel'}
44+
return requests.post(_url('job'), headers=standardHeader, timeout=5, json=jsonData)
45+
46+
def pausePrinting():
47+
jsonData = {'command':'pause', 'action':'pause'}
48+
return requests.post(_url('job'), headers=standardHeader, timeout=5, json=jsonData)
49+
50+
def resumePrinting():
51+
jsonData = {'command':'pause', 'action':'resume'}
52+
return requests.post(_url('job'), headers=standardHeader, timeout=5, json=jsonData)
53+
54+
# Printer operations
55+
def getprinterInfo():
56+
response = requests.get(_url('printer'), headers=standardHeader, timeout=5)
57+
tool0Temp = response.json()['temperature']['tool0']['actual']
58+
tool1Temp = response.json()['temperature']['tool1']['actual']
59+
bedTemp = response.json()['temperature']['bed']['actual']
60+
return tool0Temp, tool1Temp, bedTemp
3561

3662

3763
def _url(path):

src/octoROS.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ def printAndGetStatus(self, modelName):
5353

5454

5555
def main(args):
56+
# Ros was not catching interrupt exceptions, so I had to disable signals and use the KeyboardInterrupt exception
5657
rospy.init_node('printerWatcher', anonymous=True, disable_signals=True)
5758
interf = interface()
58-
interf.printAndGetStatus('Teste.gcode')
59+
interf.printAndGetStatus('FlexiRexColor1.gcode')
5960

6061

6162
if __name__ == '__main__':

0 commit comments

Comments
 (0)