29 int main(
int argc,
char **argv)
35 auto cob4 = std::make_shared<Cob4Robot>();
43 RBX_INFO(
"RViz Initialized! Press enter to continue (after your RViz is setup)...");
51 cob4->setGroupState(
RIGHT_ARM, {2.69, 1.70, -0.91, 1.50, -2.14, -2.35, 1.06});
52 cob4->setGroupState(
LEFT_ARM, {-1.14, -1.50, 0.34, -1.50, 0.43, -1.56, -1.20});
55 auto scene = std::make_shared<Scene>(cob4);
56 scene->fromYAMLFile(
"package://robowflex_library/yaml/test_cob4.yml");
63 auto planner = std::make_shared<OMPL::Cob4OMPLPipelinePlanner>(cob4);
64 planner->initialize();
67 cob4->pointHead({0.6, -0.26, 0.95});
74 const auto &goal_pose_right =
TF::createPoseQ(0.6, -0.26, 0.95, 1.0, 0.0, 0.0, 0.0);
82 RBX_INFO(
"Scene and Goal displayed for the right arm! Press enter to plan...");
86 request_right_arm.
setConfig(
"RRTConnect");
88 if (res.
error_code_.val != moveit_msgs::MoveItErrorCodes::SUCCESS)
96 auto right_arm_trajectory = std::make_shared<Trajectory>(res.
trajectory_);
97 cob4->setGroupState(
RIGHT_ARM, right_arm_trajectory->vectorize().
back());
101 RBX_INFO(
"Press enter to continue with the left arm.");
104 cob4->pointHead({0.4, 0.26, 0.79});
111 const auto &goal_pose_left =
TF::createPoseQ(0.38, 0.26, 0.76, 0.0, 0.707, 0.0, 0.707);
119 RBX_INFO(
"Scene and Goal displayed for the left arm! Press enter to plan...");
123 request_left_arm.
setConfig(
"RRTConnect");
125 if (res.
error_code_.val != moveit_msgs::MoveItErrorCodes::SUCCESS)
132 auto left_arm_trajectory = std::make_shared<Trajectory>(res.
trajectory_);
133 cob4->setGroupState(
LEFT_ARM, left_arm_trajectory->vectorize().
back());
137 RBX_INFO(
"Press enter to remove goal and scene.");
RVIZ visualization helper. See Live Visualization with RViz for more information.
void removeMarker(const std::string &name)
Removes a marker that was added through addMarker().
void updateMarkers()
Displays the managed list of markers. Keeps track of whether markers have already been displayed and ...
void removeScene()
Removes the scene being visualized.
void visualizeCurrentState()
Visualize the current state of the robot.
void updateScene(const SceneConstPtr &scene)
Updates the scene being visualized.
void addGoalMarker(const std::string &name, const MotionRequestBuilder &request)
Adds the current goal of the motion request builder as a set of markers in the marker array.
void updateTrajectory(const planning_interface::MotionPlanResponse &response)
Updates the trajectory being visualized.
void addTransformMarker(const std::string &name, const std::string &base_frame, const RobotPose &pose, double scale=1)
Add a transform marker to the managed list of markers. Displayed after an updateMarkers() call.
Helper class to broadcast transform information on TF and joint states.
void start()
Begin publishing TF and joint information.
A helper class to build motion planning requests for a robowflex::Planner.
bool setConfig(const std::string &requested_config)
Set the planning configuration to use for the motion planning request. Attempts to match requested_co...
void setStartConfiguration(const std::vector< double > &joints)
Set the start configuration from a vector joints. All joints are assumed to be specified and in the d...
void setGoalPose(const std::string &ee_name, const std::string &base_name, const RobotPose &pose, double tolerance=0.001)
Set a goal pose for the end-effector ee_name. Generates a sphere with radius tolerance as well as ori...
planning_interface::MotionPlanRequest & getRequest()
Get a reference to the currently built motion planning request.
RAII-pattern for starting up ROS.
int main(int argc, char **argv)
static const std::string LEFT_EE
static const std::string LEFT_ARM
static const std::string RIGHT_EE
static const std::string RIGHT_ARM
#define RBX_INFO(fmt,...)
Output a info logging message.
RobotPose createPoseQ(double x, double y, double z, double W, double X, double Y, double Z)
Creates a robot pose from a linear component and a Quaternion.
Main namespace. Contains all library classes and functions.
Functions for loading and animating scenes in Blender.
moveit_msgs::MoveItErrorCodes error_code_
robot_trajectory::RobotTrajectoryPtr trajectory_