Ros2-CoppeliaSim and some bug.

Typically: "How do I... ", "How can I... " questions
Post Reply
fairytalef00
Posts: 10
Joined: 31 Jan 2024, 10:15

Ros2-CoppeliaSim and some bug.

Post by fairytalef00 »

Hello.

I'm struggling to build a connection environment between Ros2 and CoppeliaSim.

To describe the current situation,
First, I have a randomly created rotating robot with 'dynamic mode' for the joints.
Also, the control mode is 'custom'.
Similarly, the other links have mass and inertia.

The revolute joint (subscriber) in coppeliaSim receives topic(angle) from the publisher, and we want the joint to adjust its rotation angle.
Like every second pi/10, pi/20, pi/30 ... (excel file content. row 1, row 2, row 3, ...) and so on.

So I made an external publisher (python) to send topic(angle) every second down 1 row of excel file contents.

I thought the revolute joint(subscriber) would then adjust the angle as it receives the topic, but I get an error where it adjusts and then repositions back to the original angle.

I'm attaching the script for the joint, as well as a video of the error.

https://1drv.ms/f/s!AuvU7BTQNjpWh_Vem8H ... w?e=vaajZM

What could be the problem?



Thank you.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Ros2-CoppeliaSim and some bug.

Post by coppelia »

Hello,

from the video, it looks like the joint gets target positions from two different sources. Best would be if you shared the scene file, so that we could have a closer look at it.

Cheers

fairytalef00
Posts: 10
Joined: 31 Jan 2024, 10:15

Re: Ros2-CoppeliaSim and some bug.

Post by fairytalef00 »

Thank you for reply.

https://1drv.ms/f/s!AuvU7BTQNjpWh_Vem8H ... w?e=2afGAb

There are my files(scene, video. etc) about this test.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Ros2-CoppeliaSim and some bug.

Post by coppelia »

So you have several problems in that scene:
  • The upper and lower cuboids are colliding and friction between them may influence the motion. Make sure that either they are not colliding, or that the upper cuboid is not respondable (or does not generate a collision response with the lower cuboid)
  • Since your joint is dynamic, you should use sim.setJointTargetPosition, not sim.setJointPosition
  • Your joint is in custom control mode, but there is no sysCall_joint callback function. Just set the joint into force control mode.
Cheers

fairytalef00
Posts: 10
Joined: 31 Jan 2024, 10:15

Re: Ros2-CoppeliaSim and some bug.

Post by fairytalef00 »

Thank you so much.

This has helped me a lot

Post Reply