Skip to content

Commit 86e73d6

Browse files
committed
add modifies for param position box
1 parent 6a0705e commit 86e73d6

File tree

4 files changed

+49
-15
lines changed

4 files changed

+49
-15
lines changed

doc/launch_program

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ orientation:
1818
y: 0.0
1919
z: 0.0
2020
w: 0.5"
21+
22+
or
23+
24+
roslaunch grasp_learning comunication_robot.launch
2125

param/comunication_robot.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
filename_in: "/box_005/006/box_estimate"
1+
filename_in: "/box_004010020/C_046127183/box_estimate_5"
2+
dx_box: -0.977
3+
dy_box: 0
4+
dz_box: 0
5+
gap_x: 0.0
6+
gap_y: 0.01
7+
gap_z: 0.0
8+
gap_up: 0.2
9+
duration: 10.0
10+
duration_grasping: 3.0

src/comunication_robot.cpp

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ void cb_control_error(const std_msgs::Float64MultiArray::ConstPtr& msg)
8181
Eigen_error(i) = msg->data[i];
8282
}
8383

84+
double dx_ = 0;
85+
double dy_ = 0;
86+
double dz_ = 0;
87+
double gap_x = 0;
88+
double gap_y = 0;
89+
double gap_z = 0;
90+
double gap_up = 0;
91+
double duration_grasping = 3.0;//duration of grasping
92+
double duration_ = 10.0;//duration of hand closure
8493

8594
int main(int argc, char** argv)
8695
{
@@ -92,8 +101,17 @@ int main(int argc, char** argv)
92101
string relative_path_file_in, on_topic, synergy_joint;
93102
string file_name_in;
94103
nn.param<std::string>("filename_in", relative_path_file_in, "/bottiglia/test_itself/model_40_8/box_estimate" );
95-
nn.param <std::string>("on_topic", on_topic, "/right_hand/joint_trajectory_controller/command");
96-
nn.param <std::string>("synergy_joint", synergy_joint, "right_hand_synergy_joint");
104+
nn.param<std::string>("on_topic", on_topic, "/right_hand/joint_trajectory_controller/command");
105+
nn.param<std::string>("synergy_joint", synergy_joint, "right_hand_synergy_joint");
106+
nn.param<double>("dx_box",dx_,0);
107+
nn.param<double>("dy_box",dy_,0);
108+
nn.param<double>("dz_box",dz_,0);
109+
nn.param<double>("gap_x",gap_x,0);
110+
nn.param<double>("gap_y",gap_y,0);
111+
nn.param<double>("gap_z",gap_z,0);
112+
nn.param<double>("gap_up",gap_up,0);
113+
nn.param<double>("duration",duration_,3.0);//Duration of hand closure
114+
nn.param<double>("duration_grasping",duration_grasping,3.0);
97115

98116
ros::Subscriber sub_error = nn.subscribe("/right_arm/teleoperation_controller/error", 1, cb_control_error);
99117
ros::Publisher hand_publisher = nn.advertise<trajectory_msgs::JointTrajectory>(on_topic.c_str(), 1000);
@@ -136,9 +154,9 @@ int main(int argc, char** argv)
136154

137155

138156

139-
double dx = -1;
140-
double dy = 0.0;
141-
double dz = values_inline[3]/2;// -0.02 + 0.05;
157+
double dx = dx_;
158+
double dy = dy_;
159+
double dz = values_inline[3]/2 + dz_;// -0.02 + 0.05;
142160
Eigen::MatrixXd transf_World2Box = MatrixXd::Identity(4,4);
143161

144162
transf_World2Box(3,0) = dx;
@@ -219,7 +237,10 @@ int main(int argc, char** argv)
219237
grasping_pub.publish(hand_pose);
220238
ros::spinOnce();
221239
loop_rate.sleep();
222-
hand_pose.position.z = hand_pose.position.z + 0.3;
240+
241+
hand_pose.position.x = hand_pose.position.x + gap_x;
242+
hand_pose.position.y = hand_pose.position.y + gap_y;
243+
hand_pose.position.z = hand_pose.position.z + .3 + gap_z;
223244
while(nn.ok() && error > e_treshold)
224245
{
225246
grasping_pub.publish(hand_pose);
@@ -241,9 +262,9 @@ int main(int argc, char** argv)
241262
Eigen_error(0) = 1000;
242263
e_treshold = 0.0001;
243264

244-
hand_pose.position.x = hand_pose.position.x - 0.0005;
245-
hand_pose.position.y = hand_pose.position.y - 0.0005;
246-
hand_pose.position.z = hand_pose.position.z - .3 - 0.02;
265+
hand_pose.position.x = hand_pose.position.x + gap_x;
266+
hand_pose.position.y = hand_pose.position.y + gap_y;
267+
hand_pose.position.z = hand_pose.position.z - .3 + gap_z;
247268
while(nn.ok() && error > e_treshold)
248269
{
249270
grasping_pub.publish(hand_pose);
@@ -272,14 +293,14 @@ int main(int argc, char** argv)
272293
msg_jointT_hand.points[0].accelerations[0] = 0.0;
273294
msg_jointT_hand.points[0].effort.resize(1);
274295
msg_jointT_hand.points[0].effort[0] = 0.0;
275-
msg_jointT_hand.points[0].time_from_start = ros::Duration(10.0); // 10s;
296+
msg_jointT_hand.points[0].time_from_start = ros::Duration(duration_); // 10s; Duration of hand closure
276297
msg_jointT_hand.joint_names[0] = synergy_joint.c_str();
277298
hand_publisher.publish(msg_jointT_hand);
278299
ros::spinOnce();
279300
sleep(30.0);
280301
hand_pose.position.x = World2Hand(3,0);
281302
hand_pose.position.y = World2Hand(3,1);
282-
hand_pose.position.z = World2Hand(3,2) + 0.2;
303+
hand_pose.position.z = World2Hand(3,2) + gap_up;
283304
hand_pose.orientation.x = q3.x();
284305
hand_pose.orientation.y = q3.y();
285306
hand_pose.orientation.z = q3.z();
@@ -300,7 +321,7 @@ int main(int argc, char** argv)
300321
msg_joint_T_hand.points[0].accelerations[0] = 0.0;
301322
msg_joint_T_hand.points[0].effort.resize(1);
302323
msg_joint_T_hand.points[0].effort[0] = 0.0;
303-
msg_joint_T_hand.points[0].time_from_start = ros::Duration(3.0); // 1s;
324+
msg_joint_T_hand.points[0].time_from_start = ros::Duration(duration_grasping); // 1s;
304325
msg_joint_T_hand.joint_names[0] = synergy_joint.c_str();
305326
hand_publisher.publish(msg_joint_T_hand);
306327
ros::spin();

urdf/cube.urdf.xacro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
<visual>
1212
<origin xyz="0 0 0" rpy="0 0 0"/>
1313
<geometry>
14-
<box size="0.06 0.06 0.06"/>
14+
<box size="0.046 0.127 0.183"/>
1515
</geometry>
1616
</visual>
1717
<collision>
1818
<origin xyz="0 0 0" rpy="0 0 0"/>
1919
<geometry>
20-
<box size="0.06 0.06 0.06"/>
20+
<box size="0.046 0.127 0.183"/>
2121
</geometry>
2222
</collision>
2323
</link>

0 commit comments

Comments
 (0)