1 #ifndef HRICS_OTPMOTIONPL_HPP
2 #define HRICS_OTPMOTIONPL_HPP
12 #include "API/planningAPI.hpp"
14 #include "API/Trajectory/trajectory.hpp"
15 #include "planner/planner.hpp"
17 #include "HRICS_Workspace.hpp"
19 #include "Grid/HRICS_EnvGrid.hpp"
20 #include "Grid/HRICS_TwoDGrid.hpp"
21 #include "utils/OtpUtils.hpp"
22 #include "utils/ConfGenerator.h"
24 #include "LightPlanner-pkg.h"
25 #include "planner/TrajectoryOptim/plannarTrajectorySmoothing.hpp"
31 #include <Eigen/StdVector>
33 extern std::string global_ActiveRobotName;
36 extern Eigen::Vector3d current_WSPoint;
37 extern std::pair<double,Eigen::Vector3d > current_cost;
59 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
68 Robot* getHuman() {
return m_Human; }
71 EnvGrid* getPlanGrid() {
return m_2DGrid; }
72 std::vector<Eigen::Vector3d> getOTPList() {
return m_OTPList; }
73 int getNbConf(){
return m_confList.size(); }
75 Eigen::Vector3d getHumanActualPos();
76 Eigen::Vector3d getRobotActualPos();
78 void clearOTPList() { m_OTPList.clear(); }
82 std::vector<double> getHumanPos(){
return m_humanPos;}
83 Eigen::Vector3d getRobotPos(){
return m_robotPos;}
85 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > getRobotTraj(){
return m_2DPath;}
86 void setRobotTraj(std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > traj){m_2DPath = traj;}
88 std::vector<double> getMultipleData(){
return m_multipleData;}
90 double getInitTime() {
return initTime;}
91 void setInitTime(
double d) {initTime = d;}
188 std::pair<std::tr1::shared_ptr<Configuration>, std::tr1::shared_ptr<Configuration> >
setRobotsToConf(
int id,
bool isStanding);
194 std::pair<std::tr1::shared_ptr<Configuration>, std::tr1::shared_ptr<Configuration> >
setRobotsToConf(
int id,
bool isStanding,
double x,
double y,
double Rz);
259 void setInputs( Eigen::Vector3d humanPos, Eigen::Vector3d robotPos,
bool isStanding,
double mobility);
285 void sortConfigList(
double nbNode,
bool isStanding,
bool isSlice);
290 bool testCol(
bool isHuman,
bool useConf);
335 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> >
smoothTrajectory(
336 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > trajectory);
424 bool getOtp(std::string humanName, Eigen::Vector3d &dockPos, std::vector<SM_TRAJ>& smTraj, configPt& handConf,
bool isStanding,
double objectNessecity);
430 bool getOtp(std::string humanName, Eigen::Vector3d &dockPos, std::vector<std::pair<double,double> >& traj, configPt& handConf,
bool isStanding,
double objectNessecity);
435 bool getOtp(std::string humanName, std::vector<std::vector<double> >& traj, configPt& handConf,
bool isStanding,
double objectNessecity);
452 bool getSimplePath(
double x,
double y,
double theta, std::vector<std::vector<double> >& path);
474 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > m_2DPath;
479 std::vector<Eigen::Vector3d,Eigen::aligned_allocator<Eigen::Vector3d> > m_robotTraj3D;
484 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > m_2DHumanPath;
489 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > m_2DHumanRealPath;
494 ManipulationPlanner* m_ManipPl;
499 ManipulationPlanner* m_ManipPlHum;
509 bool m_HumanPathExist;
514 std::vector<Eigen::Vector3d> m_OTPList;
519 std::vector<ConfigHR> m_configList;
524 std::vector<ConfigHR> m_sittingConfigList;
529 std::vector<ConfigHR> m_configListSlice;
534 std::vector<ConfigHR> m_sittingConfigListSlice;
544 std::vector<OutputConf> m_confList;
554 Eigen::Vector3d m_sliceVect;
559 bool m_humanCanStand;
569 double m_sittingTime;
575 std::vector<double> m_multipleData;
580 Robot* m_simpleChair;
585 std::vector<std::vector<double> > m_multipliComputeCostVector;
590 std::vector<std::vector<double> > m_multipliComputeTimeVector;
595 std::vector<double> m_costVector;
600 std::vector<double> m_timeVector;
605 std::vector<SM_TRAJ> m_smTrajs;
615 std::vector<Eigen::Vector3d,Eigen::aligned_allocator<Eigen::Vector3d> > m_testedVectors;
621 std::vector<double> m_humanPos;
622 Eigen::Vector3d m_robotPos;
646 #endif // HRICS_OTPMOTIONPL_HPP
void saveCostsTofile(double cost, double randomCost)
save the costs to a file
Definition: HRICS_otpmotionpl.cpp:2442
int loadConfsFromXML(std::string filename, bool isStanding, bool isSlice)
load configs from filename and put them, either in sitting or standing list in the correct vector...
Definition: HRICS_otpmotionpl.cpp:355
Definition: OtpUtils.hpp:32
void setRobotPos()
set robotPos to actual pos
Definition: HRICS_otpmotionpl.cpp:828
Robot * _Robot
Le Robot pour lequel la recherche va se faire.
Definition: planner.hpp:174
bool isTheRealNearThePredicted(double threshold)
compare the real trajectory with the predicted trajectory
Definition: HRICS_otpmotionpl.cpp:837
bool standUp()
Put human to a standing position the standing postition is right in from of him if there is no obstac...
Definition: HRICS_otpmotionpl.cpp:2951
void initAll()
called for initialisation
Definition: HRICS_otpmotionpl.cpp:128
void dumpVar()
writing variable
Definition: HRICS_otpmotionpl.cpp:3070
bool ComputePR2Gik()
Compute only PR2 GIK.
Definition: HRICS_otpmotionpl.cpp:268
void getInputs()
getting the inputs from a unique source.
Definition: HRICS_otpmotionpl.cpp:786
std::vector< Eigen::Vector2d, Eigen::aligned_allocator< Eigen::Vector2d > > smoothTrajectory(std::vector< Eigen::Vector2d, Eigen::aligned_allocator< Eigen::Vector2d > > trajectory)
generate a smoothed 2D traj
Definition: HRICS_otpmotionpl.cpp:2800
OutputConf findBestPosForHumanSitConf(double objectNecessity)
if the human is stitting, special features should be than.
Definition: HRICS_otpmotionpl.cpp:1829
bool InitMhpObjectTransfert(std::string humanName)
initialisation of OTP computing for usage in mhp
Definition: HRICS_otpmotionpl.cpp:3181
bool hasHumanMovedAccordingToPlan(double error)
test if the human has moved according to the plan (3d and sitting)
Definition: HRICS_otpmotionpl.cpp:3745
void initTrajTest()
init the class to begin testing
Definition: HRICS_otpmotionpl.cpp:2855
Plannar HRI Grid.
Definition: HRICS_EnvGrid.hpp:14
void sortConfigList(double nbNode, bool isStanding, bool isSlice)
sort configuration stored by confort cost
Definition: HRICS_otpmotionpl.cpp:517
bool testCurrentTraj()
test if current traj is feasable
Definition: HRICS_otpmotionpl.cpp:2840
bool newComputeOTP()
Compute the OTP using the last algorithme.
Definition: HRICS_otpmotionpl.cpp:1232
void clearConfList()
clear the list of confs
Definition: HRICS_otpmotionpl.cpp:402
void showBestConfRobOnly()
show the best computed conf for the robot only
Definition: HRICS_otpmotionpl.cpp:2198
void saveAlltimesToFile()
save all the times computed in multipli conpute OTP in a file
Definition: HRICS_otpmotionpl.cpp:2396
bool isAlreadyTested(Eigen::Vector3d p)
test if the vector has already been computed
Definition: HRICS_otpmotionpl.cpp:3554
double getConfigCost()
getting the true configuration cost (musculoskeletal, dist, Fov)
Definition: HRICS_otpmotionpl.cpp:3736
double showConf(unsigned int i)
show a computed conf from it's number in the list
Definition: HRICS_otpmotionpl.cpp:2138
OutputConf showBestConf()
show the best computed conf
Definition: HRICS_otpmotionpl.cpp:2171
Motion Planing for an object transfert point.
Definition: HRICS_otpmotionpl.hpp:55
void clearCostsfile()
clear the file before saving costs
Definition: HRICS_otpmotionpl.cpp:2467
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
void initPR2GiveConf()
set Pr2 to a giving configuration
Definition: HRICS_otpmotionpl.cpp:284
OutputConf lookForBestLocalConf(double x, double y, double Rz, double objectNecessity)
Used in newComputeOTP(), this function compoute a conf for human an robot from a position (x...
Definition: HRICS_otpmotionpl.cpp:1621
void saveAllCostsToFile()
save all the costs computed in multipli conpute OTP in a file
Definition: HRICS_otpmotionpl.cpp:2302
void clearRealTreajectory()
clear real trajectory
Definition: HRICS_otpmotionpl.hpp:274
bool getSimplePath(double x, double y, double theta, std::vector< std::vector< double > > &path)
get a simple path
Definition: HRICS_otpmotionpl.cpp:3706
void goToNextStep()
go to the next position of the cylinder
Definition: HRICS_otpmotionpl.cpp:2876
void addVectorToRealTreajectory(Eigen::Vector2d vect)
adding path to real trajectory
Definition: HRICS_otpmotionpl.cpp:3543
double getrotFromCell(int x, int y)
get rotation from human or robot of a cell.
Definition: HRICS_otpmotionpl.cpp:2291
double ComputePlanarDistancesLineToSegment(Eigen::Vector2d p, Eigen::Vector2d p1, Eigen::Vector2d p2)
compute a distance in a planar grid between a point (p) and a segment [p1,p2]
Definition: HRICS_otpmotionpl.cpp:938
std::tr1::shared_ptr< Configuration > getBestConf()
get best conf
Definition: HRICS_otpmotionpl.cpp:2185
double getDistFromCell(int x, int y, bool isHuman)
get distance from human or robot of a cell.
Definition: HRICS_otpmotionpl.cpp:2276
Definition: TwoDGrid.hpp:25
configPt getRobotConfigAt(int i)
return the config at i in the selected config list
Definition: HRICS_otpmotionpl.cpp:2489
Definition: plannarTrajectorySmoothing.hpp:13
double multipliComputeOtp(int n)
compute OTP using newComputeOTP() n time, the returning the average
Definition: HRICS_otpmotionpl.cpp:654
bool createTrajectoryFromOutputConf(OutputConf conf)
create a trajectory from a configuration
Definition: HRICS_otpmotionpl.cpp:2527
void dumpCosts()
write cost of current configList
Definition: HRICS_otpmotionpl.cpp:3432
int getConfListSize()
return the size of the selected config list
Definition: HRICS_otpmotionpl.cpp:2477
bool getRandomPoints(double id, Vector3d &vect)
return the randomly choosed x, y and Rz.
Definition: HRICS_otpmotionpl.cpp:989
bool testTrajectories(bool fullbody)
test pr2Softmotion
Definition: HRICS_otpmotionpl.cpp:3569
bool getOtp(std::string humanName, Eigen::Vector3d &dockPos, std::vector< SM_TRAJ > &smTraj, configPt &handConf, bool isStanding, double objectNessecity)
function to be called from codels for softmotion usage
Definition: HRICS_otpmotionpl.cpp:3271
void saveInitConf()
save the actual robot and human conf to reload it afterwards
Definition: HRICS_otpmotionpl.cpp:2107
bool finalConfAchieved(double humanError, double robotError)
check if the human has reached his destination with an error
Definition: HRICS_otpmotionpl.cpp:3790
double getHumanRobotDist()
return distance between human and robot
Definition: HRICS_otpmotionpl.cpp:2924
bool changeHumanByName(std::string humanName)
Change Human (in case of multiple human in the scenne)
Definition: HRICS_otpmotionpl.cpp:3472
void setInputs(Eigen::Vector3d humanPos, Eigen::Vector3d robotPos, bool isStanding, double mobility)
setting the inputs !!
Definition: HRICS_otpmotionpl.cpp:772
void initGrid()
init the plan grid with the costs and the distances
Definition: HRICS_otpmotionpl.cpp:2205
bool testCol(bool isHuman, bool useConf)
testing collision for human and robot
Definition: HRICS_otpmotionpl.cpp:2068
std::vector< ConfigHR > getConfList()
return the selected config list
Definition: HRICS_otpmotionpl.cpp:2501
std::pair< double, double > computeHumanRobotDist()
return the minimal and maximal dist between human and robot in the loaded configuration ...
Definition: HRICS_otpmotionpl.cpp:2881
Definition: ConfGenerator.h:51
void loadInitConf(bool reloadHuman, bool reloadRobot)
reload the saved human and robot conf
Definition: HRICS_otpmotionpl.cpp:2118
std::pair< std::tr1::shared_ptr< Configuration >, std::tr1::shared_ptr< Configuration > > setRobotsToConf(int id, bool isStanding)
chamge robot configuration to the one with the specified id in the correct list return a pair of the ...
Definition: HRICS_otpmotionpl.cpp:408
Base class for the HRICS motion planners.
Definition: HRICS_Workspace.hpp:37
void draw2dPath()
Draws the 3D path as a yellow line for robot and green one for human.
Definition: HRICS_otpmotionpl.cpp:193
void navigate()
planning using planNavigation
Definition: HRICS_otpmotionpl.cpp:2819
void compteTraj(bool compute)
to compute traj or not
Definition: HRICS_otpmotionpl.cpp:3548
void setVar()
setting variables
Definition: HRICS_otpmotionpl.cpp:3125
void placeHuman()
Compute human GIK.
Definition: HRICS_otpmotionpl.cpp:345
int copyConfList()
copy the list of confs from the confGenerator if possible.
Definition: HRICS_otpmotionpl.cpp:389