Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tic_tac_toe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
socrates_ws
tic_tac_toe
Commits
c1d8c748
Commit
c1d8c748
authored
7 years ago
by
Truong Giang Vo
Browse files
Options
Downloads
Patches
Plain Diff
Replace ttt_executor_node.cpp
parent
d2acfa26
No related branches found
Branches containing commit
No related tags found
1 merge request
!10
Giang
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ttt_executor_node.cpp
+15
-12
15 additions, 12 deletions
src/ttt_executor_node.cpp
with
15 additions
and
12 deletions
src/ttt_executor_node.cpp
+
15
−
12
View file @
c1d8c748
...
...
@@ -22,6 +22,7 @@ int cellSize;
bool
isObjectPicked
=
false
;
bool
isGoalReceived
=
false
;
int
objType
,
goalCell
;
int
moveCount
=
0
;
geometry_msgs
::
Pose
stackPose
;
//Position and orientation of the place where objects are stacked
geometry_msgs
::
Pose
c1Pose
;
//Position and orientation of the 1st cell of 3x3 grid for tictactoe
geometry_msgs
::
Pose
goalPose
;
...
...
@@ -54,6 +55,11 @@ geometry_msgs::Pose vector2Pose(std::vector<double> _vtr){
//Location of Cell 1 is known
//Going from cell 1 to cell 2 will be 10cm along the x-axis
//Going from cell 1 to cell 4 will be 10cm along the y-axis
void
changeStackPose
(){
stackPose
.
position
.
x
+=
4
*
cellSize
;
stackPose
.
position
.
y
+=
moveCount
*
cellSize
;
}
void
goalCell_CB
(
const
std_msgs
::
Int16
::
ConstPtr
&
msg
){
goalCell
=
msg
->
data
;
...
...
@@ -64,7 +70,9 @@ void goalCell_CB(const std_msgs::Int16::ConstPtr& msg){
c1Pose
.
position
.
x
+=
x_trans
*
cellSize
;
c1Pose
.
position
.
y
+=
y_trans
*
cellSize
;
changeStackPose
();
isGoalReceived
=
true
;
}
...
...
@@ -73,27 +81,22 @@ int main(int argc, char** argv){
ros
::
NodeHandle
nh
;
if
(
!
nh
.
getParam
(
"stack_pose"
,
stackPose_Vtr
)){
ROS_ERROR
(
"[%s]: %s"
,
ros
::
this_node
::
getName
().
c_str
(),
"Placed where objects are stacked is not specified"
);
return
-
1
;
if
(
!
nh
.
getParam
(
"cell_size"
,
cellSize
)){
cellSize
=
0.1
;
//default value for cell size is 10cm
}
else
stackPose
=
vector2Pose
(
stackPose_Vtr
);
if
(
!
nh
.
getParam
(
"c1_pose"
,
c1Pose_Vtr
)){
ROS_ERROR
(
"[%s]: %s"
,
ros
::
this_node
::
getName
().
c_str
(),
"Location of 1st cell is not specified"
);
return
-
1
;
}
else
else
{
c1Pose
=
vector2Pose
(
c1Pose_Vtr
);
if
(
!
nh
.
getParam
(
"cell_size"
,
cellSize
)){
cellSize
=
0.1
;
//default value for cell size is 10cm
stackPose
=
c1Pose
;
}
ros
::
Subscriber
cell_sub
=
nh
.
subscribe
(
"target_cell"
,
10
,
goalCell_CB
);
//WAM SERVICES
...
...
@@ -119,7 +122,7 @@ int main(int argc, char** argv){
//pickup stage - go to stack place
if
(
!
isObjectPicked
){
srv
.
request
.
pose
=
goal
Pose
;
srv
.
request
.
pose
=
stack
Pose
;
srv
.
request
.
vel
=
0.5
;
srv
.
request
.
acc
=
0.5
;
if
(
moveArm_client
.
call
(
srv
)){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment