Skip to content

Commit 485745e

Browse files
author
Sébastien Parent-Charette
committed
Initial commit
1 parent dd3442a commit 485745e

12 files changed

Lines changed: 2298 additions & 0 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ignore all release packages
2+
*.zip
3+
*.rar
4+
5+
# Ignore all automation
6+
*.bat
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
* Author: Sebastien Parent-Charette (support@robotshop.com)
3+
* Version: 1.0.0
4+
* Licence: LGPL-3.0 (GNU Lesser General Public License version 3)
5+
*
6+
* Desscription: Example of all the possible configurations for a LSS.
7+
*/
8+
9+
#include <LSS.h>
10+
11+
// ID set to default LSS ID = 0
12+
#define LSS_ID (0)
13+
#define LSS_BAUD (LSS_DefaultBaud)
14+
15+
// Create one LSS object
16+
LSS myLSS = LSS(LSS_ID);
17+
18+
void setup()
19+
{
20+
// Initialize the LSS bus
21+
LSS::initBus(Serial, LSS_BAUD);
22+
23+
// Uncomment any configurations that you wish to activate
24+
// You can see above each configuration a link to its description in the Lynxmotion wiki
25+
// Note: If you change a configuration to the same value that is already set,
26+
// the LSS will ignore the operation since the value is not changed.
27+
28+
// *** Basic configurations ***
29+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H6.OriginOffsetAction28O29
30+
//myLSS.setOriginOffset(0);
31+
32+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H7.AngularRange28AR29
33+
//myLSS.setAngularRange(uint16_t value, LSS_SetType setType = LSS_SetConfig);
34+
35+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H12.MaxSpeedinDegrees28SD29
36+
// Set maximum speed in (1/10°)/s
37+
//myLSS.setMaxSpeed(600, LSS_SetConfig);
38+
39+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H13.MaxSpeedinRPM28SR29
40+
//myLSS.setMaxSpeedRPM(100, LSS_SetConfig);
41+
42+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H14.LEDColor28LED29
43+
// Options are:
44+
// LSS_LED_Black = 0
45+
// LSS_LED_Red = 1
46+
// LSS_LED_Green = 2
47+
// LSS_LED_Blue = 3
48+
// LSS_LED_Yellow = 4
49+
// LSS_LED_Cyan = 5
50+
// LSS_LED_Magenta = 6
51+
// LSS_LED_White = 7
52+
//myLSS.setColorLED(LSS_LED_Black, LSS_SetConfig);
53+
54+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H15.GyreRotationDirection28G29
55+
// Options are:
56+
// LSS_GyreClockwise = 1
57+
// LSS_GyreCounterClockwise = -1
58+
//myLSS.setGyre(LSS_ConfigGyre value, LSS_SetConfig);
59+
60+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H19.FirstA0Position28Degrees29
61+
//myLSS.setFirstPosition(0);
62+
//myLSS.clearFirstPosition();
63+
64+
// *** Advaned configurations ***
65+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA1.AngularStiffness28AS29
66+
//myLSS.setAngularStiffness(0, LSS_SetConfig);
67+
68+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA2.AngularHoldingStiffness28AH29
69+
//myLSS.setAngularHoldingStiffness(4, LSS_SetConfig);
70+
71+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA3:AngularAcceleration28AA29
72+
//myLSS.setAngularAcceleration(100, LSS_SetConfig);
73+
74+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA4:AngularDeceleration28AD29
75+
//myLSS.setAngularDeceleration(100, LSS_SetConfig);
76+
77+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA5:MotionControl28EM29
78+
//myLSS.setMotionControlEnabled(bool value);
79+
80+
//> https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA6.ConfigureLEDBlinking28CLB29
81+
// Options are an arithmetic addition of the following values:
82+
// Limp 1
83+
// Holding 2
84+
// Accelerating 4
85+
// Decelerating 8
86+
// Free 16
87+
// Travelling 32
88+
// Therefore, 0 = no blinking and 63 = always blinking
89+
//myLSS.setBlinkingLED(0);
90+
91+
// Reset motor to complete change of configurations
92+
myLSS.reset();
93+
94+
// Wait for reboot
95+
delay(2000);
96+
}
97+
98+
void loop()
99+
{
100+
// Loop through each of the 8 LED color (black = 0, red = 1, ..., white = 7)
101+
for(uint8_t i = LSS_LED_Black; i <= LSS_LED_White; i++)
102+
{
103+
// Set the color (session) of the LSS
104+
myLSS.setColorLED((LSS_LED_Color)i);
105+
delay(1000);
106+
}
107+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Author: Sebastien Parent-Charette (support@robotshop.com)
3+
* Version: 1.0.0
4+
* Licence: LGPL-3.0 (GNU Lesser General Public License version 3)
5+
*
6+
* Desscription: Moves one LSS using the position of a second LSS.
7+
*/
8+
9+
#include <LSS.h>
10+
11+
#define LSS_BAUD (LSS_DefaultBaud)
12+
13+
// Create two LSS object; one for output (ID=0), one for input (ID=1)
14+
LSS myLSS_Output = LSS(0);
15+
LSS myLSS_Input = LSS(1);
16+
17+
void setup()
18+
{
19+
// Initialize the LSS bus
20+
LSS::initBus(Serial, LSS_BAUD);
21+
22+
// Initialize LSS output to position 0.0
23+
myLSS_Output.move(0);
24+
25+
// Wait for it to get there
26+
delay(2000);
27+
28+
// Lower output servo stiffness
29+
myLSS_Output.setAngularStiffness(4);
30+
myLSS_Output.setMaxSpeedRPM(15);
31+
32+
// Make input servo limp (no active resistance)
33+
myLSS_Input.limp();
34+
}
35+
36+
// Reproduces position of myLSS_Input on myLSS_Output
37+
unsigned long startTime = millis();
38+
39+
void loop()
40+
{
41+
// Wait ~20 ms before sending another command (update at most 50 times per second)
42+
if((millis() - startTime) > 20)
43+
{
44+
int16_t pos = (int16_t)myLSS_Input.getPosition();
45+
Serial.print("Input @ "); Serial.println(pos);
46+
47+
// Send LSS to half a turn counter-clockwise from zero (assumes gyre = 1)
48+
myLSS_Output.move(pos);
49+
Serial.println("\r\n");
50+
}
51+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Author: Sebastien Parent-Charette (support@robotshop.com)
3+
* Version: 1.0.0
4+
* Licence: LGPL-3.0 (GNU Lesser General Public License version 3)
5+
*
6+
* Desscription: Basic example of reading values from the LSS and placing
7+
* them on the terminal.
8+
*/
9+
10+
#include <LSS.h>
11+
12+
// ID set to default LSS ID = 0
13+
#define LSS_ID (0)
14+
#define LSS_BAUD (LSS_DefaultBaud)
15+
16+
// Create one LSS object
17+
LSS myLSS = LSS(LSS_ID);
18+
19+
void setup()
20+
{
21+
// Initialize the LSS bus
22+
LSS::initBus(Serial, LSS_BAUD);
23+
}
24+
25+
void loop()
26+
{
27+
// Header 1
28+
Serial.println("\r\nQuerying servo...");
29+
30+
// Get LSS position, speed, current, voltage, temperature
31+
int32_t pos = myLSS.getPosition();
32+
uint8_t rpm = myLSS.getSpeedRPM();
33+
uint16_t current = myLSS.getCurrent();
34+
uint16_t voltage = myLSS.getVoltage();
35+
uint16_t temp = myLSS.getTemperature();
36+
37+
// Header 2
38+
Serial.println("\r\n\r\n---- LSS telemetry ----");
39+
40+
// Display LSS position, speed, current, voltage, temperature
41+
Serial.print("Position (1/10 deg) = "); Serial.println(pos);
42+
Serial.print("Speed (rpm) = "); Serial.println(rpm);
43+
Serial.print("Curent (mA) = "); Serial.println(current);
44+
Serial.print("Voltage (mV) = "); Serial.println(voltage);
45+
Serial.print("Temperature (1/10 C) = "); Serial.println(temp);
46+
47+
// Read LSS telemetry once per second
48+
delay(1000);
49+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Author: Sebastien Parent-Charette (support@robotshop.com)
3+
* Version: 1.0.0
4+
* Licence: LGPL-3.0 (GNU Lesser General Public License version 3)
5+
*
6+
* Desscription: Basic example of the LSS moving back and forth.
7+
*/
8+
9+
#include <LSS.h>
10+
11+
// ID set to default LSS ID = 0
12+
#define LSS_ID (0)
13+
#define LSS_BAUD (LSS_DefaultBaud)
14+
15+
// Create one LSS object
16+
LSS myLSS = LSS(LSS_ID);
17+
18+
void setup()
19+
{
20+
// Initialize the LSS bus
21+
LSS::initBus(Serial, LSS_BAUD);
22+
23+
// Initialize LSS to position 0.0 °
24+
myLSS.move(0);
25+
26+
// Wait for it to get there
27+
delay(2000);
28+
}
29+
30+
// Loops between -180.0° and 180°, taking 1 second pause between each half-circle move.
31+
void loop()
32+
{
33+
// Send LSS to half a turn counter-clockwise from zero (assumes gyre = 1)
34+
myLSS.move(-1800);
35+
36+
// Wait for one second
37+
delay(2000);
38+
39+
// Send LSS to half a turn clockwise from zero (assumes gyre = 1)
40+
myLSS.move(1800);
41+
42+
// Wait for one second
43+
delay(2000);
44+
}

0 commit comments

Comments
 (0)