11 using namespace se2ez;
14 : data(Eigen::VectorXd::Zero(robot.getNumJoints())), frames(
std::make_shared<
FrameMap>(robot))
17 for (
const auto &pair : robot.
getJoints())
19 const auto &frame = pair.second;
20 const auto &joint = frame->frame->getJoint();
22 joint.enforceBounds(
data);
30 for (
const auto &pair : robot->getJoints())
32 const auto &frame = pair.second;
33 const auto &joint = frame->frame->getJoint();
35 joint.enforceBounds(
data);
41 robot->getFrameValues(name,
data)[0] = value;
47 robot->getFrameValues(name,
data) = value;
59 robot->getFrameValues(name,
data) = value;
65 for (
const auto &fname : robot->getFrameNames())
67 const auto &frameData = robot->getFrameDataConst(fname);
68 frameData->frame->getJoint().setRandom(frameData->getValues(
data));
96 return frames->getEntryConst(frame).pose;
101 return robot->getJacobian(frame,
data,
frames).jacobian;
110 return frames->getEntryConst(frame).geometry;
115 return frames->printFrames(robot);
const tf::EigenVector< Eigen::Isometry2d > & getGeometryPoses(const RobotPtr &robot, const std::string &frame)
Get the poses of geometry attached to a frame of the robot. fk() must be called before calling this f...
FrameMapPtr frames
Frame poses.
A shared pointer wrapper for se2ez::State.
Eigen::Vector3d flattenIsometry(const Eigen::Isometry2d &frame)
Converts a transformation frame into a vector [x, y, t] composed of a translation (x...
const Eigen::Isometry2d & getPose(const RobotPtr &robot, const std::string &frame)
Get the pose of a frame of the robot. fk() must be called before calling this function.
void setTranslateJoint(const RobotPtr &robot, const std::string &name, const Eigen::Vector2d &value)
Sets the value of a frame with a translation joint.
std::string printFrames(const RobotPtr &robot) const
Print out the current value of all frames on the robot.
void copy(const StatePtr &other)
Copies the configuration from another state.
Map of frame name to a pair of that describes if the transform is "dirty" (needs updating) and its cu...
A representation of a robot (in this case, a kinematic tree in the plane).
void fk(const RobotPtr &robot)
Compute the forward kinematics for all frames in the robot.
State(const Robot &robot)
Constructor.
A shared pointer wrapper for se2ez::Robot.
const std::vector< std::pair< std::string, FrameDataPtr > > & getJoints() const
Get the ordered list of active joints in this robot with their associated frame information.
const Eigen::MatrixXd & getJacobian(const RobotPtr &robot, const std::string &frame)
Get the jacobian of a frame of the robot.
void setRandom(const RobotPtr &robot)
Sets a random value to the state.
Eigen::VectorXd data
Configuration vector.
void setJoint(const RobotPtr &robot, const std::string &name, double value)
Sets the value of a frame with one joint parameter.
void setFloatJoint(const RobotPtr &robot, const std::string &name, const Eigen::Isometry2d &value)
Sets the value of a frame with a floating joint.