Skip to content
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
12 changes: 6 additions & 6 deletions parkingdemo_control/config/parkingdemo_control.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ parkingdemo:
# Effort Controllers ---------------------------------------
rr_Wheel_effort_controller:
type: effort_controllers/JointEffortController
joint: wheel_rr
joint: wheel_rr_joint
pid: {p: 100.0, i: 0.1, d: 10.0}

rl_Wheel_effort_controller:
type: effort_controllers/JointEffortController
joint: wheel_rl
joint: wheel_rl_joint
pid: {p: 100.0, i: 0.1, d: 10.0}

fr_Wheel_effort_controller:
type: effort_controllers/JointEffortController
joint: wheel_fr
joint: wheel_fr_joint
pid: {p: 100.0, i: 0.1, d: 10.0}

fl_Wheel_effort_controller:
type: effort_controllers/JointEffortController
joint: wheel_fl
joint: wheel_fl_joint
pid: {p: 100.0, i: 0.1, d: 10.0}

# Position Controllers ---------------------------------------
fr_Steer_position_controller:
type: effort_controllers/JointPositionController
joint: steer_fr
joint: steer_fr_joint
pid: {p: 100.0, i: 0.1, d: 10.0}

fl_Steer_position_controller:
type: effort_controllers/JointPositionController
joint: steer_fl
joint: steer_fl_joint
pid: {p: 100.0, i: 0.1, d: 10.0}
28 changes: 14 additions & 14 deletions parkingdemo_description/urdf/fusion_13_structure.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -127,53 +127,53 @@
</collision>
</link>

<joint name="base_link" type="fixed">
<joint name="base_link_joint" type="fixed">
<origin xyz="0 0 0.33" rpy="0 0 0"/>
<parent link="base_footprint"/>
<child link="base_link"/>
</joint>

<joint name="steer_fl" type="continuous">
<joint name="steer_fl_joint" type="continuous">
<origin xyz="2.85 0.79121 0" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="steer_fl"/>
<axis xyz="0 0 1.0"/>
<!-- <limit lower="-0.65" upper="0.65" effort="0" velocity="0"/> -->
</joint>

<joint name="steer_fr" type="continuous">
<joint name="steer_fr_joint" type="continuous">
<origin xyz="2.85 -0.79121 0" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="steer_fr"/>
<axis xyz="0 0 1.0"/>
<!-- <limit lower="-0.65" upper="0.65" effort="0" velocity="0"/> -->
</joint>

<joint name="wheel_fl" type="continuous">
<joint name="wheel_fl_joint" type="continuous">
<origin xyz="0 0 0" rpy="1.570796 0 -3.141593"/>
<parent link="steer_fl"/>
<child link="wheel_fl"/>
<axis xyz="0 0 1.0"/>
<limit effort="0" velocity="22.0"/>
</joint>

<joint name="wheel_fr" type="continuous">
<joint name="wheel_fr_joint" type="continuous">
<origin xyz="0 0 0" rpy="1.570796 0 -3.141593"/>
<parent link="steer_fr"/>
<child link="wheel_fr"/>
<axis xyz="0 0 1.0"/>
<limit effort="0" velocity="22.0"/>
</joint>

<joint name="wheel_rl" type="continuous">
<joint name="wheel_rl_joint" type="continuous">
<origin xyz="0 0.7874 0" rpy="1.570796 0 -3.141593"/>
<parent link="base_link"/>
<child link="wheel_rl"/>
<axis xyz="0 0 1.0"/>
<limit effort="5000.0" velocity="22.0"/>
</joint>

<joint name="wheel_rr" type="continuous">
<joint name="wheel_rr_joint" type="continuous">
<origin xyz="0 -0.7874 0" rpy="1.570796 0 -3.141593"/>
<parent link="base_link"/>
<child link="wheel_rr"/>
Expand All @@ -185,7 +185,7 @@

<transmission name="tran1">
<type>transmission_interface/SimpleTransmission</type>
<joint name="wheel_rr">
<joint name="wheel_rr_joint">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="wheel_Motor1">
Expand All @@ -196,7 +196,7 @@

<transmission name="tran2">
<type>transmission_interface/SimpleTransmission</type>
<joint name="wheel_rl">
<joint name="wheel_rl_joint">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="wheel_Motor2">
Expand All @@ -207,7 +207,7 @@

<transmission name="tran3">
<type>transmission_interface/SimpleTransmission</type>
<joint name="wheel_fr">
<joint name="wheel_fr_joint">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="wheel_Motor3">
Expand All @@ -218,7 +218,7 @@

<transmission name="tran4">
<type>transmission_interface/SimpleTransmission</type>
<joint name="wheel_fl">
<joint name="wheel_fl_joint">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="wheel_Motor4">
Expand All @@ -229,7 +229,7 @@

<transmission name="tran5">
<type>transmission_interface/SimpleTransmission</type>
<joint name="steer_fr">
<joint name="steer_fr_joint">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="wheel_Motor5">
Expand All @@ -240,7 +240,7 @@

<transmission name="tran6">
<type>transmission_interface/SimpleTransmission</type>
<joint name="steer_fl">
<joint name="steer_fl_joint">
<hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
</joint>
<actuator name="wheel_Motor6">
Expand All @@ -257,7 +257,7 @@
<plugin name="p3d_base_controller" filename="libgazebo_ros_p3d.so">
<alwaysOn>true</alwaysOn>
<updateRate>50.0</updateRate>
<bodyName>base_link</bodyName>
<bodyName>base_footprint</bodyName>
<topicName>ground_truth/state</topicName>
<gaussianNoise>0.01</gaussianNoise>
<frameName>world</frameName>
Expand Down
24 changes: 18 additions & 6 deletions parkingdemo_gazebo/scripts/parallel_parking.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# For ubuntu20.04 LTS
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
Expand Down Expand Up @@ -145,9 +146,12 @@ def calc_distance(a, b):


def veh_control(initial_pos, start_pos, transition_pos, goal_pos, radius, update_pos):
global flag
# print("Input to func veh_control", initial_pos, start_pos, transition_pos, goal_pos, radius, update_pos)

print initial_pos, start_pos, transition_pos, goal_pos, radius, update_pos

# Here, we only need to give the target value of steering angle or wheel effort(force or torque)
# steer_position_controller is a steering angle controller, with radians as unit
# wheel_effort_controller is a wheel effort controller, with Nm as unit.
if update_pos[0]>start_pos[0]:
vel = -12
steer = 0
Expand All @@ -159,10 +163,11 @@ def veh_control(initial_pos, start_pos, transition_pos, goal_pos, radius, update
elif update_pos[0]<=(transition_pos[0]) and update_pos[0]>(goal_pos[0]-0.5) and flag == 0:
steer = 0.49
vel = -104

elif update_pos[0]<=goal_pos[0]-0.5:
steer = 0
vel = 20
global flag

flag = 1

elif flag == 1:
Expand All @@ -186,19 +191,26 @@ def veh_mission(msg):
first_obstacle = np.array([20-(length/2+7), 20-(width/2+0.5)])
goal = np.array([first_obstacle[0], first_obstacle[1] - width/2])

print float(msg.pose.pose.position.x)
# print( float(msg.pose.pose.position.x))
launch_coord = np.array([20, 20])
current_pos = np.array([msg.pose.pose.position.x, msg.pose.pose.position.y])
current_vel = np.array([msg.twist.twist.linear.x, msg.twist.twist.linear.y])

r_star, center1, center2, initial, start, transition = park_points(Ri_min, launch_coord, goal, width)
#trajectory(center1, center2, initial, start, transition, goal_pos, r_star)

vel_cmd, steer_cmd = veh_control(initial, start, transition, goal, r_star, current_pos)



rospy.loginfo("current_pos:")
rospy.loginfo(current_pos)
rospy.loginfo("current_vel:")
rospy.loginfo(current_vel)
rospy.loginfo("vel_cmd:")
rospy.loginfo(vel_cmd)
rospy.loginfo("steer_cmd:")
rospy.loginfo(steer_cmd)
#rospy.loginfo(current_pos)
rr_pub.publish(vel_cmd)
rl_pub.publish(vel_cmd)
fr_pub.publish(steer_cmd)
Expand Down
2 changes: 1 addition & 1 deletion parkingdemo_gazebo/worlds/parkingdemo.world
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
<pose frame=''>16.25 17.5 0 0 -0 0</pose>
</model>

<model name='Construction Cone1'>
<model name='Construction Cone4'>
<static>1</static>
<link name='link'>
<collision name='collision'>
Expand Down