Ask Your Question

Revision history [back]

Based on the advice from Adolfo this worked for me:

<?xml version="1.0"?>
<launch>

    <!-- to switch arm sim from trajectory controller to position controller during runtime -->

    <!-- unspawn arm sim trajectory controller -->
    <node pkg="controller_manager" type="unspawner" name="traj_ctrl_unspawner" args="left_arm_traj_controller" />

    <!-- spawn arm sim position controller -->
    <node pkg="controller_manager" type="spawner" name="pos_ctrl_spawner"
          args="left_arm_joint0_position_controller
                left_arm_joint1_position_controller
                left_arm_joint2_position_controller
                left_arm_joint3_position_controller
                left_arm_joint4_position_controller
                left_arm_joint5_position_controller
                left_arm_joint6_position_controller" />

</launch>

Then an alias:

alias enable_pos_ctrl='roslaunch mbot_gazebo_control switch_from_traj_to_pos_ctrl.launch'

Once you kill the launch file it return to its original controller (trajectory ctrl in my case).

Based on the advice from Adolfo @Adolfo Rodriguez this worked for me:

<?xml version="1.0"?>
<launch>

    <!-- to switch arm sim from trajectory controller to position controller during runtime -->

    <!-- unspawn arm sim trajectory controller -->
    <node pkg="controller_manager" type="unspawner" name="traj_ctrl_unspawner" args="left_arm_traj_controller" />

    <!-- spawn arm sim position controller -->
    <node pkg="controller_manager" type="spawner" name="pos_ctrl_spawner"
          args="left_arm_joint0_position_controller
                left_arm_joint1_position_controller
                left_arm_joint2_position_controller
                left_arm_joint3_position_controller
                left_arm_joint4_position_controller
                left_arm_joint5_position_controller
                left_arm_joint6_position_controller" />

</launch>

Then an alias:

alias enable_pos_ctrl='roslaunch mbot_gazebo_control switch_from_traj_to_pos_ctrl.launch'

Once you kill the launch file it return to its original controller (trajectory ctrl in my case).

Based on the advice from @Adolfo Rodriguez @adolfo-rodriguez-t this worked for me:

<?xml version="1.0"?>
<launch>

    <!-- to switch arm sim from trajectory controller to position controller during runtime -->

    <!-- unspawn arm sim trajectory controller -->
    <node pkg="controller_manager" type="unspawner" name="traj_ctrl_unspawner" args="left_arm_traj_controller" />

    <!-- spawn arm sim position controller -->
    <node pkg="controller_manager" type="spawner" name="pos_ctrl_spawner"
          args="left_arm_joint0_position_controller
                left_arm_joint1_position_controller
                left_arm_joint2_position_controller
                left_arm_joint3_position_controller
                left_arm_joint4_position_controller
                left_arm_joint5_position_controller
                left_arm_joint6_position_controller" />

</launch>

Then an alias:

alias enable_pos_ctrl='roslaunch mbot_gazebo_control switch_from_traj_to_pos_ctrl.launch'

Once you kill the launch file it return to its original controller (trajectory ctrl in my case).

Based on the advice from @adolfo-rodriguez-t Adolfo Rodriguez T. this worked for me:

<?xml version="1.0"?>
<launch>

    <!-- to switch arm sim from trajectory controller to position controller during runtime -->

    <!-- unspawn arm sim trajectory controller -->
    <node pkg="controller_manager" type="unspawner" name="traj_ctrl_unspawner" args="left_arm_traj_controller" />

    <!-- spawn arm sim position controller -->
    <node pkg="controller_manager" type="spawner" name="pos_ctrl_spawner"
          args="left_arm_joint0_position_controller
                left_arm_joint1_position_controller
                left_arm_joint2_position_controller
                left_arm_joint3_position_controller
                left_arm_joint4_position_controller
                left_arm_joint5_position_controller
                left_arm_joint6_position_controller" />

</launch>

Then an alias:

alias enable_pos_ctrl='roslaunch mbot_gazebo_control switch_from_traj_to_pos_ctrl.launch'

Once you kill the launch file it return to its original controller (trajectory ctrl in my case).

Based on the advice from Adolfo Rodriguez T. this worked for me:

<?xml version="1.0"?>
<launch>

    <!-- to switch arm sim from trajectory controller to position controller during runtime -->

    <!-- unspawn arm sim trajectory controller -->
    <node pkg="controller_manager" type="unspawner" name="traj_ctrl_unspawner" args="left_arm_traj_controller" />

    <!-- spawn arm sim position controller -->
    <node pkg="controller_manager" type="spawner" name="pos_ctrl_spawner"
          args="left_arm_joint0_position_controller
                left_arm_joint1_position_controller
                left_arm_joint2_position_controller
                left_arm_joint3_position_controller
                left_arm_joint4_position_controller
                left_arm_joint5_position_controller
                left_arm_joint6_position_controller" />

</launch>

Then an alias:

alias enable_pos_ctrl='roslaunch mbot_gazebo_control switch_from_traj_to_pos_ctrl.launch'

Once you kill the launch file it return returns to its original controller (trajectory ctrl in my case).