Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Control hub demo #83

Draft
wants to merge 162 commits into
base: feature/control-hub
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 158 commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
adf1a10
Create control hub module
LandryNorris May 24, 2023
f151799
Merge in main
LandryNorris May 25, 2023
aa4125d
Try to connect to control hub
LandryNorris May 25, 2023
c923422
Try to connect to control hub
LandryNorris May 25, 2023
4d227a2
Get module address of hub connected over wifi
LandryNorris May 25, 2023
f03cad7
Check version of RC app
LandryNorris May 25, 2023
eaa0ce6
Bump required RC version
LandryNorris May 25, 2023
3d48a61
Change how semver requirement is declated
LandryNorris May 25, 2023
5ce6863
Remove error output if no WiFi hub connected
LandryNorris May 25, 2023
2b4d5ee
merge main
LandryNorris May 26, 2023
c0cb9a4
Detect USB control hubs
LandryNorris May 26, 2023
ce97332
Fix connection to USB expansion hubs
LandryNorris May 26, 2023
b4de2a4
Add explicit dependency on control-hub
LandryNorris May 30, 2023
5ad4ef3
Restructure Control Hub module to export interface and implement with…
LandryNorris May 30, 2023
41ae6a3
Show serial number for parent expansion hub
LandryNorris May 30, 2023
27ffa13
Remove ParentControlHub, since control hubs will always be parents
LandryNorris May 30, 2023
a3712d3
Fix wording in package description
LandryNorris May 30, 2023
a91ee0f
Create core module
LandryNorris May 30, 2023
e8116ea
Move adbkit usage out of control hub module
LandryNorris May 30, 2023
f4a6585
Remove override of target
LandryNorris May 30, 2023
f4afa3c
Add note on dependencies in README
LandryNorris May 30, 2023
ab9b52a
loosen version requirement for get-port
LandryNorris May 30, 2023
ed8caaa
Send address in commands
LandryNorris Jun 5, 2023
15f626f
Send commands when control hub methods called
LandryNorris Jun 5, 2023
d8250ca
merge in main
LandryNorris Jun 8, 2023
ad4b33f
Use control hubs for commands and fix incorrect key
LandryNorris Jun 8, 2023
e659ed4
apply changes to be compatible with new manual control changes
LandryNorris Jun 8, 2023
b0ed49b
add timeout to control hub websocket commands
LandryNorris Jun 8, 2023
9999f8b
Add todo for closing (and resetting op mode) when websocket is closed
LandryNorris Jun 8, 2023
5463565
Track whether the control hub is connected
LandryNorris Jun 8, 2023
1598644
convert some methods to private
LandryNorris Jun 8, 2023
344acf7
remove logs
LandryNorris Jun 8, 2023
dae4912
update servo command
LandryNorris Jun 8, 2023
69d2a4a
make compatible with latest control hub changes
LandryNorris Jun 9, 2023
0b8ac61
use new id system for control hubs
LandryNorris Jun 9, 2023
eb7a35a
update to latest changes in control hub
LandryNorris Jun 9, 2023
1527056
Properly handle children hierarchy on Control Hub
LandryNorris Jun 15, 2023
a0f433e
connect to other expansion hubs
LandryNorris Jun 15, 2023
7dff8a2
Allow user to specify a hub connected to a control hub
LandryNorris Jun 15, 2023
a9394d0
allow user to specify just control hub
LandryNorris Jun 15, 2023
403a672
change names of some parameters
LandryNorris Jun 15, 2023
7ac2749
handle specified parent
LandryNorris Jun 16, 2023
fc2ef25
Update motor power range and document motor power method
LandryNorris May 16, 2023
ad2b3f5
Add sample for setting target position
LandryNorris May 16, 2023
314019e
Convert range of motor input to [-1,1]
LandryNorris May 17, 2023
49d08c1
Add documentation
LandryNorris May 17, 2023
397db54
Improve wording
LandryNorris May 22, 2023
464a6b6
Reqire motor parameter for running motors
LandryNorris May 22, 2023
b78b182
Create MotorMode enum
LandryNorris May 22, 2023
5bafeae
Add clarifying comment
LandryNorris May 22, 2023
a064659
Add motor commands
LandryNorris May 22, 2023
011722b
Change order of command declaration
LandryNorris May 24, 2023
3ddfe41
Document motor methods
LandryNorris May 30, 2023
223a201
Improve wording
LandryNorris May 30, 2023
1960f1d
Add documentation
LandryNorris May 30, 2023
8d89d03
Add motor command to get the current encoder position
LandryNorris May 31, 2023
5c1c347
Improve documentation
LandryNorris May 31, 2023
4c09961
Create motor encoder reset command
LandryNorris May 31, 2023
8d4e29e
move motor commands to 'command' folder for consistency
LandryNorris May 31, 2023
a76907e
Add continuous flag to motor encoder
LandryNorris May 31, 2023
11ac986
Publish
LandryNorris May 31, 2023
961dad4
Stop motors when sigint signal received
LandryNorris Jun 7, 2023
9808e64
Rename motor modes to be more clear
LandryNorris Jun 7, 2023
538e81e
Add motor position command
LandryNorris Jun 7, 2023
e5c59e3
Fix uninitialized motor error for position command
LandryNorris Jun 7, 2023
e85ae0b
Add documentation
LandryNorris Jun 7, 2023
1f65dcf
apply latest changes to control hub
LandryNorris Jun 9, 2023
aa5b93f
Convert to commands for sample
LandryNorris May 22, 2023
ca78fdc
Add documentation
LandryNorris May 18, 2023
d95b002
Document getDigitalAllInputs
LandryNorris May 22, 2023
660a0df
Fix missed merge conflict
LandryNorris May 22, 2023
f703a45
Create type for digital state
LandryNorris May 24, 2023
64b740a
Make High and Low readonly
LandryNorris May 24, 2023
949beb4
Create DigitalChannelDirection type
LandryNorris May 24, 2023
bac4567
Rename digital methods
LandryNorris May 24, 2023
aa4ad58
Error out if user provides anything other than high, low, 0, or 1
LandryNorris May 25, 2023
4c1d692
Set direction correctly for write
LandryNorris May 25, 2023
2c04732
Add continuous flag
LandryNorris May 25, 2023
5d25f1c
depend on specific version of expansion hub
LandryNorris Jun 7, 2023
cb0beb5
Add documentation
LandryNorris Jun 8, 2023
99a8f9d
Add module for distance sensor
LandryNorris May 17, 2023
058da2d
Fix a few bugs in distance sensor setup
LandryNorris May 17, 2023
1089257
Fix errors in setup. Sensor now runs continuously, but values not cor…
LandryNorris May 18, 2023
db87026
separate code into methods
LandryNorris May 18, 2023
22738b1
Get distance sensor working
LandryNorris May 18, 2023
31449cd
Increase duration of sample
LandryNorris May 18, 2023
8fcb1c7
Add note about close method
LandryNorris May 19, 2023
0f36047
Abstract away the driver, providing a lighter-weight DistanceSensor c…
LandryNorris May 19, 2023
09f27db
Create interface for distance sensor
LandryNorris May 19, 2023
6cd64b3
Add continuous flag to distance command
LandryNorris May 25, 2023
7a5cbeb
Update module description
LandryNorris Jun 7, 2023
9f79dca
depend on specific versions of other libraries
LandryNorris Jun 7, 2023
2fe4774
higher-level I2C methods
LandryNorris Jun 7, 2023
eee9bba
Add i2c methods for distance sensor
LandryNorris Jun 12, 2023
96316a7
update to work with latest control hub
LandryNorris Jun 13, 2023
21c56d7
pass in hub for servo command
LandryNorris Jun 13, 2023
12f920b
add bulk input command
LandryNorris Jun 14, 2023
fc8992b
refine LED commands
LandryNorris Jun 14, 2023
b6bfb6e
exit process when sigint
LandryNorris Jun 16, 2023
4a7dd7b
apply latest control hub changes
LandryNorris Jun 16, 2023
b3cf1d0
setup rollup
LandryNorris Jun 16, 2023
30f69c2
remove node-addon issues
LandryNorris Jun 16, 2023
1477ba3
always use control hub
LandryNorris Jun 16, 2023
9188411
Only allow Control Hub and its RS-485 children for demo purposes
NoahAndrews Jun 16, 2023
0caca2a
Update some field and command names
NoahAndrews Jun 17, 2023
2e8178c
Fix opening ExHubs connected to a CH via RS-485
NoahAndrews Jun 17, 2023
64e777e
Fix listing ExHubs connected to a CH via RS-485
NoahAndrews Jun 17, 2023
ab05dfe
Don't list the Control Hub as its own child
NoahAndrews Jun 17, 2023
37dfcdc
Fix motor in open loop mode connected to CH not stopping immediately
NoahAndrews Jun 17, 2023
f71f7b5
Fix motor in open loop mode connected to ExHub not stopping immediately
NoahAndrews Jun 17, 2023
92ef94a
Add bug report in TODO
NoahAndrews Jun 17, 2023
49534b8
Fix bulkInput command (old version was interpreted as needing an argu…
NoahAndrews Jun 17, 2023
8996933
Fix program name for demo
NoahAndrews Jun 17, 2023
0a96a07
Add missing space
NoahAndrews Jun 17, 2023
0d2d6b8
Improve name of 5V rail command
NoahAndrews Jun 17, 2023
46eb5dc
Fix TimeoutError when closing Control Hub
NoahAndrews Jun 17, 2023
f246567
Disable distance command for demo
NoahAndrews Jun 17, 2023
9330e33
require user to specify led pattern steps
LandryNorris Jun 20, 2023
4d24909
Fix distance command
LandryNorris Jun 20, 2023
cd6d1e7
Make bulk input continuous
LandryNorris Jun 20, 2023
e21fe2e
Add status updates
LandryNorris Jun 20, 2023
3efe80b
Add log hint command
LandryNorris Jun 21, 2023
73ff197
Add failsafe command
LandryNorris Jun 21, 2023
bfaaa7b
add query interface command
LandryNorris Jun 21, 2023
86c8d63
Add setHubAddress command and refactor how hubs get closed
LandryNorris Jun 21, 2023
df8bdd2
run servo before failsafe for testing
LandryNorris Jun 21, 2023
59611e9
Add version command
LandryNorris Jun 21, 2023
f706f14
return proper values for bulk input
LandryNorris Jun 21, 2023
1db5045
Add logs using getters
LandryNorris Jun 21, 2023
cd2149b
Add motor pid and alert commands
LandryNorris Jun 22, 2023
a4ebe01
Add getters to servo command
LandryNorris Jun 22, 2023
c1bd420
Add commands for rest of analog inputs
LandryNorris Jun 22, 2023
1b917be
Add commands for readall/writeall
LandryNorris Jun 22, 2023
1ddb59d
use LED getters in commands
LandryNorris Jun 22, 2023
7783da1
fix issues with status command
LandryNorris Jun 22, 2023
e49fdd8
Add debug level command
LandryNorris Jun 22, 2023
0b12fb6
Remove methods that don't make sense for control hub
LandryNorris Jun 22, 2023
e522190
fix bugs
LandryNorris Jun 22, 2023
37e7904
Parse readVersion
LandryNorris Jun 22, 2023
d21c1c9
rename ControlHubConnected
LandryNorris Jun 22, 2023
f1bff37
Add check for if a RevHub is a Control Hub
LandryNorris Jun 23, 2023
b391b5c
Clarify naming
LandryNorris Jun 23, 2023
8ce1f90
fix copy/paste problems
LandryNorris Jun 23, 2023
8ea5a8e
clarify valid values for loglevel
LandryNorris Jun 23, 2023
2623e81
Document valid values for level
LandryNorris Jun 23, 2023
82c4b23
merge in main
LandryNorris Jun 28, 2023
3af96cb
merge in main
LandryNorris Jun 28, 2023
aa036c3
merge in feature/control-hub
LandryNorris Jun 28, 2023
2b0d902
formatting in HubStringify and restore deleted method
LandryNorris Jun 28, 2023
90cd653
merge in main
LandryNorris Jun 28, 2023
15ba6d2
Don't add embedded as a child of control hub
LandryNorris Jun 29, 2023
73f497f
properly close control hub
LandryNorris Jun 29, 2023
b0a91ff
fixes for adding children
LandryNorris Jun 29, 2023
d2f44d6
update commands to match latest spec
LandryNorris Jun 29, 2023
dcade5c
merge in main
LandryNorris Jun 29, 2023
2f1b705
add IMU measurement
LandryNorris Jun 29, 2023
88bcfa3
merge in control hub branch
LandryNorris Aug 7, 2023
88c77b0
merge in control hub branch
LandryNorris Aug 9, 2023
cd1b443
Merge branch 'feature/control-hub' into control-hub-demo
LandryNorris Aug 10, 2023
acd1dcc
remove unused file
LandryNorris Aug 11, 2023
b5fc451
merge in control hub branch
LandryNorris Aug 11, 2023
bc1692d
merge in main
LandryNorris Aug 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions control-hub-cli.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

node.exe output.js %*
53 changes: 47 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
],
"devDependencies": {
"lerna": "^6.0.1",
"prettier": "2.8.8",
"nx": "^16.2.1"
"nx": "^16.2.1",
"prettier": "2.8.8"
},
"dependencies": {
"node-addon-api": "^7.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to reduce the occurance of errors saying that 'node-addon-api' is not installed when running 'npm install'.

}
}
22 changes: 22 additions & 0 deletions packages/control-hub/src/discovery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ControlHubInternal } from "./internal/ControlHub.js";
import { ControlHub, ExpansionHub } from "@rev-robotics/rev-hub-core";

export async function openConnectedControlHub(): Promise<ControlHub | undefined> {
try {
return await createWiFiControlHub();
} catch (e: any) {
return undefined;
}
}

async function createWiFiControlHub(): Promise<ControlHub> {
let hub = new ControlHubInternal("Placeholder");

if (!(await hub.isWiFiConnected())) {
throw new Error("Hub is not connected via WiFi");
}

await hub.open("192.168.42.1", 8080);

return hub;
}
Loading