Skip to content

Commit a1c83a8

Browse files
Merge pull request #1 from florent-lamiraux/devel
Allow to control other types of robot
2 parents 0723716 + 22ee97a commit a1c83a8

24 files changed

+1066
-246
lines changed

CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,13 @@ INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
7373
INSTALL(FILES
7474
launch/controller.launch
7575
launch/sot_params.launch
76-
launch/sot_params.launch
7776
DESTINATION share/${PROJECT_NAME}/launch)
7877

7978
# Install configuration files
8079
INSTALL(FILES
81-
config/controller.yaml
82-
config/sot_params.yaml
83-
config/sot_params_simu.yaml
80+
config/sot_params_common.yaml
81+
config/sot_params_ur.yaml
82+
config/sot_params_franka_panda.yaml
8483
DESTINATION share/${PROJECT_NAME}/config)
8584

8685
# Install default URDF file

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Control of robot arm via the Stack of Tasks and roscontrol

config/controller.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

config/sot_params_common.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sot_controller:
2+
libname: libsot-robot-arm-controller.so
3+
map_rc_to_sot_device:
4+
motor-angles: motor-angles
5+
joint-angles: joint-angles
6+
velocities: velocities
7+
forces: forces
8+
torques: torques
9+
control: control
10+
11+
type:
12+
sot_controller/RCSotController
13+
check_mode:
14+
False
15+
verbosity_level:
16+
25

config/sot_params_franka_panda.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
sot_controller:
2+
control_mode:
3+
panda_joint1:
4+
ros_control_mode: POSITION
5+
sot_control_mode: VELOCITY
6+
panda_joint2:
7+
ros_control_mode: POSITION
8+
sot_control_mode: VELOCITY
9+
panda_joint3:
10+
ros_control_mode: POSITION
11+
sot_control_mode: VELOCITY
12+
panda_joint4:
13+
ros_control_mode: POSITION
14+
sot_control_mode: VELOCITY
15+
panda_joint5:
16+
ros_control_mode: POSITION
17+
sot_control_mode: VELOCITY
18+
panda_joint6:
19+
ros_control_mode: POSITION
20+
sot_control_mode: VELOCITY
21+
panda_joint7:
22+
ros_control_mode: POSITION
23+
sot_control_mode: VELOCITY
24+
25+
joint_names:
26+
[$(arg arm_id)_joint1, $(arg arm_id)_joint2, $(arg arm_id)_joint3,
27+
$(arg arm_id)_joint4, $(arg arm_id)_joint5, $(arg arm_id)_joint6,
28+
$(arg arm_id)_joint7]
29+
joints:
30+
[$(arg arm_id)_joint1, $(arg arm_id)_joint2, $(arg arm_id)_joint3,
31+
$(arg arm_id)_joint4, $(arg arm_id)_joint5, $(arg arm_id)_joint6,
32+
$(arg arm_id)_joint7]
33+
sot:
34+
state_vector_map:
35+
[$(arg arm_id)_joint1, $(arg arm_id)_joint2, $(arg arm_id)_joint3,
36+
$(arg arm_id)_joint4, $(arg arm_id)_joint5, $(arg arm_id)_joint6,
37+
$(arg arm_id)_joint7]

config/sot_params_simu.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

config/sot_params.yaml renamed to config/sot_params_ur.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
sot_controller:
2-
libname: libsot-universal-robot-controller.so
3-
map_rc_to_sot_device:
4-
motor-angles: motor-angles
5-
joint-angles: joint-angles
6-
velocities: velocities
7-
forces: forces
8-
torques: torques
9-
control: control
10-
112
control_mode:
123
shoulder_pan_joint:
134
ros_control_mode: POSITION
@@ -28,5 +19,14 @@ sot_controller:
2819
ros_control_mode: POSITION
2920
sot_control_mode: VELOCITY
3021

31-
dt: 0.002
32-
jitter: 0.004
22+
joint_names:
23+
[shoulder_pan_joint, shoulder_lift_joint, elbow_joint, wrist_1_joint,
24+
wrist_2_joint, wrist_3_joint]
25+
joints:
26+
[shoulder_pan_joint, shoulder_lift_joint, elbow_joint, wrist_1_joint,
27+
wrist_2_joint, wrist_3_joint]
28+
29+
sot:
30+
state_vector_map:
31+
[shoulder_pan_joint, shoulder_lift_joint, elbow_joint, wrist_1_joint,
32+
wrist_2_joint, wrist_3_joint]

launch/controller.launch

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
<launch>
22
<arg name="simulation" default="false"/>
3-
<include file="$(find sot_universal_robot)/launch/sot_params.launch"/>
4-
5-
<!-- Sot Controller configuration -->
6-
<rosparam command="load" unless="$(arg simulation)"
7-
file="$(find sot_universal_robot)/config/sot_params.yaml"/>
8-
<rosparam command="load" if="$(arg simulation)"
9-
file="$(find sot_universal_robot)/config/sot_params_simu.yaml"/>
10-
<rosparam command="load"
11-
file="$(find sot_universal_robot)/config/controller.yaml" />
12-
3+
<arg name="robot" default="" />
4+
<include file="$(find sot_universal_robot)/launch/sot_params.launch">
5+
<arg name="robot" value="$(arg robot)"/>
6+
<arg name="simulation" value="$(arg simulation)"/>
7+
</include>
138
<!-- Spawn sot controller -->
149
<node name="sot_controller_spawner"
1510
pkg="controller_manager" type="spawner" output="screen"

launch/sot_params.launch

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
<launch>
2+
<arg name="simulation" default="false"/>
3+
<arg name="robot" default="" />
4+
<arg name="arm_id" default="panda"/>
25
<!-- Load robot sot params. -->
3-
<group ns="sot">
4-
<rosparam param="state_vector_map">
5-
["shoulder_pan_joint", "shoulder_lift_joint", "elbow_joint",
6-
"wrist_1_joint", "wrist_2_joint", "wrist_3_joint"]
7-
</rosparam>
8-
</group>
9-
<group ns="sot_controller">
10-
<rosparam param="joint_names">
11-
["shoulder_pan_joint", "shoulder_lift_joint", "elbow_joint",
12-
"wrist_1_joint", "wrist_2_joint", "wrist_3_joint"]
13-
</rosparam>
14-
</group>
6+
<group ns="sot_controller" if="$(eval robot == 'ur')">
7+
<rosparam param="dt" if="$(arg simulation)">
8+
0.002
9+
</rosparam>
10+
<rosparam param="dt" unless="$(arg simulation)">
11+
0.01
12+
</rosparam>
13+
</group>
14+
<group ns="sot_controller" if="$(eval robot == 'franka')">
15+
<rosparam param="dt" if="$(arg simulation)">
16+
0.001
17+
</rosparam>
18+
<rosparam param="dt" unless="$(arg simulation)">
19+
0.01
20+
</rosparam>
21+
</group>
22+
<!-- Sot Controller configuration -->
23+
<rosparam command="load"
24+
file="$(find sot_universal_robot)/config/sot_params_common.yaml"/>
25+
<rosparam command="load" if="$(eval robot == 'franka')"
26+
file="$(find sot_universal_robot)/config/sot_params_franka_$(arg arm_id).yaml"
27+
subst_value="true"/>
28+
<rosparam command="load" if="$(eval robot == 'ur')"
29+
file="$(find sot_universal_robot)/config/sot_params_ur.yaml"/>
1530
</launch>

src/CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
# Add the library to wrap the device of Tiago.
2727

28-
SET(DEVICE_NAME sot-universal-robot-device)
28+
SET(DEVICE_NAME sot-robot-arm-device)
2929
ADD_LIBRARY(${DEVICE_NAME} SHARED device.cc)
3030

3131
# Link the dynamic library containing the SoT with its dependencies.
@@ -35,25 +35,27 @@ INSTALL(TARGETS ${DEVICE_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
3535

3636
# build python submodule
3737
STRING(REPLACE - _ PYTHON_LIBRARY_NAME ${DEVICE_NAME})
38-
DYNAMIC_GRAPH_PYTHON_MODULE("sot/universal_robot/${PYTHON_LIBRARY_NAME}"
39-
${DEVICE_NAME} sot_universal_robot-${PYTHON_LIBRARY_NAME}-wrap
38+
DYNAMIC_GRAPH_PYTHON_MODULE("sot/robot_arm/${PYTHON_LIBRARY_NAME}"
39+
${DEVICE_NAME} sot_robot_arm-${PYTHON_LIBRARY_NAME}-wrap
4040
SOURCE_PYTHON_MODULE ${CMAKE_CURRENT_SOURCE_DIR}/device-python.cc)
4141

4242
# Install Python files.
43-
SET(PYTHON_MODULE dynamic_graph/sot/universal_robot)
43+
SET(PYTHON_MODULE dynamic_graph/sot/robot_arm)
4444
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py")
45-
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "universal_robot.py")
45+
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "franka.py")
4646
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "prologue.py")
47+
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "robot_arm.py")
48+
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "universal_robot.py")
4749

48-
# Add the library to wrap the controller of Universal-Robot.
49-
SET(CONTROLLER_NAME sot-universal-robot-controller)
50+
# Add the library to wrap the controller of Robot-Arm.
51+
SET(CONTROLLER_NAME sot-robot-arm-controller)
5052
ADD_LIBRARY(${CONTROLLER_NAME} SHARED
5153
controller.cc
5254
controller.hh
5355
)
5456

5557
# Link the dynamic library containing the SoT with its dependencies.
5658
TARGET_LINK_LIBRARIES(${CONTROLLER_NAME} sot-core::sot-core dynamic-graph-python::dynamic-graph-python
57-
dynamic_graph_bridge::ros_bridge dynamic_graph_bridge::ros_interpreter sot-universal-robot-device)
59+
dynamic_graph_bridge::ros_bridge dynamic_graph_bridge::ros_interpreter sot-robot-arm-device)
5860

5961
INSTALL(TARGETS ${CONTROLLER_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)

0 commit comments

Comments
 (0)