moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
robot_state.cpp
Go to the documentation of this file.
1/*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2022, Peter David Fagan
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of PickNik Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34
35/* Author: Peter David Fagan */
36
37#include "robot_state.hpp"
38#include <pybind11/stl.h>
40#include <moveit_msgs/msg/robot_state.hpp>
42
43namespace moveit_py
44{
45namespace bind_robot_state
46{
47void update(moveit::core::RobotState* self, bool force, std::string& category)
48{
49 if (category == "all")
50 {
51 self->update(force);
52 }
53 else if (category == "links_only")
54 {
56 }
57 else if (category == "collisions_only")
58 {
60 }
61 else
62 {
63 throw std::invalid_argument("Invalid category");
64 }
65}
66
67Eigen::MatrixXd getFrameTransform(const moveit::core::RobotState* self, std::string& frame_id)
68{
69 bool frame_found;
70 auto transformation = self->getFrameTransform(frame_id, &frame_found);
71 return transformation.matrix();
72}
73
74Eigen::MatrixXd getGlobalLinkTransform(const moveit::core::RobotState* self, std::string& link_name)
75{
76 auto transformation = self->getGlobalLinkTransform(link_name);
77 return transformation.matrix();
78}
79
80geometry_msgs::msg::Pose getPose(const moveit::core::RobotState* self, const std::string& link_name)
81{
82 return tf2::toMsg(self->getGlobalLinkTransform(link_name));
83}
84
85std::map<std::string, double> getJointPositions(const moveit::core::RobotState* self)
86{
87 std::map<std::string, double> joint_positions;
88 const std::vector<std::string>& variable_name = self->getVariableNames();
89 for (auto& name : variable_name)
90 {
91 joint_positions[name.c_str()] = self->getVariablePosition(name);
92 }
93 return joint_positions;
94}
95
96void setJointPositions(moveit::core::RobotState* self, std::map<std::string, double>& joint_positions)
97{
98 for (const auto& item : joint_positions)
99 {
100 self->setVariablePosition(item.first, item.second);
101 }
102}
103
104std::map<std::string, double> getJointVelocities(const moveit::core::RobotState* self)
105{
106 std::map<std::string, double> joint_velocity;
107 const std::vector<std::string>& variable_name = self->getVariableNames();
108 for (auto& name : variable_name)
109 {
110 joint_velocity[name.c_str()] = self->getVariableVelocity(name);
111 }
112 return joint_velocity;
113}
114
115void setJointVelocities(moveit::core::RobotState* self, std::map<std::string, double>& joint_velocities)
116{
117 for (const auto& item : joint_velocities)
118 {
119 self->setVariableVelocity(item.first, item.second);
120 }
121}
122
123std::map<std::string, double> getJointAccelerations(const moveit::core::RobotState* self)
124{
125 std::map<std::string, double> joint_acceleration;
126 const std::vector<std::string>& variable_name = self->getVariableNames();
127 for (auto& name : variable_name)
128 {
129 joint_acceleration[name.c_str()] = self->getVariableAcceleration(name);
130 }
131 return joint_acceleration;
132}
133
134void setJointAccelerations(moveit::core::RobotState* self, std::map<std::string, double>& joint_accelerations)
135{
136 for (const auto& item : joint_accelerations)
137 {
138 self->setVariableAcceleration(item.first, item.second);
139 }
140}
141
142std::map<std::string, double> getJointEfforts(const moveit::core::RobotState* self)
143{
144 std::map<std::string, double> joint_effort;
145 const std::vector<std::string>& variable_name = self->getVariableNames();
146 for (auto& name : variable_name)
147 {
148 joint_effort[name.c_str()] = self->getVariableEffort(name);
149 }
150 return joint_effort;
151}
152
153void setJointEfforts(moveit::core::RobotState* self, std::map<std::string, double>& joint_efforts)
154{
155 for (const auto& item : joint_efforts)
156 {
157 self->setVariableEffort(item.first, item.second);
158 }
159}
160
161Eigen::VectorXd copyJointGroupPositions(const moveit::core::RobotState* self, const std::string& joint_model_group_name)
162{
163 Eigen::VectorXd values;
164 self->copyJointGroupPositions(joint_model_group_name, values);
165 return values;
166}
167
168Eigen::VectorXd copyJointGroupVelocities(const moveit::core::RobotState* self, const std::string& joint_model_group_name)
169{
170 Eigen::VectorXd values;
171 self->copyJointGroupVelocities(joint_model_group_name, values);
172 return values;
173}
174
176 const std::string& joint_model_group_name)
177{
178 Eigen::VectorXd values;
179 self->copyJointGroupAccelerations(joint_model_group_name, values);
180 return values;
181}
182
183Eigen::MatrixXd getJacobian(const moveit::core::RobotState* self, const std::string& joint_model_group_name,
184 const Eigen::Vector3d& reference_point_position)
185{
186 const moveit::core::JointModelGroup* joint_model_group = self->getJointModelGroup(joint_model_group_name);
187 return self->getJacobian(joint_model_group, reference_point_position);
188}
189
190Eigen::MatrixXd getJacobian(const moveit::core::RobotState* self, const std::string& joint_model_group_name,
191 const std::string& link_model_name, const Eigen::Vector3d& reference_point_position,
192 bool use_quaternion_representation)
193{
194 Eigen::MatrixXd jacobian;
195 const moveit::core::JointModelGroup* joint_model_group = self->getJointModelGroup(joint_model_group_name);
196 const moveit::core::LinkModel* link_model = self->getLinkModel(link_model_name);
197 self->getJacobian(joint_model_group, link_model, reference_point_position, jacobian, use_quaternion_representation);
198 return jacobian;
199}
200
201bool setToDefaultValues(moveit::core::RobotState* self, const std::string& joint_model_group_name,
202 const std::string& state_name)
203
204{
205 const moveit::core::JointModelGroup* joint_model_group = self->getJointModelGroup(joint_model_group_name);
206 return self->setToDefaultValues(joint_model_group, state_name);
207}
208
209void initRobotState(py::module& m)
210{
211 py::module robot_state = m.def_submodule("robot_state");
212
213 robot_state.def(
214 "robotStateToRobotStateMsg",
215 [](const moveit::core::RobotState& state, bool copy_attached_bodies) {
216 moveit_msgs::msg::RobotState state_msg;
217 moveit::core::robotStateToRobotStateMsg(state, state_msg, copy_attached_bodies);
218 return state_msg;
219 },
220 py::arg("state"), py::arg("copy_attached_bodies") = true);
221
222 py::class_<moveit::core::RobotState, std::shared_ptr<moveit::core::RobotState>>(robot_state, "RobotState",
223 R"(
224 Representation of a robot's state. At the lowest level, a state is a collection of variables. Each variable has a name and can have position, velocity, acceleration and effort associated to it. Effort and acceleration share the memory area for efficiency reasons (one should not set both acceleration and effort in the same state and expect things to work). Often variables correspond to joint names as well (joints with one degree of freedom have one variable), but joints with multiple degrees of freedom have more variables. Operations are allowed at variable level, joint level (see JointModel) and joint group level (see JointModelGroup). For efficiency reasons a state computes forward kinematics in a lazy fashion. This can sometimes lead to problems if the update() function was not called on the state.
225 )")
226
227 .def(py::init<const std::shared_ptr<const moveit::core::RobotModel>&>(),
228 R"(
229 Initializes robot state from a robot model.
230
231 Args:
232 :py:class:`moveit_py.core.RobotModel`: The robot model associated to the instantiated robot state.
233
234 )")
235 .def("__copy__", [](const moveit::core::RobotState* self) { return moveit::core::RobotState{ *self }; })
236 .def("__deepcopy__", [](const moveit::core::RobotState* self,
237 py::dict /* memo */) { return moveit::core::RobotState{ *self }; }) // NOLINT
238
239 // Get underlying robot model, frame transformations and jacobian
240 .def_property("robot_model", &moveit::core::RobotState::getRobotModel, nullptr,
241 py::return_value_policy::reference,
242 R"(
243 :py:class:`moveit_py.core.RobotModel`: The robot model instance associated to this robot state.
244 )")
245
246 .def_property("dirty", &moveit::core::RobotState::dirty, nullptr,
247 R"(
248 bool: True if the robot state is dirty.
249 )")
250
251 .def("get_frame_transform", &moveit_py::bind_robot_state::getFrameTransform, py::arg("frame_id"),
252 py::return_value_policy::move,
253 R"(
254 Get the transformation matrix from the model frame (root of model) to the frame identified by frame_id. If frame_id was not found, frame_found is set to false and an identity transform is returned. This method is restricted to frames defined within the robot state and doesn't include collision object present in the collision world. Please use the PlanningScene.getFrameTransform method for collision world objects.
255
256 Args:
257 frame_id (str): The id of the frame to get the transform for.
258
259 Returns:
260 :py:class:`numpy.ndarray`: The transformation matrix from the model frame to the frame identified by frame_id.
261 )")
262
263 .def("get_pose", &moveit_py::bind_robot_state::getPose, py::arg("link_name"),
264 R"(
265 Get the pose of a link that is defined in the robot model.
266
267 Args:
268 link_name (str): The name of the link to get the pose for.
269
270 Returns:
271 geometry_msgs.msg.Pose: A ROS geometry message containing the pose of the link.
272 )")
273
274 .def("get_jacobian",
275 py::overload_cast<const moveit::core::RobotState*, const std::string&, const Eigen::Vector3d&>(
277 py::arg("joint_model_group_name"), py::arg("reference_point_position"), py::return_value_policy::move,
278 R"(
279 Compute the Jacobian with reference to the last link of a specified group.
280
281 Args:
282 joint_model_group_name (str): The name of the joint model group to compute the Jacobian for.
283 reference_point_position (:py:class:`numpy.ndarray`): The position of the reference point in the link frame.
284
285 Returns:
286 :py:class:`numpy.ndarray`: The Jacobian of the specified group with respect to the reference point.
287
288 Raises:
289 Exception: If the group is not a chain.
290 )")
291
292 .def("get_jacobian",
293 py::overload_cast<const moveit::core::RobotState*, const std::string&, const std::string&,
294 const Eigen::Vector3d&, bool>(&moveit_py::bind_robot_state::getJacobian),
295 py::arg("joint_model_group_name"), py::arg("link_name"), py::arg("reference_point_position"),
296 py::arg("use_quaternion_representation") = false, py::return_value_policy::move,
297 R"(
298 Compute the Jacobian with reference to a particular point on a given link, for a specified group.
299
300 Args:
301 joint_model_group_name (str): The name of the joint model group to compute the Jacobian for.
302 link_name (str): The name of the link model to compute the Jacobian for.
303 reference_point_position (:py:class:`numpy.ndarray`): The position of the reference point in the link frame.
304 use_quaternion_representation (bool): If true, the Jacobian will be represented using a quaternion representation, if false it defaults to euler angle representation.
305
306 Returns:
307 :py:class:`numpy.ndarray`: The Jacobian of the specified group with respect to the reference point.
308 )")
309
310 // Get state information
311 .def_property("state_tree", py::overload_cast<>(&moveit::core::RobotState::getStateTreeString, py::const_),
312 nullptr, py::return_value_policy::move,
313 R"(
314 str: represents the state tree of the robot state.
315 )")
316
317 .def_property_readonly_static(
318 "state_info",
319 [](const moveit::core::RobotState& s) {
320 std::stringstream ss;
321 s.printStateInfo(ss);
322 return ss.str();
323 },
324 py::return_value_policy::move,
325 R"(
326 str: the state information of the robot state.
327 )")
328
329 // Getting and setting joint model group positions, velocities, accelerations
330 .def_property("joint_positions", &moveit_py::bind_robot_state::getJointPositions,
331 &moveit_py::bind_robot_state::setJointPositions, py::return_value_policy::copy)
332
333 .def_property("joint_velocities", &moveit_py::bind_robot_state::getJointVelocities,
334 &moveit_py::bind_robot_state::setJointVelocities, py::return_value_policy::copy)
335
336 .def_property("joint_accelerations", &moveit_py::bind_robot_state::getJointAccelerations,
337 &moveit_py::bind_robot_state::setJointAccelerations, py::return_value_policy::copy)
338
339 .def_property("joint_efforts", &moveit_py::bind_robot_state::getJointEfforts,
340 &moveit_py::bind_robot_state::setJointEfforts, py::return_value_policy::copy)
341
342 .def("set_joint_group_positions",
343 py::overload_cast<const std::string&, const Eigen::VectorXd&>(
345 py::arg("joint_model_group_name"), py::arg("position_values"),
346 R"(
347 Sets the positions of the joints in the specified joint model group.
348
349 Args:
350 joint_model_group_name (str):
351 position_values (:py:class:`numpy.ndarray`): The positions of the joints in the joint model group.
352 )")
353
354 // peterdavidfagan: I am not sure if additional function names are better than having function parameters for joint setting.
355 .def("set_joint_group_active_positions",
356 py::overload_cast<const std::string&, const Eigen::VectorXd&>(
358 py::arg("joint_model_group_name"), py::arg("position_values"),
359 R"(
360 Sets the active positions of joints in the specified joint model group.
361
362 Args:
363 joint_model_group_name (str): The name of the joint model group to set the active positions for.
364 position_values (:py:class:`numpy.ndarray`): The positions of the joints in the joint model group.
365 )")
366
367 .def("get_joint_group_positions", &moveit_py::bind_robot_state::copyJointGroupPositions,
368 py::arg("joint_model_group_name"),
369 R"(
370 For a given group, get the position values of the variables that make up the group.
371
372 Args:
373 joint_model_group_name (str): The name of the joint model group to copy the positions for.
374
375 Returns:
376 :py:class:`numpy.ndarray`: The positions of the joints in the joint model group.
377 )")
378
379 .def("set_joint_group_velocities",
380 py::overload_cast<const std::string&, const Eigen::VectorXd&>(
382 py::arg("joint_model_group_name"), py::arg("velocity_values"),
383 R"(
384 Sets the velocities of the joints in the specified joint model group.
385
386 Args:
387 joint_model_group_name (str): The name of the joint model group to set the velocities for.
388 velocity_values (:py:class:`numpy.ndarray`): The velocities of the joints in the joint model group.
389 )")
390
391 .def("get_joint_group_velocities", &moveit_py::bind_robot_state::copyJointGroupVelocities,
392 py::arg("joint_model_group_name"),
393 R"(
394 For a given group, get the velocity values of the variables that make up the group.
395
396 Args:
397 joint_model_group_name (str): The name of the joint model group to copy the velocities for.
398 Returns:
399 :py:class:`numpy.ndarray`: The velocities of the joints in the joint model group.
400 )")
401
402 .def("set_joint_group_accelerations",
403 py::overload_cast<const std::string&, const Eigen::VectorXd&>(
405 py::arg("joint_model_group_name"), py::arg("acceleration_values"),
406 R"(
407 Sets the accelerations of the joints in the specified joint model group.
408
409 Args:
410 joint_model_group_name (str): The name of the joint model group to set the accelerations for.
411 acceleration_values (:py:class:`numpy.ndarray`): The accelerations of the joints in the joint model group.
412 )")
413
414 .def("get_joint_group_accelerations", &moveit_py::bind_robot_state::copyJointGroupAccelerations,
415 py::arg("joint_model_group_name"),
416 R"(
417 For a given group, get the acceleration values of the variables that make up the group.
418
419 Args:
420 joint_model_group_name (str): The name of the joint model group to copy the accelerations for.
421
422 Returns:
423 :py:class:`numpy.ndarray`: The accelerations of the joints in the joint model group.
424 )")
425
426 // Forward kinematics
427 .def("get_global_link_transform", &moveit_py::bind_robot_state::getGlobalLinkTransform, py::arg("link_name"),
428 R"(
429 Returns the transform of the specified link in the global frame.
430
431 Args:
432 link_name (str): The name of the link to get the transform for.
433
434 Returns:
435 :py:class:`numpy.ndarray`: The transform of the specified link in the global frame.
436 )")
437
438 // Setting state from inverse kinematics
439 .def(
440 "set_from_ik",
441 [](moveit::core::RobotState* self, const std::string& group, const geometry_msgs::msg::Pose& pose,
442 const std::string& tip,
443 double timeout) { return self->setFromIK(self->getJointModelGroup(group), pose, tip, timeout); },
444 py::arg("joint_model_group_name"), py::arg("geometry_pose"), py::arg("tip_name"), py::arg("timeout") = 0.0,
445 R"(
446 Sets the state of the robot to the one that results from solving the inverse kinematics for the specified group.
447
448 Args:
449 joint_model_group_name (str): The name of the joint model group to set the state for.
450 geometry_pose (geometry_msgs.msg.Pose): The pose of the end-effector to solve the inverse kinematics for.
451 tip_name (str): The name of the link that is the tip of the end-effector.
452 timeout (float): The amount of time to wait for the IK solution to be found.
453 )")
454
455 // Setting entire state values
456 .def("set_to_default_values", py::overload_cast<>(&moveit::core::RobotState::setToDefaultValues),
457 R"(
458 Set all joints to their default positions.
459 The default position is 0, or if that is not within bounds then half way between min and max bound.
460 )")
461
462 .def("set_to_default_values",
463 py::overload_cast<const moveit::core::JointModelGroup*, const std::string&>(
465 py::arg("joint_model_group"), py::arg("name"),
466 R"(
467 Set the joints in group to the position name defined in the SRDF.
468
469 Args:
470 joint_model_group (:py:class:`moveit_py.core.JointModelGroup`): The joint model group to set the default values for.
471 name (str): The name of a predefined state which is defined in the robot model SRDF.
472 )")
473
474 .def("set_to_default_values",
475 py::overload_cast<moveit::core::RobotState*, const std::string&, const std::string&>(
477 py::arg("joint_model_group_name"), py::arg("name"),
478 R"(
479 Set the joints in group to the position name defined in the SRDF.
480
481 Args:
482 joint_model_group_name (str): The name of the joint model group to set the default values for.
483 name (str): The name of a predefined state which is defined in the robot model SRDF.
484 )")
485
486 .def("set_to_random_positions", py::overload_cast<>(&moveit::core::RobotState::setToRandomPositions),
487 R"(
488 Set all joints to random positions within the default bounds.
489 )")
490
491 .def("set_to_random_positions",
492 py::overload_cast<const moveit::core::JointModelGroup*>(&moveit::core::RobotState::setToRandomPositions),
493 py::arg("joint_model_group"),
494 R"(
495 Set all joints in the joint model group to random positions within the default bounds.
496
497 Args:
498 joint_model_group (:py:class:`moveit_py.core.JointModelGroup`): The joint model group to set the random values for.
499 )")
500
501 .def("clear_attached_bodies", py::overload_cast<>(&moveit::core::RobotState::clearAttachedBodies),
502 R"(
503 Clear all attached bodies. We only allow for attaching of objects via the PlanningScene instance. This method allows any attached objects that are associated to this RobotState instance to be removed.
504 )")
505
506 .def("update", &moveit_py::bind_robot_state::update, py::arg("force") = false, py::arg("type") = "all",
507 R"(
508 Update state transforms.
509
510 Args:
511 force (bool): when true forces the update of the transforms from scratch.
512 category (str): specifies the category to update. All indicates updating all transforms while "links_only" and "collisions_only" ensure that only links or collision transforms are updated. )");
513}
514} // namespace bind_robot_state
515} // namespace moveit_py
A link from the robot. Contains the constant transform applied to the link and its geometry.
Representation of a robot's state. This includes position, velocity, acceleration and effort.
void setVariableAcceleration(const std::string &variable, double value)
Set the acceleration of a variable. If an unknown variable name is specified, an exception is thrown.
const std::vector< std::string > & getVariableNames() const
Get the names of the variables that make up this state, in the order they are stored in memory.
double getVariableAcceleration(const std::string &variable) const
Get the acceleration of a particular variable. An exception is thrown if the variable is not known.
bool getJacobian(const JointModelGroup *group, const LinkModel *link, const Eigen::Vector3d &reference_point_position, Eigen::MatrixXd &jacobian, bool use_quaternion_representation=false) const
Compute the Jacobian with reference to a particular point on a given link, for a specified group.
void copyJointGroupVelocities(const std::string &joint_group_name, std::vector< double > &gstate) const
For a given group, copy the velocity values of the variables that make up the group into another loca...
void setVariableVelocity(const std::string &variable, double value)
Set the velocity of a variable. If an unknown variable name is specified, an exception is thrown.
double getVariableVelocity(const std::string &variable) const
Get the velocity of a particular variable. An exception is thrown if the variable is not known.
void setJointGroupAccelerations(const std::string &joint_group_name, const double *gstate)
Given accelerations for the variables that make up a group, in the order found in the group (includin...
void setJointGroupVelocities(const std::string &joint_group_name, const double *gstate)
Given velocities for the variables that make up a group, in the order found in the group (including v...
void setVariablePosition(const std::string &variable, double value)
Set the position of a single variable. An exception is thrown if the variable name is not known.
void setJointGroupPositions(const std::string &joint_group_name, const double *gstate)
Given positions for the variables that make up a group, in the order found in the group (including va...
void copyJointGroupPositions(const std::string &joint_group_name, std::vector< double > &gstate) const
For a given group, copy the position values of the variables that make up the group into another loca...
const JointModelGroup * getJointModelGroup(const std::string &group) const
Get the model of a particular joint group.
const LinkModel * getLinkModel(const std::string &link) const
Get the model of a particular link.
const RobotModelConstPtr & getRobotModel() const
Get the robot model this state is constructed for.
bool dirty() const
Returns true if anything in this state is dirty.
void updateLinkTransforms()
Update the reference frame transforms for links. This call is needed before using the transforms of l...
std::string getStateTreeString() const
const Eigen::Isometry3d & getFrameTransform(const std::string &frame_id, bool *frame_found=nullptr)
Get the transformation matrix from the model frame (root of model) to the frame identified by frame_i...
void setToRandomPositions()
Set all joints to random values. Values will be within default bounds.
void setVariableEffort(const double *effort)
Given an array with effort values for all variables, set those values as the effort in this state.
void setJointGroupActivePositions(const JointModelGroup *group, const std::vector< double > &gstate)
Given positions for the variables of active joints that make up a group, in the order found in the gr...
void printStateInfo(std::ostream &out=std::cout) const
double getVariablePosition(const std::string &variable) const
Get the position of a particular variable. An exception is thrown if the variable is not known.
void update(bool force=false)
Update all transforms.
void setToDefaultValues()
Set all joints to their default positions. The default position is 0, or if that is not within bounds...
void copyJointGroupAccelerations(const std::string &joint_group_name, std::vector< double > &gstate) const
For a given group, copy the acceleration values of the variables that make up the group into another ...
const Eigen::Isometry3d & getGlobalLinkTransform(const std::string &link_name)
Get the link transform w.r.t. the root link (model frame) of the RobotModel. This is typically the ro...
double * getVariableEffort()
Get raw access to the effort of the variables that make up this state. The values are in the same ord...
void clearAttachedBodies()
Clear all attached bodies. This calls delete on the AttachedBody instances, if needed.
void updateCollisionBodyTransforms()
Update the transforms for the collision bodies. This call is needed before calling collision checking...
bool setFromIK(const JointModelGroup *group, const geometry_msgs::msg::Pose &pose, double timeout=0.0, const GroupStateValidityCallbackFn &constraint=GroupStateValidityCallbackFn(), const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions(), const kinematics::KinematicsBase::IKCostFn &cost_function=kinematics::KinematicsBase::IKCostFn())
If the group this state corresponds to is a chain and a solver is available, then the joint values ca...
void robotStateToRobotStateMsg(const RobotState &state, moveit_msgs::msg::RobotState &robot_state, bool copy_attached_bodies=true)
Convert a MoveIt robot state to a robot state message.
void setJointAccelerations(moveit::core::RobotState *self, std::map< std::string, double > &joint_accelerations)
std::map< std::string, double > getJointAccelerations(const moveit::core::RobotState *self)
Eigen::VectorXd copyJointGroupVelocities(const moveit::core::RobotState *self, const std::string &joint_model_group_name)
Eigen::MatrixXd getJacobian(const moveit::core::RobotState *self, const std::string &joint_model_group_name, const Eigen::Vector3d &reference_point_position)
void setJointEfforts(moveit::core::RobotState *self, std::map< std::string, double > &joint_efforts)
bool setToDefaultValues(moveit::core::RobotState *self, const std::string &joint_model_group_name, const std::string &state_name)
void initRobotState(py::module &m)
Eigen::MatrixXd getGlobalLinkTransform(const moveit::core::RobotState *self, std::string &link_name)
Eigen::VectorXd copyJointGroupAccelerations(const moveit::core::RobotState *self, const std::string &joint_model_group_name)
void update(moveit::core::RobotState *self, bool force, std::string &category)
std::map< std::string, double > getJointEfforts(const moveit::core::RobotState *self)
void setJointVelocities(moveit::core::RobotState *self, std::map< std::string, double > &joint_velocities)
Eigen::VectorXd copyJointGroupPositions(const moveit::core::RobotState *self, const std::string &joint_model_group_name)
geometry_msgs::msg::Pose getPose(const moveit::core::RobotState *self, const std::string &link_name)
void setJointPositions(moveit::core::RobotState *self, std::map< std::string, double > &joint_positions)
std::map< std::string, double > getJointPositions(const moveit::core::RobotState *self)
Eigen::MatrixXd getFrameTransform(const moveit::core::RobotState *self, std::string &frame_id)
std::map< std::string, double > getJointVelocities(const moveit::core::RobotState *self)