How can I execute a planned trajectory in rviz again?
I tried executing a successfully planned trajectory several more time using
namespace rvt = rviz_visual_tools;
moveit_visual_tools::MoveItVisualTools visual_tools("base_link");
visual_tools.deleteAllMarkers();
visual_tools.loadRemoteControl();
moveit::planning_interface::MoveGroupInterface move_group("manipulator");
moveit::planning_interface::MoveGroupInterface::Plan my_plan;
bool success = (move_group.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
visual_tools.publishTrajectoryLine(my_plan.trajectory_, joint_model_group, static_cast<rviz_visual_tools::colors(0));
visual_tools.trigger();
visual_tools.prompt("Press next to execute the trajectory again in rviz!");
move_group.execute(my_plan);
visual_tools.trigger();
sleep(3.0);
My launch file is
<launch>
<arg name="db" default="false" />
<arg name="debug" default="false" />
<arg name="limited" default="false"/>
<include file="$(find ur10_moveit_config)/launch/planning_context.launch">
<arg name="load_robot_description" value="true"/>
<arg name="limited" value="$(arg limited)"/>
</include>
<node
pkg="tf"
type="static_transform_publisher"
name="base_link_2_fake_world_static"
args="0 0 0.8636 3.14159265358 0 0 /fake_world /base_link 30"/>
<!-- I do not have a robot connected, so publish fake joint states -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<param name="/use_gui" value="true"/>
<!-- listen to the my current joint angles topic published-->
<rosparam param="source_list">["/my_current_joint_states"]</rosparam>
</node>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
<!-- Run the main MoveIt executable without trajectory execution (we do not have controllers configured by default) -->
<include file="$(find ur10_moveit_config)/launch/move_group.launch">
<arg name="allow_trajectory_execution" value="true"/>
<arg name="fake_execution" value="true"/>
<arg name="info" value="true"/>
<arg name="debug" value="$(arg debug)"/>
</include>
<!-- Run Rviz and load the default config to see the state of the move_group node -->
<include file="$(find ur10_moveit_config)/launch/moveit_rviz.launch">
<arg name="config" value="true"/>
<arg name="debug" value="$(arg debug)"/>
</include>
<include file="$(find ur10_moveit_config)/launch/default_warehouse_db.launch" if="$(arg db)"/>
</launch>
but the robot (ur10) doesn't move in rviz for the second time (after planning and execution for the first time), although in the terminal it says:
Fake execution of trajectory Completed trajectory execution with status SUCCEEDED ...
I would appreciate any tips on this?
thanks
I have followed this tutorial.
I'm using: ROSVERSION=1 ROSDISTRO=kinetic Robot type (using move it config)= UR10 and Ubuntu 16.04 LTS
Asked by hooman on 2019-02-13 13:01:59 UTC
Comments
you didn't execute you trajectory at the first time, you only planned. but then yes - trajectory was executed. Are you using default ur10 launch file? if so, did you set param simulation to true?
Asked by kolya_rage on 2019-02-13 14:47:20 UTC
I see, you are following a tutorial. Well, the code above is ok, there are no mistakes. Show me your launch file to run the rviz simulation
Asked by kolya_rage on 2019-02-13 14:53:16 UTC
I just added my launch file. when I do the plan it will execute it and I can see the motion, but I wanted to do it for a second time further down in my code.
Asked by hooman on 2019-02-13 21:38:43 UTC
try setting fake execution to false
Asked by kolya_rage on 2019-02-14 03:44:44 UTC
I will try myself the tutorial a bit later
Asked by kolya_rage on 2019-02-14 03:44:57 UTC
thanks, I set the fake execution to false in the launch file but now it's looking for controllers, saying
Asked by hooman on 2019-02-14 14:09:27 UTC
I have a fake controller in the ur10 config folder
Asked by hooman on 2019-02-14 14:11:13 UTC
I see that wasn't a good advice for me. so fake execution is actually robot simulation.
Asked by kolya_rage on 2019-02-15 07:40:34 UTC
well, every thing seems right to me. Does planning execution works in the rviz? I mean if you do planning in rviz moveit interface?
Asked by kolya_rage on 2019-02-15 07:42:29 UTC
Hi, sorry for delay in getting back. I tried planning in rviz that is followed by execution. but the second time execution still doesn't work although in terminal it says Execution completed: SUCCEEDED
Asked by hooman on 2019-02-20 12:54:44 UTC
as an alternative to execution, would you suggest how to load the trajectory slider with a previously planned trajectory (play an old plan again) using the GUI even after planning a new one? to compare the two (old vs new plan)!
Asked by hooman on 2019-02-20 12:58:07 UTC
You already have made an execution, It means the robot has already moved, and applying the same planning won't work, because the robot now has a different location after the first execution.
Asked by kolya_rage on 2019-02-20 13:34:10 UTC
yes, but I used the rviz joint_state_publisher to move the robot back to the start position. shouldn't that help with executing it again?
Asked by hooman on 2019-02-20 13:47:08 UTC
It should. So you saved your joint_state before execution, then published a new one and then executed once again?
Asked by kolya_rage on 2019-02-20 13:50:20 UTC
Hi, I used the rviz GUI to set the start and goal state, then use the GUI to plan under planning tab which shows execution, and then press execute but nothing happens. Also if I publish the start state where the robot is at the execute gets disabled.
Asked by hooman on 2019-02-26 14:58:00 UTC
thanks and sorry for my delay in getting back.
Asked by hooman on 2019-02-26 14:58:28 UTC
tell please. Is this actual tutorial's code you are testing, or your own implementation. If it is - please mail me with every thing I need to launch the project. Or is this actual tutorial code?
Asked by kolya_rage on 2019-02-26 15:29:21 UTC
The code is pretty much what I have uploaded. Right now, I even didn't use much coding, mostly worked with the rviz GUI. Let me prepare a brief code, removing all the unrelated bits and mail you.
Asked by hooman on 2019-02-26 15:40:46 UTC
Hi, Can you share your solution if your problem is solved? I'm facing the exact same problem.
Asked by rosberrypi on 2019-04-24 06:20:13 UTC