File tree Expand file tree Collapse file tree 2 files changed +43
-3
lines changed
Expand file tree Collapse file tree 2 files changed +43
-3
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+
4+
5+ import matplotlib .pyplot as plt
6+ import numpy as np
7+ import practable
8+
9+ messages = []
10+
11+ #modify with actual group code and experiment name
12+ with Experiment ('g-open-xxxxx' ,'Spinner 51' , exact = True ) as expt :
13+
14+ # Command a step of 2 radians & collect the data
15+ expt .command ('{"set":"mode","to":"stop"}' )
16+ expt .command ('{"set":"mode","to":"position"}' )
17+ expt .command ('{"set":"parameters","kp":1,"ki":0,"kd":0}' )
18+
19+ time .sleep (0.5 )
20+
21+ expt .command ('{"set":"position","to":2}' )
22+
23+ expt .ignore (0.5 )
24+ messages = expt .collect (1.5 )
25+
26+ # Process the data
27+ ts = expt .extract_series (messages , "t" )
28+ ds = expt .extract_series (messages , "d" )
29+ cs = expt .extract_series (messages , "c" )
30+
31+ t = np .array (ts )
32+ t = t - t [0 ]
33+
34+ # Plot the data
35+ plt .figure ()
36+ plt .plot (t / 1e3 ,ds ,'-b' ,label = "position" )
37+ plt .plot (t / 1e3 ,cs ,':r' ,label = "set point" )
38+ plt .xlabel ("time(s)" )
39+ plt .ylabel ("position(rad)" )
40+ plt .legend ()
Original file line number Diff line number Diff line change @@ -4,19 +4,19 @@ build-backend = "hatchling.build"
44
55[project ]
66name = " practable"
7- version = " 0.0.10 "
7+ version = " 0.0.11 "
88authors = [
99 { name =" Timothy Drysdale" , email =" timothy.d.drysdale@gmail.com" },
1010]
1111description = " Connect to remote laboratory experiments hosted on a github.com/practable service"
1212readme = " README.md"
1313dependencies = [
14- " numpy>=2.0 " ,
14+ " numpy>=1.10 " ,
1515 " platformdirs>=4.2" ,
1616 " requests>=2.32" ,
1717 " websockets>=12.0" ,
1818]
19- requires-python = " >=3.10 "
19+ requires-python = " >=3.8 "
2020classifiers = [
2121 " Programming Language :: Python :: 3" ,
2222 " License :: OSI Approved :: GNU Affero General Public License v3" ,
You can’t perform that action at this time.
0 commit comments