Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : Failed to connect to the camera module in Gazebo with yarp server #3125

Open
16239014 opened this issue Aug 1, 2024 · 1 comment

Comments

@16239014
Copy link

16239014 commented Aug 1, 2024

@LoreMoretti I am working on gazebo with an icub humanoid robot model running this example https://icub-tech-iit.github.io/documentation/sw_installation/check_your_installation/#check-icub

when I run these commands it shows that it did not connect with the camera. can you help to resolve it?

To view the output from the cameras in terminals

yarpview --name /view/left
yarpview --name /view/right

And to connect them:

yarp connect /icubSim/cam/left/rgbImage:o /view/left
yarp connect /icubSim/cam/right/rgbImage:o /view/right

I also try code:

import yarp
import sys
# Initialize YARP network
yarp.Network.init()

# Create a port to read from the camera
image_port = yarp.Port()
image_port.open("/client/image/in")

# Connect to the camera port
if not yarp.Network.connect("/icubSim/cam/left/rgbImage:0", "/client/image/in"):
    print("Failed to connect to the camera 123.")
    sys.exit()

# Prepare a YARP image to receive data
yarp_image = yarp.ImageRgb()
yarp_image.resize(640, 480)  # Set the resolution

# Read from the port
if image_port.read(yarp_image):
    print("Image received!")

# Close the port
image_port.close()
yarp.Network.fini()
@16239014 16239014 changed the title Error : Failed to connect to the camera Error : Failed to connect to the camera module in Gazebo Aug 2, 2024
@16239014 16239014 changed the title Error : Failed to connect to the camera module in Gazebo Error : Failed to connect to the camera module in Gazebo with yarp server Aug 2, 2024
@randaz81
Copy link
Member

The code contains a typo: rgbImage:0 instead of rgbImage:o.
If you still have issues, use the command yarp name list to verify the name of the ports streaming the robot cameras, then use the command yarp stats <PORT_NAME> to check the output of these ports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants