-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved controllers to hw if, updated lbr_description launch
- Loading branch information
Showing
17 changed files
with
266 additions
and
177 deletions.
There are no files selected for viewing
38 changes: 13 additions & 25 deletions
38
lbr_demos/lbr_demos_fri_ros2_advanced_cpp/launch/admittance_control_node.launch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,19 @@ | ||
from launch import LaunchContext, LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, OpaqueFunction | ||
from launch.substitutions import LaunchConfiguration | ||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
|
||
from lbr_description import description_factory | ||
|
||
|
||
def launch_setup(context: LaunchContext) -> LaunchDescription: | ||
model = LaunchConfiguration("model").perform(context) | ||
|
||
robot_description = description_factory(model=model, sim="false") | ||
|
||
admittance_control_node = Node( | ||
package="lbr_demos_fri_ros2_advanced_cpp", | ||
executable="admittance_control_node", | ||
output="screen", | ||
parameters=[robot_description], | ||
) | ||
|
||
return [admittance_control_node] | ||
from lbr_description import LBRDescription | ||
|
||
|
||
def generate_launch_description() -> LaunchDescription: | ||
model_arg = DeclareLaunchArgument( | ||
name="model", | ||
default_value="iiwa7", | ||
description="The LBR model in use.", | ||
choices=["iiwa7", "iiwa14", "med7", "med14"], | ||
ld = LBRDescription(sim=False) | ||
|
||
ld.add_action( | ||
Node( | ||
package="lbr_demos_fri_ros2_advanced_cpp", | ||
executable="admittance_control_node", | ||
output="screen", | ||
parameters=[ld.robot_description], | ||
) | ||
) | ||
return LaunchDescription([model_arg, OpaqueFunction(function=launch_setup)]) | ||
|
||
return ld |
38 changes: 13 additions & 25 deletions
38
lbr_demos/lbr_demos_fri_ros2_advanced_python/launch/admittance_control_node.launch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,19 @@ | ||
from launch import LaunchContext, LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, OpaqueFunction | ||
from launch.substitutions import LaunchConfiguration | ||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
|
||
from lbr_description import description_factory | ||
|
||
|
||
def launch_setup(context: LaunchContext) -> LaunchDescription: | ||
model = LaunchConfiguration("model").perform(context) | ||
|
||
robot_description = description_factory(model=model, sim="false") | ||
|
||
admittance_control_node = Node( | ||
package="lbr_demos_fri_ros2_advanced_python", | ||
executable="admittance_control_node", | ||
output="screen", | ||
parameters=[robot_description], | ||
) | ||
|
||
return [admittance_control_node] | ||
from lbr_description import LBRDescription | ||
|
||
|
||
def generate_launch_description() -> LaunchDescription: | ||
model_arg = DeclareLaunchArgument( | ||
name="model", | ||
default_value="iiwa7", | ||
description="The LBR model in use.", | ||
choices=["iiwa7", "iiwa14", "med7", "med14"], | ||
ld = LBRDescription(sim=False) | ||
|
||
ld.add_action( | ||
Node( | ||
package="lbr_demos_fri_ros2_advanced_python", | ||
executable="admittance_control_node", | ||
output="screen", | ||
parameters=[ld.robot_description], | ||
) | ||
) | ||
return LaunchDescription([model_arg, OpaqueFunction(function=launch_setup)]) | ||
|
||
return ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,41 @@ | ||
import os | ||
from typing import List | ||
|
||
from ament_index_python import get_package_share_directory | ||
from launch import LaunchContext, LaunchDescription, LaunchDescriptionEntity | ||
from launch.actions import DeclareLaunchArgument, OpaqueFunction | ||
from launch.substitutions import LaunchConfiguration | ||
from launch_ros.actions import Node | ||
|
||
from lbr_description import description_factory | ||
|
||
|
||
def launch_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]: | ||
model = LaunchConfiguration("model").perform(context) | ||
robot_name = LaunchConfiguration("robot_name").perform(context) | ||
|
||
robot_description = description_factory(model=model, robot_name=robot_name) | ||
|
||
joint_state_publisher_gui_node = Node( | ||
package="joint_state_publisher_gui", | ||
executable="joint_state_publisher_gui", | ||
) | ||
|
||
robot_state_publisher_node = Node( | ||
package="robot_state_publisher", | ||
executable="robot_state_publisher", | ||
output="both", | ||
parameters=[robot_description], | ||
) | ||
|
||
rviz_node = Node( | ||
package="rviz2", | ||
executable="rviz2", | ||
arguments=[ | ||
"-d", | ||
os.path.join( | ||
get_package_share_directory("lbr_description"), "config/config.rviz" | ||
), | ||
], | ||
) | ||
|
||
return [ | ||
joint_state_publisher_gui_node, | ||
robot_state_publisher_node, | ||
rviz_node, | ||
] | ||
from lbr_description import LBRDescription | ||
|
||
|
||
def generate_launch_description(): | ||
ld = LaunchDescription() | ||
ld = LBRDescription() | ||
|
||
ld.add_action( | ||
DeclareLaunchArgument( | ||
name="model", | ||
default_value="iiwa7", | ||
description="Set robot model.", | ||
choices=["iiwa7", "iiwa14", "med7", "med14"], | ||
Node( | ||
package="joint_state_publisher_gui", | ||
executable="joint_state_publisher_gui", | ||
) | ||
) | ||
|
||
ld.add_action( | ||
DeclareLaunchArgument( | ||
name="robot_name", default_value="lbr", description="Set robot name." | ||
Node( | ||
package="robot_state_publisher", | ||
executable="robot_state_publisher", | ||
output="both", | ||
parameters=[ld.robot_description], | ||
) | ||
) | ||
|
||
ld.add_action(OpaqueFunction(function=launch_setup)) | ||
ld.add_action( | ||
Node( | ||
package="rviz2", | ||
executable="rviz2", | ||
arguments=[ | ||
"-d", | ||
os.path.join( | ||
get_package_share_directory("lbr_description"), "config/config.rviz" | ||
), | ||
], | ||
) | ||
) | ||
|
||
return ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .description_factory import description_factory | ||
from .lbr_description import LBRDescription |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from typing import Dict | ||
|
||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument | ||
from launch.substitutions import ( | ||
Command, | ||
FindExecutable, | ||
LaunchConfiguration, | ||
PathJoinSubstitution, | ||
) | ||
from launch_ros.substitutions import FindPackageShare | ||
|
||
|
||
class LBRDescription(LaunchDescription): | ||
_robot_description: Dict[str, str] | ||
|
||
def __init__( | ||
self, | ||
sim: bool = True, | ||
) -> None: | ||
super().__init__() | ||
self._add_launch_arguments() | ||
self._robot_description = self._generate_robot_description(sim) | ||
|
||
@property | ||
def robot_description(self) -> Dict[str, str]: | ||
return self._robot_description | ||
|
||
def _add_launch_arguments(self) -> None: | ||
self.add_action( | ||
DeclareLaunchArgument( | ||
name="model", | ||
default_value="iiwa7", | ||
description="The LBR model in use.", | ||
choices=["iiwa7", "iiwa14", "med7", "med14"], | ||
) | ||
) | ||
|
||
self.add_action( | ||
DeclareLaunchArgument( | ||
name="robot_name", | ||
default_value="lbr", | ||
description="The robot's name.", | ||
) | ||
) | ||
|
||
def _generate_robot_description(self, sim: bool = True) -> Dict[str, str]: | ||
robot_description = { | ||
"robot_description": Command( | ||
[ | ||
FindExecutable(name="xacro"), | ||
" ", | ||
PathJoinSubstitution( | ||
[ | ||
FindPackageShare("lbr_description"), | ||
"urdf", | ||
LaunchConfiguration("model"), | ||
LaunchConfiguration("model"), | ||
] | ||
), | ||
".urdf.xacro", | ||
" robot_name:=", | ||
LaunchConfiguration("robot_name"), | ||
" sim:=", | ||
"true" if sim else "false", | ||
] | ||
) | ||
} | ||
|
||
return robot_description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,20 @@ | ||
import os | ||
|
||
import xacro | ||
from ament_index_python import get_package_share_directory | ||
from launch import LaunchContext, LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, OpaqueFunction | ||
from launch.substitutions import LaunchConfiguration | ||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
|
||
from lbr_description import LBRDescription | ||
|
||
def launch_setup(context: LaunchContext): | ||
model = LaunchConfiguration("model").perform(context) | ||
|
||
robot_description = { | ||
"robot_description": xacro.process( | ||
os.path.join( | ||
get_package_share_directory("lbr_description"), | ||
"urdf", | ||
model, | ||
f"{model}.urdf.xacro", | ||
), | ||
mappings={"sim": "false"}, | ||
) | ||
} | ||
def generate_launch_description() -> LaunchDescription: | ||
ld = LBRDescription(sim=False) | ||
|
||
lbr_app_node = Node( | ||
package="lbr_fri_ros2", | ||
executable="lbr_app", | ||
emulate_tty=True, | ||
output="screen", | ||
parameters=[robot_description], | ||
ld.add_action( | ||
Node( | ||
package="lbr_fri_ros2", | ||
executable="lbr_app", | ||
emulate_tty=True, | ||
output="screen", | ||
parameters=[ld.robot_description], | ||
) | ||
) | ||
|
||
return [lbr_app_node] | ||
|
||
|
||
def generate_launch_description(): | ||
model_arg = DeclareLaunchArgument( | ||
name="model", | ||
default_value="iiwa7", | ||
description="The LBR model in use.", | ||
choices=["iiwa7", "iiwa14", "med7", "med14"], | ||
) | ||
return LaunchDescription([model_arg, OpaqueFunction(function=launch_setup)]) | ||
return ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.