Hexapod object doesn't check whether the angles are within range as set in `settings.py`
Closed this issue · 8 comments
Should it? The IK solver checks it, and the widget slider constraints the angles as well.
@mithi I would like to help - but could you be a little more clearer what it is that needs to be changed and where exactly.
Right now, I feel like I have to guess a little bit.....OR I just don't understand!
@mithi I would like to help - but could you be a little more clearer what it is that needs to be changed and where exactly.
Right now, I feel like I have to guess a little bit.....OR I just don't understand!
Thanks for your interesting in making helping with this project!
What I meant was, to check it the poses
are within range before updating the VirtualHexapod
hexapod-robot-simulator/hexapod/models.py
Line 119 in ccbdfdb
You can make a helper function ie
def poses_within_range(poses):
which can be called
if not poses_within_range(poses):
raise Exception(f"❗Some of the values in {poses} are not within range")
or something like that.
Hope that helps!
Don't forget to test your code to make sure you didn't break anything! Enjoy!
@mithi i was having trouble logging into git for the past days, but seeing your note now.
thanks, for the update, i think i get it and can get to work.
@mithi a couple issues here:
- self.legs[i].change_pose(pose["coxia"], pose["femur"], pose["tibia"]) is updating the dimensions of the robot NOT the leg pattern angles. (models.py - line 127)
- the default dimensions are no assigned/declared in settings.py
- def update(self, poses, assume_ground_targets=True): is NOT updating leg pattern angles as implied by this issue.
i am not asking to be spoon fed, but it looks like there is a bit of contradiction, if you can clarify when you get a moment.
thanks!
Hi @markkulube ,
I'm sorry but I don't think you understand how the program works. Your first and third point is incorrect.
First of all, I'm sorry that the naming convention is confusing you. I understand where the confusion is coming from. This is because coxia
, femur
, and tibia
names are referring to the lengths / dimensions of the hexapod in the dimensions dictionary. But coxia
, femur
, and tibia
in the poses and pattern poses dictionary are referring to the angles made by each pose.
You will be able to infer this information by looking at the following files:
The coxia
, femur
, and tibia
, here are referring to lengths of the hexapod
hexapod-robot-simulator/hexapod/const.py
Lines 10 to 17 in ccbdfdb
The coxia
, femur
, and tibia
is referring to angles here in degrees
hexapod-robot-simulator/hexapod/templates/pose_template.py
Lines 1 to 19 in ccbdfdb
If you look at the pattern pose page
hexapod-robot-simulator/pages/page_patterns.py
Lines 59 to 61 in ccbdfdb
You will see it invokes the make_pose
function, which assigns the alpha
, beta
and gamma
to each leg respectively.
hexapod-robot-simulator/pages/helpers.py
Lines 20 to 30 in ccbdfdb
Which means it will be
pose = {
0: {"coxia": alpha, "femur": beta, "tibia": gamma, "name": "right-middle", "id": 0},
1: {"coxia": alpha, "femur": beta, "tibia": gamma, "name": "right-front", "id": 1},
2: {"coxia": alpha, "femur": beta, "tibia": gamma, "name": "left-front", "id": 2},
3: {"coxia": alpha, "femur": beta, "tibia": gamma, "name": "left-middle", "id": 3},
4: {"coxia": alpha, "femur": beta, "tibia": gamma, "name": "left-back", "id": 4},
5: {"coxia": alpha, "femur": beta, "tibia": gamma, "name": "right-back", "id": 5},
}
If you look at the kinematics and pattern pages of the app, you will find the following lines
hexapod-robot-simulator/pages/page_kinematics.py
Lines 46 to 49 in ccbdfdb
hexapod-robot-simulator/pages/page_patterns.py
Lines 39 to 42 in ccbdfdb
Which is practically identical.
It gives the pose, (which is a dictionary which contains the 18 poses, 3 angles for each of the 6 legs, 18 total) to the update
method to update the points of the hexapod.
You will also see it in this function which is a function that the inverse kinematics page calls.
hexapod-robot-simulator/hexapod/ik_solver/recompute_hexapod.py
Lines 25 to 26 in ccbdfdb
I'm sorry that all of this are confusing to you. This is my first-time creating an first-timers-only
issue, I will be removing this the first-timers-only
tag in this issue and closing this issue, as it seems that it's not as straightforward as I thought it would be given the non-trivial size of the project; and taking into the account that this project has very little documentation.
@mithi THANK YOU for the very detailed explanation. I think with this i should be able to navigate better through the project.
I am sure it goes without saying, that variable names should be used consistently even if appearing in different modules/functions/classes etc.
Removing thw tags is reasonable, while this really a simple issue, it demands a quite a bit more than what is normally reserved for first-timers-only / good-first-issue tags.
Such issues are really meant to acquaint the first time with forking, cloning, and the PR sequence. For instance renaming coxia, femur, and tibia to distinguish between where said variables/keys refer angle and length/dimension. Obviously you would need to be explicit as to where the renaming takes place that is to the very line.
That being said, you've, put in a lot of effort in clarifying here, so I in want to see this issue through.
Thanks again!
@mithi THANK YOU for the very detailed explanation. I think with this i should be able to navigate better through the project..
That being said, you've, put in a lot of effort in clarifying here, so I in want to see this issue through.
Thanks again!
Enjoy! ❤️
@mithi Thanks. PS: I am also being stretched from my coop/internship. This still remains on my todo list, but please bear with me.