smiller29
DJ or anyone else, I have a few questions based on my limited knowledge of ARC. The one thing I have learned about ARC there are many places where you can add scripts and many ways to make things work. With that said I am working on a Biped robot project and at a point I want to work with Auto Position (Gait) skill and the MPU6050 skill. I understand the concept of how both of these skills work so let me just jump to problem/question.
Problem: I want to add stability logic within the movements of the auto positions and also when no Auto Position frames or actions are actively moving.
So I think when not moving AutopositionStatus = 0 I can just use a looping script in the MPU6050 skill to look for conditions that will trigger Auto Position frames or actions. But when using the Auto Position skill I need to add scripts within the:
Auto Position Start Script This script will be run before a frame or action is executed.
Auto Position End Script This script will be run after all the frames or actions in the queue have been executed.
So one question is should I stop the MPU6050 looping script in the Auto Position Start Script and start it backup in the Auto Position End Script? and at the same time add login stability logic in the end script before turning back on the MPU6050 script?
I am just looking for the best place my code within ARC so if anyone has done this and can provide more insight please let me know.
I moved this into its thread because it's a larger conversation that doesn't entirely involve the auto position.
So, this is an interesting question. The main trouble seems to be that the moving of servos from an imu and the Auto Position will always conflict. I had thought about this before but did not see an easy way around it. Let me expand on this a bit...
Let's assume this is a biped robot that will walk.
My initial idea was to suggest modifying the offset of the hip servos by an imu script. This way, if you program the robot to walk on flat ground, the upper torso will always attempt to maintain an upright position. This is also called an inverted pendulum. The Auto Position will continue to run, but the imu will modify the offset of the servo, which the Auto Position never sees. So the Auto Position would move into position 90, but if your imu script has an offset of +1, it's actually in position 91, but the Auto Position still thinks it's 90. This is how the servo Profile works. The same function could be used to do that. You can't programmatically adjust the servo profile, so I'd have to make that into functions.
You could also adjust the ankle as well. Well, technically, you can adjust all the servos. You'll need quite a bit of math to make it happen. Essentially, you'll calculate an IMU error and adjust the servos to compensate for the error. A complementary filter or Kalman filter would need to be used.
The approach would sort of work, but one crucial factor to consider is the speed of servo angle correction. I do not believe this should be done in ARC. I think a controller should sit between the EZB and the servos containing the IMU. This is because you need the error calculation to be as accurate as possible, which means a very fast sample rate and response.
The trouble between the sample, process, and response is crucial. Otherwise, you're attempting to compensate for the difference in the error, which will amplify the error and cause a feedback loop.
Have you first tried one of those cheap Arduino inverted pendulum (balancing robot) kits to experience how this works? I've spent some time on this because back at ezrobot, we had tried to make an inverted pendulum module to do what you're describing. The problem was too many variables to be design/hardware agnostic.
So, in summary, I believe you will need closed-loop hardware that contains the imu, takes servo position requests, modifies them for the calculated error, and outputs the new servo position. Technically, this can all be done in an EZB for Arduino. But it's going to be very specific to your configuration/design.
DJ, Thanks for your insight on this and the challenges faced with it. I know I will most likely not be able to provide a complete perfect solution based on your feedback, but if I can get a better idea of how things work in ARC maybe I can hack a kind of solution together.
So my first question for you I need confirmed is:
The Auto Position Start Script and Auto Position End Script runs every time frame or action takes place? Meaning if you have an action that has 10 frames the Auto Position Start Script and Auto Position End Script runs only once and not for every one of the 10 frames? Can you confirm this is correct?
I have thought about using the MPU to also control the Hips and Ankles for side to side stability to a point before the the script would kick off a Auto Position action to kick out a leg and any other movements needed to stop it from falling over. Same kind of concept you used to make JD do to standup he was on his back.
But I agree the key is going to be making sure the MPU script is not in conflict with the Auto Position actions.
Correct me if I am wrong I would think that I could have more that one script that using the MPU output Var's.
The following is a look at the legs for this project. The rest of the upper body will also need to be factored into the needed movement for balance but for right now I am just focusing on the leg movements.
Hmm, I wouldn’t recommend using the Auto Position start and stop script. Maybe instead have a script running at all time in the background in another control.
for things like summersault and such, the script can use IF conditions to check if it should bother keeping balance.
so yeah, what I’ll do is add the offset function in the next build of arc. That way, you can always keep an offset for the body to be upright from the imu, even when the Auto Position or other scripts are running.
Wow that would be nice thank DJ!
So if I went with a script and wanted to skip processing while the Auto Position Skill is making movements I could use the $AutoPositionStatus correct?
Question can we also add offsets to the MPU skill so it can be calibrated like you can in the Arduino code? See Below:
I have used this to help adjust the MPU in Arduino code using the MPU6050_6Axis_MotionApps20.h lib. I am not sure it is needed with your MPU skill.
The skill is "MPU6050 Accelerometer Gyro Temperature".
The above code allows you to calibrate the MPU because every MPU different so this can help zero MPU.
smiller29, You do great work,
ever check out James Bruton https://youtu.be/vGV42NZpT34
He has many videos on his YouTube channel on this.
just a thought, be well.
You keep mentioning placing scripts in the AutoPosition skill. Mainly the AP start and stop. Then mention that you're worried about this script running darning several frames. You may already know this but inside the Action section of the AP you can add scripts to each of the actions you've made if desired. Also you can drill down deeper and add a script to one or more Frames that went into making an Action. To add a script to an entire Action there is a button at the top of the frame list window on the right side of the Action section. To add a script the any Frame in that list, highlight the frame you want and click on the Edit button to the right if this list.
I know it sounds like you're now moving in a different direction but I though this may help somehow.
Cheers! Keep having fun!
Legs look great. Are you going to open source. There is a lot of height in these for such small feet especially when you add a body and arms. I think you are going to struggle when he stands on one leg to walk. May want to enlarge feet and put servos directly on top of each other to lower Center of gravity.
EzAng I have reviewed everything Jeff has posted he is one of the reasons I am doing this project. Thank you for posting the link.
Dave, I really have not decided yet on my path it could end up being a combination of many methods. The information you shared is great and could really help me come up with a solution going forward so thank you for your post.
Nink, these legs are a work in progress of mine and another builder Chris Calleja we have improved the current Youbionic X1 leg and hip design and also the the shoulders and arms. More to come on that in the future. At some point I feel we will release all these changes to the public, but for now we are still going through the R&D process to complete the new version XR-1.
The legs are very strong all joints have ball bearings and there is no structural load on the servo motors. At this point the movements seem very repeatable and the balance is very good. We located as much of the weight as we could in the hips and with the universal joints we have a full range of motion.
OK great I look forward to watching progress. I have thought about using BLDCs and reaction wheels in the head or body of a robot to control the ballance.
Nink, those are cool but I would think they would need to be located in the hips to work and the size of something like that would be very problematic.
The close loop device DJ talked about sounds like the best way of doing this. I just wish I knew how to make a device like this but at the same time I don’t want to have a need to have one of these devices that need IMU corrections.
like in my case let’s say I wanted to add side to side stability it would require at a minimum 4 servos and 6 if I also want to add the torso and 8 if I wanted to add the head. This does include the arms.
This is why I am wanting to put one MPU in the hip where the center of gravity is in the robot and try to find a way to use the features in ARC develop a solution.
The two functions were added for the release this week.
https://synthiam.com/Support/javascript-api/Servo/setFineTuneOffset and https://synthiam.com/Support/javascript-api/Servo/getFineTuneOffset
For both JavaScript and Python
So DJ, if I understand this correctly using the setFineTuneOffset would be like trimming the servo? Use case I need a joint to be 90 degrees but to get it at 90 degrees the servo needs to be at 93 degrees I could set the setFineTuneOffset +3 so when I tell the servo to go to 90 it will really move it to 93. If this is also a global setting this is really going to be helpful. Thank you for making the changes!!!
@athena give me a summary of this support topic please.
The customer, smiller29, is working on a biped robot project and wants to add stability logic within the movements of the auto positions and also when no Auto Position frames or actions are actively moving. They are considering using the MPU6050 skill to control the hips and ankles for side-to-side stability. DJ suggested modifying the offset of the hip servos by an imu script to maintain an upright position. The customer asked if they should stop the MPU6050 looping script in the Auto Position Start Script and start it back up in the Auto Position End Script. DJ recommended against using the Auto Position Start and Stop Scripts and instead suggested having a script running at all times in the background in another control. DJ also added the offset function in the next build of ARC. The customer also asked if they could add offsets to the MPU skill to calibrate it. DJ was not familiar with what the customer was using and asked for clarification. The customer also shared a picture of the legs for their project and mentioned that they are still going through the R&D process to complete the new version XR-1.
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
@Athena, So if I understand this correctly using the setFineTuneOffset would be like trimming the servo? Use case I need a joint to be 90 degrees but to get it at 90 degrees the servo needs to be at 93 degrees I could set the setFineTuneOffset +3 so when I tell the servo to go to 90 it will really move it to 93. If this is also a global setting this is really going to be helpful. Thank you for making the changes!!!
Yes, that is correct. The setFineTuneOffset function allows you to adjust the servo position by a certain number of degrees. In your use case, you could set the offset to +3 so that when you tell the servo to go to 90 degrees, it will actually move to 93 degrees. This is a global setting, so it will apply to all instances of that servo. I'm glad that this change will be helpful for your project!
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
@Athena, thank you for confirmation.
You're welcome! If you have any more questions, feel free to ask.
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.