Open SyZbidi opened 1 month ago
Could be that your robot controller isn't up and publishing to joint_states
topic by the time you are trying to plan. Seems plausible since you're launching everything from the same launch file and real robot drivers usually take a bit of time to establish connections to the hardware and get going.
You could easily test if this theory is correct by introducing a sleep of some duration before doing anything else in your program, just to give time for all the rest of the stuff in the launch file to come up. Alternatively you can subscribe to the joint_states
topic yourself and wait until you get a first message (hint: this is more elegantly solved by liveliness QoS, which you may wanna look into at some date), at which point it may be safe to assume the controller / hardware is up and running and ready to receive commands. Pretty sure ros2_control
provides a mechanism to establish the readyness of the controller / hardware, but I don't know whether MoveIt does anything with it -- I only worked with robots that don't use ros2_control
.
Sorry it's late and I overlooked that you are using FakeHardware so this is unlikely an issue, though you are free to try if sleep helps anyway. At least, confirm you are actually getting something published on the joint_states
topic.
Sorry it's late and I overlooked that you are using FakeHardware so this is unlikely an issue, though you are free to try if sleep helps anyway. At least, confirm you are actually getting something published on the
joint_states
topic.
Your suggestion was actually helpful, thanks a lot! I let it sleep for 10 seconds and now I got to see the plan but no execution.
Also echoed the /joint_states
and noticed that they're not being published so I added them to the launch file and finally got SUCCEEDED
[ros2_control_node-4] [INFO] [1717748497.252701086] [manipulator_controller]: Received new action goal
[ros2_control_node-4] [INFO] [1717748497.252793906] [manipulator_controller]: Accepted new action goal
[moveit_utils-1] [INFO] [1717748497.253029323] [moveit.simple_controller_manager.follow_joint_trajectory_controller_handle]: manipulator_controller started execution
[moveit_utils-1] [INFO] [1717748497.253073435] [moveit.simple_controller_manager.follow_joint_trajectory_controller_handle]: Goal request accepted!
[ros2_control_node-4] [INFO] [1717748499.763253884] [manipulator_controller]: Goal reached, success!
[moveit_utils-1] [INFO] [1717748499.803428641] [moveit.simple_controller_manager.follow_joint_trajectory_controller_handle]: Controller 'manipulator_controller' successfully finished
[moveit_utils-1] [INFO] [1717748500.052285755] [moveit_3805631290.moveit.ros.trajectory_execution_manager]: Completed trajectory execution with status SUCCEEDED ...
[moveit_utils-1] [INFO] [1717748500.060572846] [moveit_3805631290.moveit.ros.moveit_cpp]: Deleting MoveItCpp
[moveit_utils-1] [INFO] [1717748500.079781938] [moveit_3805631290.moveit.ros.planning_scene_monitor]: Stopped publishing maintained planning scene.
[moveit_utils-1] [INFO] [1717748500.080396127] [moveit_3805631290.moveit.ros.planning_scene_monitor]: Stopping world geometry monitor
[moveit_utils-1] [INFO] [1717748500.080647130] [moveit_3805631290.moveit.ros.planning_scene_monitor]: Stopping planning scene monitor
Sorry for the late reply, is your issue fixed now?
Seems plausible since you're launching everything from the same launch file
@okvik I actually wanted to split them I don't like the idea of launching the moveit setup and the moveit_py
node from the same file even if it's for fakehardware, but I didn't know what should the node launch file have for parameters.
I'd appreciate if you have a suggestion but you already solved my main issue so thank you again for that :)
Sorry for the late reply, is your issue fixed now?
Hi @sjahr, not really. there's something wrong in my launch file above. adding a sleep time and a joint_state_publisher
node did help with executing the motion but the /joint_states
topic is publishing all zeros.
So though the fix suggested by @okvik worked, it doesn't seem like the way to go
The solution was to add joint_state_broadcaster
to load_controllers
instead of joint_state_publisher
. For some reason I removed that when I copied the tutorial launch files.
load_controllers = []
for controller in [
"manipulator_controller",
"joint_state_broadcaster",
]:
load_controllers += [
ExecuteProcess(
cmd=["ros2 run controller_manager spawner {}".format(controller)],
shell=True,
output="log",
)
]
@sjahr this is off-topic but also related to my work, it would be helpful if you take a look at this comment when you get the chance. Thank you
@okvik I actually wanted to split them I don't like the idea of launching the moveit setup and the
moveit_py
node from the same file even if it's for fakehardware, but I didn't know what should the node launch file have for parameters.
The way I do it is indeed to split each major hardware component (like a robot) launch from the control program logic and any other supporting nodes such as rviz, potentially the HMI node, etc. Basically, split the system in a way that lets me rebuild / start / restart without having to reboot the entire system from scratch every time. For production I additionally wrap these launches in their own systemd units, which lets me deal with dependencies, starting the system at boot, have more meaningful logging experience, easily clean up broken process trees, etc.
Description
Followed the
motion_planning_python_api
tutorial example, the launch file is almost the same, just addedplanning_pipelines
to moveit_config, and myMoveitPy node
is only trying to plan and execute one example of named_target. I don't understand Python launch files much, and also new to ROS2 unfortunately. So I can't get to locate the reason behind having this errorDidn't receive robot state (joint angles) with recent timestamp within 1.000000 seconds
Your environment
Steps to reproduce
I made my
moveit_config
package withmoveit_setup_assistant
. Then I only changed theacceleration_limits
to True and set a value >0. After that I created a launch file similar to motion_planning_python_api_tutorial.launch.py withmoveit_utils
being my nodelaunch.py
moveit_py_node script
planning.yaml
I commented out the planning scene monitor due to an error that I wanted to move past it
[moveit_utils-1] RuntimeError: Unable to configure planning scene monitor
Expected behaviour
Tell us what should happen
I expected the motion to be planned and executed as simple as that
Backtrace or Console output
Use gist.github.com to copy-paste the console output or segfault backtrace using gdb.
Am I missing parameters? I have no idea where to look to fix the
[rviz2-4] [ERROR] [1717702917.972281146] [rviz2.moveit.ros.trajectory_visualization]: No robot state or robot model loaded
andmoveit_utils-1] [INFO] [1717702918.877642308] [moveit_3672297761.moveit.ros.current_state_monitor]: Didn't receive robot state (joint angles) with recent timestamp within 1.000000 seconds. Requested time 1717702917.877563, but latest received state has time 0.000000.
By the way
use_sim_time
doesn't fix i, I already tried to add it to the node vut I'm l=not using simulation/gazeboThanks!