Sphero Project Help

Hi, I’ve tried numerous ways of getting this project to work myself and in the end up I have copied the examples exactly and still can’t seem to get it to work? The first problem is even though it detects a crash it continues to keep moving against the same wall? I think this is due to the following piece of code at the end of the publisher:
while not ctrl_c:
cmd_publisher_object.move_robot(direction = ‘forwards’)
Will this code not just continuously command the robot to move forward, irrespective of the server commands after a collision?

Secondly, to try and run it from the main program, including using Step 5 to create a common package, it still doesn’t recognise the common_pkg as shown in this screenshot:

It would not recognise my topic publisher and that’s why I completed Step 5, should there not be something inside the init.py script to link all the modules from different packages so that they can be ran by the main package? Following the example there is nothing here but I was wondering if listing all the packages/modules inside this script may help?

I have already ensured all my files are executable and I’ve ran catkin_make etc. numerous times.

Thanks in advance.

The following screenshot is proof that it registers the crash but then continues to drive forward when using the example code.

Is the cmd_vel sent? If not, try to follow the code and find out, where it doesnt do something as expected. You can always add little print('test') snippets into your code, so you can see what gets executed and what not.

Thanks for that, I was launching the publisher instead of importing it into the service and commanding it from a function within the service, this works well now thank you. I still can’t get it all to run from the main package following Step 5? If I copied all of the files into the main package I think this would work, but is that bad practice? Thanks in advance

In my book it’s good if you have to start less things manually from the Terminal. No matter how you eventually get it to work, you will need the services and action servers running. For that I usually check whether the standalone functionality works. Can I run the action server for example? And does it respond correctly? You can interact with it manually using rostopic pub and rostopic echo to monitor it.