softbankrobotics-research / qibullet

Bullet simulation for SoftBank Robotics robots
Apache License 2.0
141 stars 38 forks source link

pepper_shadowing #76

Closed ysys98 closed 2 years ago

ysys98 commented 2 years ago

when I rosrun pepper_shadowing.py In fact, I replaced pepper with Nao, and then this result occurred. At first, I thought it could not be replaced, but this result also occurred when I ran the code before replacement

shadowing

what should I do ?

mbusy commented 2 years ago

Hi @ysys98, you can indeed replace Pepper with NAO in the example, more specifically by modifying this line. But the example doesn't use ROS, it directly uses the qi SDK to interact with the robot (as you can see here). I would advise to launch the program without rosrun:

# replace the x.x.x.x by the ip of the real robot
python pepper_shadowing.py --ip x.x.x.x

You probably got the error message because you didn't specify the ip of your robot

ysys98 commented 2 years ago

Hi @ysys98, you can indeed replace Pepper with NAO in the example, more specifically by modifying this line. But the example doesn't use ROS, it directly uses the qi SDK to interact with the robot (as you can see here). I would advise to launch the program without rosrun:

# replace the x.x.x.x by the ip of the real robot
python pepper_shadowing.py --ip x.x.x.x

You probably got the error message because you didn't specify the ip of your robot @mbusy Thank you very much! I have followed your reply to do things about https://github.com/ros-naoqi/naoqi_driver/issues/147

when I added broadcastodometry method into robot ros test. py, I made an error after the operation. I checked and found that I may not have a publisher about odometry, so I found a odometry publisher.cpp program that might provide a publisher at http://docs.ros.org/en/kinetic/api/odometry_publisher_tutorial/html/odometry__publisher_8cpp_source.html , I think I have one parameter of _broadcastodometry (def _broadcastodometry (self, odometrypublisher):), but when I run odometry publisher. cpp to start the publisher of odometry and run the robot ros test. py I modified, but he automatically closes it and outputs such a log:

Traceback (most recent call last): File "/home/roskinetic/demo01_ws/src/qibullet/scripts/robot_ros_test.py", line 50, in wrap._broadcastOdometry("odom_pub") File "/home/roskinetic/.local/lib/python2.7/site-packages/qibullet/ros_wrapper.py", line 208, in _broadcastOdometry physicsClientId=self.robot.getPhysicsClientId()) TypeError: function takes at most 2 arguments (3 given) Stopping the ROS wrapper: function takes at most 2 arguments (3 given) [robot_state_publisher_roskinetic_VirtualBox_21246_1218137726150742084-1] killing on exit Stopping roslauncher

This is the odometry publisher.cpp I found, the robot ros_ test. py I modified, and his input log:

7 8 4 120 1 999 9999
ysys98 commented 2 years ago

Hi @ysys98, you can indeed replace Pepper with NAO in the example, more specifically by modifying this line. But the example doesn't use ROS, it directly uses the qi SDK to interact with the robot (as you can see here). I would advise to launch the program without rosrun:

# replace the x.x.x.x by the ip of the real robot
python pepper_shadowing.py --ip x.x.x.x

You probably got the error message because you didn't specify the ip of your robot

@mbusy When I checked, I found that vscode did not display the import pybullet module. I thought it might be that it was not installed properly during installation, so I reinstalled it again and solved this problem. For the above problems, I'm made a small change for ros_ wrapper. py ,

333

Oh, by the way, I changed the parameters above wrap._broadcastOdometry("odom_pub") from odometry_publisher to odom_pub,

444

After I ran it, although it did not close automatically, an error log still appeared, I'm confused

555
mbusy commented 2 years ago

Hi @ysys98, like I mentioned in #78, _broadcastOdometry is an internal method and shouldn't be called (it's automatically called when launching the ROS wrapper). You don't have to publish the odometry manually, qiBullet is going to do it for you. So technically, the ros example of the repo is all you need to link qibullet to ROS.

Anyway this odometry related question isn't link to the current issue, so let's discuss it further in #78. I'll close this shadowing related issue for now, I believe that that comment should fix the problem. Let's reopen it if another problem arises