Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding absolute path to saveImageCB #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ find_package(graspit)
SearchContact.msg
Energy.msg
Contact.msg
SimAnnParams.msg
)

## Generate services in the 'srv' folder
Expand Down
1 change: 1 addition & 0 deletions action/PlanGrasps.action
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Planner planner
string search_energy
SearchSpace search_space
SearchContact search_contact
SimAnnParams sim_ann_params

int32 max_steps
int32 feedback_num_steps
Expand Down
22 changes: 22 additions & 0 deletions msg/SimAnnParams.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

# flag to switch to custom params defined in this message. If not set, GraspIt's default settings are kept
bool set_custom_params


# //Annealing parameters
# //! Annealing constant for neighbor generation schedule
float64 YC # GraspIt! default: 7.0
# //! Annealing constant for error acceptance schedule
float64 HC # GraspIt! default: 7.0
# //! Number of dimensions for neighbor generation schedule
float64 YDIMS # GraspIt! default: 8.0
# //! Number of dimensions for error acceptance schedule
float64 HDIMS # GraspIt! default: 8.0
# //! Adjust factor for neighbor generation schedule
float64 NBR_ADJ # GraspIt! default: 1.0
# //! Adjust raw errors reported by states to be in the relevant range of the annealing schedule
float64 ERR_ADJ # GraspIt! default: 1.0e-6
# //! Starting temperatue
float64 DEF_T0 # GraspIt! default: 1e6
# //! Starting step
float64 DEF_K0 # GraspIt! default: 30000
29 changes: 25 additions & 4 deletions src/graspit_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <graspit/EGPlanner/searchState.h>
#include <graspit/EGPlanner/egPlanner.h>
#include <graspit/EGPlanner/simAnnPlanner.h>
#include <graspit/EGPlanner/simAnnParams.h>
#include <graspit/EGPlanner/guidedPlanner.h>
#include <graspit/EGPlanner/energy/searchEnergyFactory.h>
#include <graspit/EGPlanner/energy/searchEnergy.h>
Expand Down Expand Up @@ -613,10 +614,16 @@ bool GraspitInterface::clearWorldCB(graspit_interface::ClearWorld::Request &requ
bool GraspitInterface::saveImageCB(graspit_interface::SaveImage::Request &request,
graspit_interface::SaveImage::Response &response)
{
QString filename = QString(getenv("GRASPIT"))+
QString("/images/") +
QString(request.filename.data()) +
QString(".jpg");
QString filename;
std::string filenamePath(request.filename.data());

if(filenamePath[0] == '/')
filename = QString(request.filename.data());
else
filename = QString(getenv("GRASPIT"))+
QString("/images/") +
QString(request.filename.data()) +
QString(".jpg");

ROS_INFO("Saving Image: %s",filename.toStdString().c_str());
graspitCore->getIVmgr()->saveImage(filename);
Expand Down Expand Up @@ -887,6 +894,20 @@ void GraspitInterface::runPlannerInMainThread()

mPlanner->setEnergyType(goal.search_energy);

if (goal.sim_ann_params.set_custom_params)
{
ROS_INFO("Switching SimAnn Annealing parameters to your custom defined values!!! ");
SimAnnParams simAnnParams;
simAnnParams.YC = goal.sim_ann_params.YC;
simAnnParams.HC = goal.sim_ann_params.HC;
simAnnParams.YDIMS = goal.sim_ann_params.YDIMS;
simAnnParams.NBR_ADJ = goal.sim_ann_params.NBR_ADJ;
simAnnParams.ERR_ADJ = goal.sim_ann_params.ERR_ADJ;
simAnnParams.DEF_T0 = goal.sim_ann_params.DEF_T0;
simAnnParams.DEF_K0 = goal.sim_ann_params.DEF_K0;
mPlanner->setAnnealingParameters(simAnnParams);
}


switch(goal.search_contact.type) {
case graspit_interface::SearchContact::CONTACT_PRESET :
Expand Down