nova-control-command 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -71,10 +71,10 @@ In script and REPL mode the serial connection is opened once on the first servo
71
71
  ### `home`
72
72
 
73
73
  ```
74
- nova-control --port <path> home
74
+ nova-control --port <path> home [--within-ms <ms>]
75
75
  ```
76
76
 
77
- Sends all five servos to their home positions simultaneously. Home positions are baked into the firmware (`s1=90°`, `s2=90°`, `s3=110°`, `s4=90°`, `s5=95°`).
77
+ Sends all five servos to their home positions simultaneously. Home positions are baked into the firmware (`s1=90°`, `s2=90°`, `s3=110°`, `s4=90°`, `s5=95°`). With `--within-ms`, uses a trapezoidal ramp-up/ramp-down profile to complete the movement in the specified number of milliseconds.
78
78
 
79
79
  ---
80
80
 
@@ -83,14 +83,14 @@ Sends all five servos to their home positions simultaneously. Home positions are
83
83
  Each command sets exactly one servo and leaves all others at their last-sent positions.
84
84
 
85
85
  ```
86
- nova-control --port <path> shift-to <deg> # head forward (>90°) or back (<90°) — s1
87
- nova-control --port <path> roll-to <deg> # head clockwise (>90°) or counter-clockwise (<90°) — s2
88
- nova-control --port <path> pitch-to <deg> # head up (>110°) or down (<110°) — s3
89
- nova-control --port <path> rotate-to <deg> # body rotation around Z-axis — s4
90
- nova-control --port <path> lift-to <deg> # secondary head lift, range 20°–150° — s5
86
+ nova-control --port <path> shift-to <deg> [--within-ms <ms>] # head forward (>90°) or back (<90°) — s1
87
+ nova-control --port <path> roll-to <deg> [--within-ms <ms>] # head clockwise (>90°) or counter-clockwise (<90°) — s2
88
+ nova-control --port <path> pitch-to <deg> [--within-ms <ms>] # head up (>110°) or down (<110°) — s3
89
+ nova-control --port <path> rotate-to <deg> [--within-ms <ms>] # body rotation around Z-axis — s4
90
+ nova-control --port <path> lift-to <deg> [--within-ms <ms>] # secondary head lift, range 20°–150° — s5
91
91
  ```
92
92
 
93
- `<deg>` is a number in degrees. The firmware clamps out-of-range values silently.
93
+ `<deg>` is a number in degrees. The firmware clamps out-of-range values silently. With `--within-ms`, uses a trapezoidal ramp-up/ramp-down profile to complete the movement in the specified number of milliseconds.
94
94
 
95
95
  ---
96
96
 
@@ -98,10 +98,10 @@ nova-control --port <path> lift-to <deg> # secondary head lift, range 20°
98
98
 
99
99
  ```
100
100
  nova-control --port <path> move [--shift-to <deg>] [--roll-to <deg>] [--pitch-to <deg>]
101
- [--rotate-to <deg>] [--lift-to <deg>]
101
+ [--rotate-to <deg>] [--lift-to <deg>] [--within-ms <ms>]
102
102
  ```
103
103
 
104
- Sets multiple servos in a single packet. At least one option is required. Servos not mentioned stay at their last-sent positions. Useful when two or more joints must move simultaneously.
104
+ Sets multiple servos in a single packet. At least one servo option is required. Servos not mentioned stay at their last-sent positions. With `--within-ms`, uses a trapezoidal ramp-up/ramp-down profile to complete the movement in the specified number of milliseconds. Useful when two or more joints must move simultaneously.
105
105
 
106
106
  ---
107
107
 
@@ -144,28 +144,29 @@ function S(e = !1) {
144
144
  return t.description("NOVA robot arm CLI").allowUnknownOption(!1).configureOutput({ writeErr: () => {} }), e || (t.option("--port <path>", "serial port path (e.g. /dev/ttyACM0 on Linux/macOS, COM3 on Windows)").option("--baud <rate>", "baud rate (default: 9600)", "9600").option("--on-error <mode>", "script error mode: stop | continue | ask (default: stop)"), t.hook("preAction", (e, t) => {
145
145
  let n = t.optsWithGlobals();
146
146
  p = n.port, m = Number(n.baud ?? "9600"), h = n.onError ?? "stop";
147
- })), t.command("home").description("send all servos to their home positions").action(async () => {
148
- await (await _()).home();
149
- }), t.command("move").description("set one or more servo positions without interrupting the others").option("--shift-to <angle>", "shift head forward (>90°) or back (<90°) — s1").option("--roll-to <angle>", "roll head clockwise (>90°) or counter-clockwise (<90°) — s2").option("--pitch-to <angle>", "pitch head up (>110°) or down (<110°) — s3").option("--rotate-to <angle>", "rotate body around Z-axis — s4").option("--lift-to <angle>", "lift head on secondary axis, range 20°–150° — s5").action(async (e) => {
147
+ })), t.command("home").description("send all servos to their home positions").option("--within-ms <ms>", "move smoothly over this many milliseconds (trapezoidal ramp)").action(async (e) => {
148
+ let t = e.withinMs == null ? void 0 : Number(e.withinMs);
149
+ await (await _()).home(t);
150
+ }), t.command("move").description("set one or more servo positions without interrupting the others").option("--shift-to <angle>", "shift head forward (>90°) or back (<90°) — s1").option("--roll-to <angle>", "roll head clockwise (>90°) or counter-clockwise (<90°) — s2").option("--pitch-to <angle>", "pitch head up (>110°) or down (<110°) — s3").option("--rotate-to <angle>", "rotate body around Z-axis — s4").option("--lift-to <angle>", "lift head on secondary axis, range 20°–150° — s5").option("--within-ms <ms>", "move smoothly over this many milliseconds (trapezoidal ramp)").action(async (e) => {
150
151
  let t = {};
151
152
  if (e.shiftTo != null && (t.s1 = Number(e.shiftTo)), e.rollTo != null && (t.s2 = Number(e.rollTo)), e.pitchTo != null && (t.s3 = Number(e.pitchTo)), e.rotateTo != null && (t.s4 = Number(e.rotateTo)), e.liftTo != null && (t.s5 = Number(e.liftTo)), Object.keys(t).length === 0) throw new d("move: specify at least one servo option (--shift-to, --roll-to, --pitch-to, --rotate-to, --lift-to)", u.UsageError);
152
- let n = await _();
153
- n.State = t, await n.sendServoState();
154
- }), t.command("shift-to").description("shift head forward (>90°) or back (<90°) — s1").argument("<angle>", "target angle in degrees").action(async (e) => {
155
- let t = await _();
156
- t.State = { s1: Number(e) }, await t.sendServoState();
157
- }), t.command("roll-to").description("roll head clockwise (>90°) or counter-clockwise (<90°) — s2").argument("<angle>", "target angle in degrees").action(async (e) => {
158
- let t = await _();
159
- t.State = { s2: Number(e) }, await t.sendServoState();
160
- }), t.command("pitch-to").description("pitch head up (>110°) or down (<110°) — s3").argument("<angle>", "target angle in degrees").action(async (e) => {
161
- let t = await _();
162
- t.State = { s3: Number(e) }, await t.sendServoState();
163
- }), t.command("rotate-to").description("rotate body around Z-axis — s4").argument("<angle>", "target angle in degrees").action(async (e) => {
164
- let t = await _();
165
- t.State = { s4: Number(e) }, await t.sendServoState();
166
- }), t.command("lift-to").description("lift head on secondary axis, range 20°–150° — s5").argument("<angle>", "target angle in degrees").action(async (e) => {
167
- let t = await _();
168
- t.State = { s5: Number(e) }, await t.sendServoState();
153
+ let n = e.withinMs == null ? void 0 : Number(e.withinMs);
154
+ await (await _()).moveTo(t, n);
155
+ }), t.command("shift-to").description("shift head forward (>90°) or back (<90°) — s1").argument("<angle>", "target angle in degrees").option("--within-ms <ms>", "move smoothly over this many milliseconds (trapezoidal ramp)").action(async (e, t) => {
156
+ let n = t.withinMs == null ? void 0 : Number(t.withinMs);
157
+ await (await _()).shiftHeadTo(Number(e), n);
158
+ }), t.command("roll-to").description("roll head clockwise (>90°) or counter-clockwise (<90°) — s2").argument("<angle>", "target angle in degrees").option("--within-ms <ms>", "move smoothly over this many milliseconds (trapezoidal ramp)").action(async (e, t) => {
159
+ let n = t.withinMs == null ? void 0 : Number(t.withinMs);
160
+ await (await _()).rollHeadTo(Number(e), n);
161
+ }), t.command("pitch-to").description("pitch head up (>110°) or down (<110°) — s3").argument("<angle>", "target angle in degrees").option("--within-ms <ms>", "move smoothly over this many milliseconds (trapezoidal ramp)").action(async (e, t) => {
162
+ let n = t.withinMs == null ? void 0 : Number(t.withinMs);
163
+ await (await _()).pitchHeadTo(Number(e), n);
164
+ }), t.command("rotate-to").description("rotate body around Z-axis — s4").argument("<angle>", "target angle in degrees").option("--within-ms <ms>", "move smoothly over this many milliseconds (trapezoidal ramp)").action(async (e, t) => {
165
+ let n = t.withinMs == null ? void 0 : Number(t.withinMs);
166
+ await (await _()).rotateBodyTo(Number(e), n);
167
+ }), t.command("lift-to").description("lift head on secondary axis, range 20°–150° — s5").argument("<angle>", "target angle in degrees").option("--within-ms <ms>", "move smoothly over this many milliseconds (trapezoidal ramp)").action(async (e, t) => {
168
+ let n = t.withinMs == null ? void 0 : Number(t.withinMs);
169
+ await (await _()).liftHeadTo(Number(e), n);
169
170
  }), t.command("wait").description("pause for <ms> milliseconds before the next command").argument("<ms>", "duration in milliseconds (non-negative number)").action(async (e) => {
170
171
  let t = Number(e);
171
172
  if (isNaN(t) || t < 0) throw new d(`wait: invalid duration '${e}' — expected a non-negative number`, u.UsageError);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nova-control-command",
3
3
  "description": "CLI for controlling a NOVA DIY Artificial Intelligence Robot by Creoqode",
4
- "version": "0.0.7",
4
+ "version": "0.0.8",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "nova",