Skip to content

Commit 2b6ed9b

Browse files
committed
add 0 eef
1 parent b229bac commit 2b6ed9b

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ An example for the Franka Panda is given below:
6666
"name": "Panda",
6767
"urdf": "panda/panda_spherized.urdf",
6868
"srdf": "panda/panda.srdf",
69-
"end_effector": "panda_grasptarget",
69+
"end_effectors": ["panda_grasptarget"],
7070
"resolution": 32,
7171
"template": "templates/fk_template.hh",
7272
"subtemplates": [{"name": "ccfk", "template": "templates/ccfk_template.hh"}],
7373
"output": "panda_fk.hh"
7474
}
7575
```
7676

77-
For a custom robot, you only need to change the `name`, `urdf`, `srdf`, and `end_effector` fields.
77+
For a custom robot, you only need to change the `name`, `urdf`, `srdf`, and `end_effectors` fields.
7878
Some notes:
7979
- If your robot does not have an SRDF, then the script will attempt to guess the self-collisions of the robot by randomly sampling one million configurations and seeing what is always in collision and what never collides. However, this is unreliable and probably should just be done by hand.
8080
- If you do not provide an end-effector, the last frame in the robot will be used. For serial link manipulators, this is probably the tool frame, but you should set this yourself.
@@ -130,7 +130,7 @@ In addition to the specified input fields from the configuration file, the scrip
130130
- `bound_lower`: lower bound of joint ranges.
131131
- `bound_range`: range between lower and upper bound of joint ranges.
132132
- `measure`: total measure of robot joint space.
133-
- `end_effector_index`: frame index of end-effector.
133+
- `end_effector_indexes`: frame index of end-effector.
134134
- `min_radius`: minimum sphere radius on robot.
135135
- `max_radius`: maximum sphere radius on robot.
136136
- `joint_names`: name of joint corresponding to each DoF.

resources/templates/fk_template.hh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct {{name}}
1818
static constexpr std::size_t resolution = {{resolution}};
1919

2020
static constexpr std::array<std::string_view, dimension> joint_names = {"{{join(joint_names, "\", \"")}}"};
21-
static constexpr char* end_effectors[] ={ {% for eef in end_effectors %}'{{eef}}'{%endfor %} };
21+
static constexpr std::array<std::string_view, {{num_end_effectors}}> end_effectors ={"{{join(end_effectors, "\", \"")}}"};
2222
2323
using Configuration = FloatVector<dimension>;
2424
using ConfigurationArray = std::array<FloatT, dimension>;
@@ -182,7 +182,8 @@ struct {{name}}
182182
{% include "ccfk" %}
183183
184184
// attaching at {{ end_effectors }}
185-
set_attachment_pose(environment, to_isometry(&y[{{ccfkee_code_output - 12}}]));
185+
// provide the eef pose of all end effectors.
186+
set_attachment_pose(environment, to_isometries<{{num_end_effectors}}>(&y[{{ccfkee_code_output - 12 * num_end_effectors}}]));
186187
187188
//
188189
// attachment vs. environment collisions
@@ -225,14 +226,14 @@ struct {{name}}
225226
return true;
226227
}
227228
228-
static inline auto eefk(const std::array<float, {{n_q}}> &x) noexcept -> Eigen::Isometry3f
229+
static inline auto eefk(const std::array<float, {{n_q}}> &x) noexcept -> std::array<Eigen::Isometry3f, {{num_end_effectors}}>
229230
{
230231
std::array<float, {{eefk_code_vars}}> v;
231232
std::array<float, {{eefk_code_output}}> y;
232233
233234
{{eefk_code}}
234235
235-
return to_isometry(y.data());
236+
return to_isometries<{{num_end_effectors}}>(y.data());
236237
}
237238
};
238239
}

src/fkcc_gen.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ struct RobotInfo
111111
else
112112
end_effector_names.push_back(end_effector);
113113
}
114+
if (end_effector_names.size() == 0)
115+
{
116+
end_effector_names.push_back(model.frames[model.nframes - 1].name);
117+
fmt::print("No EE provided, using distal link `{}`.\n", end_effector_names[0]);
118+
}
114119

115120
for(const auto end_effector_name: end_effector_names)
116121
end_effector_indexes.push_back(model.getFrameId(end_effector_name));
@@ -131,8 +136,8 @@ struct RobotInfo
131136
json["bound_descale"] = std::vector<float>(bound_descale.data(), bound_descale.data() + model.nq);
132137
json["measure"] = bound_range.prod();
133138
json["end_effectors"] = end_effector_names;
134-
std::cout << "Num eefs : " << end_effector_names.size() << std::endl;
135139
json["end_effector_indexes"] = end_effector_indexes;
140+
json["num_end_effectors"] = end_effector_names.size();
136141
json["min_radius"] = min_radius;
137142
json["max_radius"] = max_radius;
138143
json["joint_names"] = dof_to_joint_names();

0 commit comments

Comments
 (0)