Nice! You are welcome and I can see your code as well.
Hi @zenta,
Can I ask what does balance calculations do ? I am not that well versed with Phoenix code so thought of asking you as in your gait engine that seems to be the key part.
Thanks and Regards
@madmax
The balance calculations calculate the sum of translations and rotations for each leg. Example: When all legs are on a flat and level ground in a symmetric initial position the body is in balance, meaning the balance calc returns 0 on all values. If one of the legs start moving in any directions the sum (or average sum) will differ from 0 and we can use this value as an input for body rotations and translations. I demontrated this feature on this 12 year old video:
EDIT: At 1:50 in the video the legs are lifted and the body āfollowā the leg. Thatās the key feature of the balance mode. Gives a bit more life to the bugā¦
Thanks @zenta!
Taking a quick look through:
Remote control
I see the file _Phoenix_input_DIY_Commander
This is geared around your one of a kind DIY Remote? It will be interesting to setup a couple of different alternatives that both members of this group can more readily acquire as also more general people can acquire.
Unfortunately any reasonably priced commercially available remote, wonāt have everything yours does
Like fewer controls, like sliders and knobs and ā¦ Also may not have things like a display to show information.
So I have some code in place on my machine for some USB Remotes like PS3 and PS4. They donāt have as many joysticks and the like as yours, but some may have some other features like being able to detect when you rotate the remote and the like, which could be interesting.
Alternatively could hook up an RC remote, like the Flyskyā¦ Which some of them are setup to use Serial communications, and some have the ability to send some information back to the remote.
Servos
Have you experimented with converting the code from Dynamixel Servos to LSS Servos?
Again my quick look through, I am guessing that you are using the USE_AX12_SPEED_CONTROL option,
So you are telling the servos to do their own interpolation (timing) of their move from their current position to the new position?
Again I have not looked much yet, but are you using some of the PID settings of the Servos? I am assuming Protocol 1 of Dynamixel?
If you have tried the LSS Servos with this, how is it working and/or are there issues that you ran into?
Anything, that would help if some of us try out? Help debug? Fix or extend something?
Again the functionality you showed in your video looks like it would make a very nice setup!
Thanks for the explanation. That is a pretty neat thing I must say !! Amazing!! It certainly makes it look a lot life like.
I wish I had (more budget) ordered the brackets. I just want to get on with this thing and try out a few thingsā¦ I am waiting for some 3d model edits so that I could print the brackets. This waiting is killing me. And also my second shipment which has your break out board @kurte has not been shipped.
I was looking at the code and was trying to find the LSS reference and couldnāt find any. I only have a ps2 controller that I have used with my hex. I do have access to PS4 controller from my console. Is there any other controller that can be used? I know there is Xbee connector on the LSS adapter but I have no clue what to use there. I guess these must be the DIY controllers that zenta and others might have.
@madmax - Others can answer some of this much better than I can, but here are my 2 cents.
The board can help hook things up, but if you have some things like most any Teensy board and the LSS adapter board, you can probably cobble up something while waiting.
For example if you have a Teensy 3.2 or 3.5, these boards are 5v tolerant and you can jumper the TX and RX and GND to the right place and should be able to talk to servos. (Hopefully) I have not tried this directly and as such I can not say with certainty that the 3.3v TX pin will drive all of the servosā¦ It does for most other 5v servos I have used.
For T3.6/T4.x, they are not 5v tolerant, but if you have something like a Sparkfun or Adafruit TTL level converter you can jumper it with pins from RX/TX of teensy to low voltage side and TX/RX of LSS to high side and get it up and running. (That is what the board has built inā¦
I did not see it either. I do have the version of the fixed point code that has a start to this, which started off with the older SSC-32 fixed point driver as the newer LSS servos sort of follow the old SSC-32 protocolā¦ Still wish the protocol followed the group commands like: # P S āā ā¦ # P S āā T
Our older Lynxmotion version was setup to generate the next command and output as much as we could and then time when we output the to hopefully better have all of the servos start their next move at the same timeā¦ (Sorry side track)
Again may try the program that was uploaded, by converting my Servo driver code and see if it responds.
Controllers:
PS2 - can maybe be made to work, but I avoid them like the plague as almost every shipment of them has slightly different timings and you are always have to fiddle with the timings to make them workā¦ Not sure if I have any working ones any more. Or if Robotshop sells them or not.
Other Game controllers:
As I mentioned on the Teensy 3.6 and T4.x I do have working USB Host support for several controllers. Like PS3 and PS4 (both plugged in and Bluetooth).
I have some support for XBox360 I believe plugged in with Microsoft wireless adapter.
XBox One - At times I can get it to work with Bluetooth, but I think bustedā¦
Nintendo Switch controller - Still donāt have working. They use other Bluetooth interfaces which I donāt have implemented fully. A group of us on PJRC were working on this awhile ago but got distracted with T4.1 now MicroMod, plusā¦
XBees:
There were two different setups that some of us have/had:
The Trossen Robotics: Arbotix Commander (https://www.trossenrobotics.com/p/arbotix-commander-gamepad-v2.aspx)
I believe this has been discontinued.
It is a pretty simple setupā¦
Then some of us started off with a remote control that Jim Frye (previous owner of Lynxmotion) made for a few of us, which was RC based. I think most of us converted later to XBees, which gave us bidirectional. I know that @Zenta built probably at least one new one since then. The last one I remember he talks about up at:
Quick note: if you have not done so before you should take a look at some of the other stuff he has done up on Youtube and the like!
I remember earlier in this that I think Robotshop sells some remote control as well, that maybe allows you to plug in XBee and or Bluetooth?
I took the logic analizer yesterday and doing some tests today on KurtE board.
Seems like i have the reply from the temperature (only one i leaved in the sketch) before and after the logic level converter.
Meaning it does come back to the teensy but is not captured ?
Yes, thatās correct. I just uploaded the code Iām using on the remote based on the one from Michael E. Ferguson.
My current remote is a 3D printed version using some nice 3 axis gimbals with HAL sensors.
Using a Teensy 3.1 and your Breakoutboard. The Nokia 5110 display (ST7735) are cheap but a bit slow, so I needed to update it in portions.
Short video to show what the display look like:
Support for other remotes like PS4 or RC SBUS would be more convenient for most users.
No, as I posted earlier Iām having trouble all over the place so I gave it up until we have a common hardware to collaborate on.
Using standard protocol 1. The USE_AX12_SPEED_CONTROL is enabled yes, but this is where Iām not sure what I doā¦ I assume there are som interpolation going on. But the code send new positions very often due to very many and smal steps. Itās been a while since I looked into this part and keep forgetting what I did. Sighā¦
Thanks. The important thing is to implement the LSS stuff on a common mcu/hardware.
I thought you were getting the QT reply backā¦ or did I miss some messages here?
Iām only getting position back.
All others are not working.
Where is the capture from? That is, are you reading at a servo, or back at the Teensy Pin 0?
i.e. if at pin 0, than we know the signal made it all the way backā¦
I am running different setup right now, But assuming the signal is making it back, then we need to check software.
For example again try my fork, and make sure it built with itā¦
How are you doing builds? Arduino IDE? Platform IO? ā¦
For example I just started up my start of Phoenix port for USB joysticksā¦ And Starting up I see:
Program Start
Servo(0): 8 1
Servo(1): 14 -6
Servo(2): 2 3
Servo(3): 7 2
Servo(4): 13 -2
Servo(5): 1 5
Servo(6): 10 537
Servo(7): 16 534
Servo(8): 4 535
Servo(9): 9 -535
Servo(10): 15 -535
Servo(11): 3 -534
Servo(12): 12 249
Servo(13): 18 244
Servo(14): 6 242
Servo(15): 11 -247
Servo(16): 17 -242
Servo(17): 5 -242
USB Joystick Init: Arduino Phoenix Monitor
D - Toggle debug on or off
J - Show Joystick data
V - Voltage
M - Toggle Motors on or off
T - Test Servos
P - Servo Positions
S - Track Servos
O - Enter Servo offset mode
*** Device Bluet a12:1 - connected ***
product: CSR8510 A10
BDADDR: 0:0:0:0:0:0
In the serial monitor. Not that it matters for this, but I majority of the time I run with TyCommander instead of Arduino Serial monitor:
More info up on the forum page: https://forum.pjrc.com/threads/27825-Teensy-Qt
Maybe I should have ordered a set of those boards
@kurte
I get the same results on the LSS connector and on the Teensy pins. (before and after the logic level)
This was with your fork library as well on Arduino IDE.
Will send you the board, but i wanted to confirm the board first.
I am not sure, if you are still having issues, might be good to diagnose, on the other hand I might be able to help diagnose.
Maybe might help to also to have an unused servo to try with, as maybe there is something like somewhere in the code that does not like Servo ID #0ā¦
So again all of my tests typically start from servo ID #1ā¦
So a quick test on your side or mine, might be for example change one of your servos to a different id: like #2 and obviously update the sketch to talk to that one and see if anything works better.
Obviously I can and will (try changing a servo back to ID 0 and see if that works:
You might also try my LSSTestServos to see if anything there works.
I would also probably add debug output code in places like:
char * LSS::genericRead_Blocking_str(uint8_t id, const char * cmd)
Something like:
char * LSS::genericRead_Blocking_str(uint8_t id, const char * cmd)
{
Serial.printf("LSS::genericRead_Blocking_str called (%u, %s)\n", id, cmd);
// Exit condition
if (bus == (Stream*) nullptr)
{
lastCommStatus = LSS_CommStatus_ReadNoBus;
return ((char *) nullptr);
}
//
// Read from bus until first character; exit if not found before timeout
if (!(bus->find(LSS_CommandReplyStart)))
{
lastCommStatus = LSS_CommStatus_ReadTimeout;
return ((char *) nullptr);
}
Serial.println(" LSS_CommandReplyStart found");
// Ok we have the * now now lets get the servo ID from the message.
readID = 0;
int c;
bool valid_field = 0;
while ((c = LSS::timedRead()) >= 0)
{
if ((c < '0') || (c > '9')) break; // not a number character
readID = readID * 10 + c - '0';
valid_field = true;
}
Serial.printf(" after read ID: %u %u\n", readID, valid_field);
if ((!valid_field) || (readID != id))
{
lastCommStatus = LSS_CommStatus_ReadWrongID;
// BUGBUG Should we clear out until CR?
return ((char *) nullptr);
}
// Now lets validate the right CMD
for (;;)
{
if (c != *cmd)
{
lastCommStatus = LSS_CommStatus_ReadWrongIdentifier;
return ((char *) nullptr);
}
cmd++;
if (*cmd == '\0')
break;
c = LSS::timedRead();
}
Serial.println(" After read command");
size_t maxLength = (LSS_MaxTotalCommandLength - 1);
size_t index = 0;
while (index < maxLength)
{
c = LSS::timedRead();
if (c < 0 || c == LSS_CommandEnd[0])
break;
value[index] = (char) c;
index++;
}
value[index] = '\0';
// Return value (success)
if (c < 0)
{
// did not get the ending CR
lastCommStatus = LSS_CommStatus_ReadTimeout;
return ((char *) nullptr);
}
lastCommStatus = LSS_CommStatus_ReadSuccess;
return value;
}
And see if you get any data. For example with my test servos doing a scan I see something like:
Cmd: 5
Search for all servos
LSS::genericRead_Blocking_str called (0, QD)
LSS::genericRead_Blocking_str called (1, QD)
LSS::genericRead_Blocking_str called (2, QD)
LSS_CommandReplyStart found
after read ID: 1 1
LSS::genericRead_Blocking_str called (3, QD)
LSS_CommandReplyStart found
after read ID: 3 1
After read command
3 - -534
LSS::genericRead_Blocking_str called (4, QD)
LSS_CommandReplyStart found
after read ID: 4 1
After read command
4 - 535
LSS::genericRead_Blocking_str called (5, QD)
LSS_CommandReplyStart found
after read ID: 5 1
After read command
5 - -242
Now if you donāt get anything on a servoā¦ Like I show for 0 and 1, I would maybe then add some debug stuff to LL::timedRead
Also side question what version of Arduino IDE and Teensyduino are you running?
@kurte - Things need to be rather simple for me to understand when itās coding. Something like, load that code and see if it works. LOL
I donāt think itās a hardware issues, since i can get the āpositionā back without issues.
Not sure why all the others do not work.
Did a quick test with ID1 but same issue.
Again not sure of which version of Arduino and Teensyduino you are running: If you want to be sort of in sync with what I am running, I would suggest maybe doing something like:
Install a fresh copy of Arduino IDE. Note: I have several versions on my machine and I donāt typically use the Installer but instead use the windows zip file option: I have latest release 1.8.13 unzipped at C:\arduino-1.8.13
I am currently running with the latest Teensydunio Beta build, as lots of our later stuff is in and I am involved with several parts of i
The current beta build is up at:https://forum.pjrc.com/threads/66357-Teensyduino-1-54-Beta-7
You can find out which version of both you are running, by going to the Help->About menu item.
Note: In Arduino Preferences I always turn on show all compiler warnings and the like. I also personally turn on verbose
Now when you do a build, with the beta we show better information for memory usages in the different regions of memory.
And Arduino also gives you hints on things like which Libraries your sketch is using and which ones it is not:
Example build output:
"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_LSS_Query.ino/LSS_Query.ino.elf"
"C:\\arduino-1.8.13\\hardware\\teensy/../tools/teensy_size" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino_build_LSS_Query.ino/LSS_Query.ino.elf"
teensy_size: Memory Usage on Teensy 4.1:
teensy_size: FLASH: code:29640, data:5256, headers:7212 free for files:8084356
teensy_size: RAM1: code:32768, variables:12992 free for local variables:478528
teensy_size: RAM2: variables:12384 free for malloc/new:511904
Multiple libraries were found for "LSS.h"
Used: C:\Users\kurte\Documents\Arduino\libraries\LSS_Library_Arduino
Not used: C:\Users\kurte\Documents\Arduino\libraries\Lynxmotion_Smart_Servo_-LSS-
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Users\kurte\Documents\Arduino\libraries\SoftwareSerial
Not used: C:\arduino-1.8.13\hardware\teensy\avr\libraries\SoftwareSerial
Using library LSS_Library_Arduino at version 1.3.1 in folder: C:\Users\kurte\Documents\Arduino\libraries\LSS_Library_Arduino
Using library SoftwareSerial at version 1.0 in folder: C:\Users\kurte\Documents\Arduino\libraries\SoftwareSerial
Again the interesting one is to make sure it has the right code for the LSS servosā¦
And my sample output with that one function I added debug outputs to:
Querying servo...
LSS::genericRead_Blocking_str called (1, QD)
LSS_CommandReplyStart found
after read ID: 1 1
After read command
LSS::genericRead_Blocking_str called (1, QWR)
LSS_CommandReplyStart found
after read ID: 1 1
After read command
LSS::genericRead_Blocking_str called (1, QC)
LSS_CommandReplyStart found
after read ID: 1 1
After read command
LSS::genericRead_Blocking_str called (1, QV)
LSS_CommandReplyStart found
after read ID: 1 1
After read command
LSS::genericRead_Blocking_str called (1, QT)
LSS_CommandReplyStart found
after read ID: 1 1
After read command
---- LSS telemetry ----
Position (1/10 deg) = 5
Speed (rpm) = 0
Curent (mA) = 0
Voltage (mV) = 12210
Temperature (1/10 C) = 420
Note: I am assuming that you have 12v going to the servosā¦ I would probably check with a volt meter to make sure the servos are getting enough powerā¦ Although again if you are getting position then probably have power
Thanks @kurte Your posts are always helpful !
I am a big fan of @zenta robots. Esp. the morph hex and the ant. It is quite something to be working with great minds like you all here
Now, I have been trying to play with the LSS servo now. I didnāt have the level converter for Teensy. I have ordered and waiting for it now. I had an Arduino mega so stacked it on top of the LSS adapter board and started off with the LSS_Sweep example code. Switch to Arduino position. That works fine. I can see the motion on the servo.
Then went on to use the LSS_Querry example. However, it doesnāt seem to work at all. There seems to be no reply from the serial. I also tried modifying the code to see if adding any motion in there would help. The servo doesnāt move at all. I do get output similar output to what @dialfonzo is getting. This is all using Arduino IDE 1.8.13 with the latest LSS Library from Arduino
The top line shows #Dā¦ which is the motion I added. Here is the image of my stack
Okay sorry my bad. The telemetry seems to be working partly, cant seem to get any speed or current. I had modified the id and hence wasnāt getting anything. Now I can get the following with the LSS_Querry example code modified to have some motion in it.
Even without any motion I am getting some feedback from the motor. The values are all stationary as there is no motion.
Current and speed are the ones to sort out nowā¦
Okayā¦ Speed is also seen nowā¦
I modified the example to go in smaller steps and read back everytimeā¦ This is a very dumb code.
for(val = 0; val<=1800; val+=10)
{
myLSS.move(val);
Serial.println("\r\nQuerying servoā¦forward travel");
// Get LSS position, speed, current, voltage, temperature
int32_t pos = myLSS.getPosition();
uint8_t rpm = myLSS.getSpeedRPM();
uint16_t current = myLSS.getCurrent();
uint16_t voltage = myLSS.getVoltage();
uint16_t temp = myLSS.getTemperature();
// Header 2
Serial.println("\r\n\r\n---- LSS telemetry ----");
// Display LSS position, speed, current, voltage, temperature
Serial.print("Position (1/10 deg) = ");
Serial.println(pos);
Serial.print("Speed (rpm) = ");
Serial.println(rpm);
Serial.print("Curent (mA) = ");
Serial.println(current);
Serial.print("Voltage (mV) = ");
Serial.println(voltage);
Serial.print("Temperature (1/10 C) = ");
Serial.println(temp);
// Read LSS telemetry once per second
delay(1000);
}
Is the current value 0 because it is actually very small current ? I will try reading up the documentation a bit more and speeding it upā¦ The smaller increments are satisfying to see though
UPDATE:
Tried increasing the increments by large value i.e. 100 so that the current drawn is a bit moreā¦ Current works as well for me nowā¦