@cyberpalin @dialfonzo @madmax and all…
I updated the 3 copies again with slightly updated interpolation code to better remember to send the same point time after time…
@cyberpalin @dialfonzo @madmax and all…
I updated the 3 copies again with slightly updated interpolation code to better remember to send the same point time after time…
Thanks! I will get those changes. I Still however cant get any successful pairing with the PS4 and the dongle that I have.
Any possible tips ?
I had a question on the xbee side of things. I have never used them and wanted to give it a try… Any recommendations ? There is series1/series2 etc… What have you all been using ? I wanted to have go at making my own controller… Feeling inspired by the people here of course!
@dialfonzo @cbenson
Did you try with any BT dongles ? Would like to know if you had any success with the BT side.
@madmax - I (and @cyberpalin ) need to work more on the USBHost code for Bluetooth and USBHost… We have been distracted with other things.
Pairing… Sometimes I cheat - That is I boot up my PC that has UBuntu on it and no BT built in… So I start it up using the BT dongle and then ask it to pair with the joystick… After that completes I turn that PC off (or just BT)… Then move it over to my Board…
More often then not, If I am going to do pairing with the main board, I will often use the USBHost example sketch: Bluetooth->JoystickBT
Which again has the two versions of the BT object in them:
//BluetoothController bluet(myusb, true, "0000"); // Version does pairing to device
BluetoothController bluet(myusb); // version assumes it already was paired
So you uncomment the one that says does the pairing and comment out the other.
Then when program starts, and in the debug window you see that the USBhost has seen the dongle, then hold down the Pair and PS button until the double blink start happening and release… Hopefully they will then talk and bind… Once that is done, then convert those two source lines back to normal and rebuild and hopefully then after the program starts, you then press the PS button. and hopefully start seeing stuff displayed…
When things don’t work, I end up turning on more debug code in the library.
There is a master setting in the file USBHost_t36.h at about line 62:
// This can let you control where to send the debugging messages
//#define USBHDBGSerial Serial1
Uncomment it and rebuild and you will see lots of debug messages come out. many of which may helpful…
Likewise the file in directory bluetooth.cpp has some debug stuff… Some may be currently accidentally on by default:
But can be turned on:
#define DEBUG_BT
//#define DEBUG_BT_VERBOSE
More later depending on outcome…
As for XBees - I have mainly used Series 1… If I were building something new, might choose some other setup for DIY like maybe two cheap radios on remote and board for bidirectional transfers…
Compiler warning on V1.4.1 of LSS library solved by KurtE has been released in V1.4.2 this morning.
EDIT: Should be live soon on Arduino
Sorry, i was quite busy i haven’t tested yet.
I need to buy something as i don’t have anything here. From @cyberpalin & @kurte suggestion i guess i should get an OEM PS4 controller ?
I do know that the DS4 controller ( DualShock 4 Wireless Controller - Glacier White - Glacier White Edition : Amazon.ca: Video Games ) definitely works - @kurte has had success with this PS4 controller working with USBHost ( Amazon.com: VOYEE Controller Replacement for PS4 Controller, Upgraded Wireless Controller with 800 mAh Battery/Double Shock/6 Axis Compatible with Sony Playstation 4/Pro/Slim (Black): Video Games ). Using a genuine PS4 may work - never tested.
Getting a PS4 clone working is on the todo list as @kurte mentioned but other distractions.
I’m confused (lol) the link you provided is the genuine PS4 no ?
I think everything is fine… I think he read OEM as begin some clone manufacturer instead of Original Equipment Manufacturer or in your case one from Sony…
Not sure if i did something bad, not yet updated on Arduino.
Thanks…
Happy 4th of July to all my American friends.
Thanks!
Hope you had a nice Canada day!
(I had to check to make sure that was observed in Quebec. I know some Holidays are different depending on Provence. Like Victoria day…)
Thanks…!
Definitely goofed as it’s not yet updated
Thank you for the 4th message. It was good. As others have said hope your Canada Day was as enjoyable.
Quick update on some of the things I have run into with the firmware/library…
The Gyre setting has issues with session versus Config…
Also Reset message works differently when sent to individual servo versus broadcast ID.
Note: Ran into similar issues with Broadcast settings, like Gyre, …
Simple Example Sketch:
#include <LSS.h>
// ID set to default LSS ID = 0
#define LSS_ID (0)
#define LSS_BAUD (250000)
#define LSS_SERIAL (Serial1) // ex: Teensy
LSS myLSS = LSS(LSS_ID);
void setup()
{
while (!Serial && millis() < 5000) ;
LSS::initBus(LSS_SERIAL, LSS_BAUD);
delay(2000); // wait for servos.
myLSS.setServoID(LSS_ID);
Serial.print("Pos:");
Serial.print(myLSS.getPosition(), DEC);
Serial.print(" Comm Status:");
Serial.println(myLSS.getLastCommStatus(), DEC);
Serial.printf("Gyre at startup: Session:%d Config:%d\n",
myLSS.getGyre(), myLSS.getGyre(LSS_QueryConfig));
// Set Session Gyre
myLSS.setGyre(LSS_GyreCounterClockwise);
Serial.printf("Gyre after set session: Session:%d Config:%d\n",
myLSS.getGyre(), myLSS.getGyre(LSS_QueryConfig));
// Reset the servo.
Serial.println("Reset using our ID");
myLSS.reset();
delay(1500);
Serial.printf("After reset servo: Session:%d Config:%d\n",
myLSS.getGyre(), myLSS.getGyre(LSS_QueryConfig));
// Set Session Gyre
myLSS.setGyre(LSS_GyreCounterClockwise);
Serial.printf("Gyre after set session Again...: Session:%d Config:%d\n",
myLSS.getGyre(), myLSS.getGyre(LSS_QueryConfig));
// Reset the servo.
Serial.println("Reset using our LSS_BroadcastID");
myLSS.setServoID(LSS_BroadcastID);
myLSS.reset();
delay(1500);
myLSS.setServoID(LSS_ID);
Serial.print("Pos:");
Serial.print(myLSS.getPosition(), DEC);
Serial.print(" Comm Status:");
Serial.println(myLSS.getLastCommStatus(), DEC);
Serial.printf("After reset servo: Session:%d Config:%d\n",
myLSS.getGyre(), myLSS.getGyre(LSS_QueryConfig));
}
void loop()
{
}
Output:
Pos:203 Comm Status:1
Gyre at startup: Session:-1 Config:-1
Gyre after set session: Session:-1 Config:-1
Reset using our ID
After reset servo: Session:1 Config:1
Gyre after set session Again...: Session:-1 Config:-1
Reset using our LSS_BroadcastID
Pos:203 Comm Status:1
After reset servo: Session:-1 Config:-1
Again note: I set the session GYRE and both update.
I reset with Servo ID, and the Gyre is back to the EEPROM setting
I set it again and again both update.
I Reset with Broadcast and the values are not updated.
Follow on to the above about broadcast settings… Again simple sketch:
#include <LSS.h>
// ID set to default LSS ID = 0
#define LSS_ID (0)
#define LSS_BAUD (250000)
#define LSS_SERIAL (Serial1) // ex: Teensy
LSS myLSS = LSS(LSS_ID);
void PrintServoStuff() {
Serial.print("Pos:");
Serial.print(myLSS.getPosition(), DEC);
Serial.print(" Comm Status:");
Serial.print(myLSS.getLastCommStatus(), DEC);
Serial.print("\tO:");
Serial.print(myLSS.getOriginOffset(), DEC);
Serial.print(":");
Serial.print(myLSS.getOriginOffset(LSS_QueryConfig), DEC);
Serial.print("\tG:");
Serial.print(myLSS.getGyre(), DEC);
Serial.print(":");
Serial.print(myLSS.getGyre(LSS_QueryConfig), DEC);
Serial.print("\tEMC:");
Serial.print(myLSS.getIsMotionControlEnabled(), DEC);
//Serial.print(":");
//Serial.print(myLSS.getIsMotionControlEnabled(LSS_QueryConfig), DEC);
Serial.print("\tFPC:");
Serial.print(myLSS.getFilterPositionCount(), DEC);
Serial.print(":");
Serial.print(myLSS.getFilterPositionCount(LSS_QueryConfig), DEC);
Serial.print("\tAS:");
Serial.print(myLSS.getAngularStiffness(), DEC);
Serial.print(":");
Serial.print(myLSS.getAngularStiffness(LSS_QueryConfig), DEC);
Serial.print("\tAH:");
Serial.print(myLSS.getAngularHoldingStiffness(), DEC);
Serial.print(":");
Serial.print(myLSS.getAngularHoldingStiffness(LSS_QueryConfig), DEC);
Serial.print("\tAR:");
Serial.print(myLSS.getAngularRange(), DEC);
Serial.print(":");
Serial.println(myLSS.getAngularRange(LSS_QueryConfig), DEC);
}
void setup()
{
while (!Serial && millis() < 5000) ;
LSS::initBus(LSS_SERIAL, LSS_BAUD);
delay(2000); // wait for servos.
myLSS.setServoID(LSS_ID);
Serial.print("Pos:");
Serial.print(myLSS.getPosition(), DEC);
Serial.print(" Comm Status:");
Serial.println(myLSS.getLastCommStatus(), DEC);
myLSS.setServoID(LSS_ID);
myLSS.reset();
delay(2000);
Serial.println("At Startup");
PrintServoStuff();
Serial.println("Use Broadcast");
myLSS.setServoID(LSS_BroadcastID);
myLSS.setMotionControlEnabled(0);
delay(5);
myLSS.setAngularHoldingStiffness(4, LSS_SetSession);
delay(5);
myLSS.setAngularStiffness(-4, LSS_SetSession);
delay(5);
myLSS.setFilterPositionCount(3, LSS_SetSession);
delay(5);
myLSS.setServoID(LSS_ID);
PrintServoStuff();
Serial.println("Use ServoID");
myLSS.setServoID(LSS_BroadcastID);
myLSS.setServoID(LSS_ID);
myLSS.setMotionControlEnabled(0);
delay(5);
myLSS.setAngularHoldingStiffness(4, LSS_SetSession);
delay(5);
myLSS.setAngularStiffness(-4, LSS_SetSession);
delay(5);
myLSS.setFilterPositionCount(3, LSS_SetSession);
delay(5);
PrintServoStuff();
}
void loop()
{
}
Again values were not updated when sent by broadcast ID…
Pos:-203 Comm Status:1
At Startup
Pos:-203 Comm Status:1 O:0:0 G:1:1 EMC:1 FPC:5:5 AS:0:0 AH:4:4 AR:1800:1800
Use Broadcast
Pos:-203 Comm Status:1 O:0:0 G:1:1 EMC:1 FPC:5:5 AS:0:0 AH:4:4 AR:1800:1800
Use ServoID
Pos:-203 Comm Status:1 O:0:0 G:1:1 EMC:0 FPC:3:5 AS:-4:0 AH:4:4 AR:1800:1800
Yesterday i received my PS4 controller so i will be able to move on for some more testings.
The “OM” does open without moving the servos, which is great however i don’t understand how to move the offset. I know the options are listed but i’m using Arduino Serial Monitor and i think it doesn’t work with keyboard capture, am i right ?
Good Morning @dialfonzo and @cyberpalin and all.
Glad you received your PS4… Now hopefully you will be able to have some fun!
Yes the Arduino Servo Monitor should work just fine.
Here is a snapshot showing the Arduino Monitor:
Note the area at the top of the window, that at the right hand side has the Send button. The area to the left of it is an area you should be able to click with the mouse to give it the text cursor, and you should be able to type stuff in. The stuff will be sent when ever you press the CR(Enter Key) or if you click on the send button.
Notice near the bottom right of the window There is a button, to clear window and a drop down list for what type of line ending to send to the Arduino sketch when you type / press the enter key. I normally set it to both New Line and CR…
Here I typed: om
And it went into Servo Offset mode in manual mode… As I think you mentioned your servos may error out if it tries to set all servos to 0…
Hopefully you can then manually move the servos all to have sort of horizontal for the two servos and right angle for the leg…
Once you are close you should be able to press any key (and send it)… Which will then exit manual mode and then you should be able to start fine tunining.
Note: When is servo is selected and wiggles and led changes color… You can use + and - keys to move a small amount at a time.
So I will check which direction I need to go by maybe typeing: ++
and if moved the right direction depending on how close I am, I will maybe enter several +s or -s before I send them …
Hope that makes sense.
Kurt
@kurte - Appreciate the “in depth” explanation. I can use the Arduino Serial Monitor (do it all the time) but i was under the impression that whatever you were using would catch the “+” & “-” without the need to do a enter between them, sorry about that.
Edit1:
Sorry for asking but how do you handle “offsets” exactly ?
You read the value and start from there ? If yes, why not just do a “CO” when the robot is in the right position ?
Good morning @dialfonzo - @kurte
Sure @kurte will will dive into this a bit more but think the code is calling setOriginOffset using the current leg positions after you move them.
Anyway been adding to the Readme for the Phoenix code. Added @kurte’s detailed explanation for setting the servo’s zero position as well as adding a few figures from this thread to help explain leg positions and leg-body axes.
I also added a video the demo’s roughly how the controller should work with the Hex that I found on youtube using the original Commander controller. Gives a nice overview especially for someone just starting out. At the very beginning the give Kudo’s to @zenta for the original code and @kurte for his porting of the code
Right now the only repository that has been updated is at: LSS_Phoenix_BT/LSS_PhoenixUSBJoystick at main · mjs513/LSS_Phoenix_BT (github.com) . If you all have any comments or suggestions please feel free.
Actually that is what the code does…
The problem is getting it to the right position…
Once it is there it updates using the O and CO commands, by taking the current offset QO and delta of the current position to then update the origins…