If you have a GoPiGo3 and the DI/ModRobotics IMU, please give my “Unofficial Safe IMU For GoPiGo3” package a quick run. (You do not need ROS to try it out.)
Installation:
$ sudo pip install imu4gopigo3ros
Test:
startIMU
readIMU
resetIMU
calibrateIMU
startIMU -i
python2.7
>>>import ros_safe_inertial_measurement_unit as imupkg
>>>imu=imupkg.SafeIMUSensor()
>>>imu.readAndPrint()
ctrl-c
ctrl-d
Remove
$ sudo pip uninstall imu4gopigo3ros
The package on PyPi: (ignore that “for ROS”)
Let me know how it goes…
[UPDATE] For Python3 (and ROS2):
Installation:
$ sudo pip3 install imu4gopigo3ros2
Test:
startIMU
readIMU
resetIMU
calibrateIMU
startIMU -i
python3
>>>import ros_safe_inertial_measurement_unit as imupkg
>>>imu=imupkg.SafeIMUSensor()
>>>imu.readAndPrint()
ctrl-c
ctrl-d
As soon as I get myself reorganized and cleaned up from the PS stuff, I’ll try it.
If it’s not exclusively for ROS, why advertise it as being for ROS? That will chase away a lot of prospective users.
Is it possible to integrate it into the and/or as a standard system call that other stuff can use, like R4R or GoPiGo OS so that I can use it within existing functionality?
A long story that ends with “myeah”, (I changed the name seven times in two years, four of which in the last two weeks), and begins with DI GoPiGo3 code expects the IMU is mounted head-up/vertical, and ROS expects it mounted head left/horizontal.
I put it on pypi with the idea that it makes delivering it easy to the only other person I know of that will need it - Keith, and he will need it for his ROS IMU-sensor.py.
Give me a break - there are a lot prospective users? I’ve been publishing "what I thought to be useful to someone else " GoPiGo3 code for years and have yet to have a single person make use of it. DI/ModRobotics have committed to publishing and maintaining code for prospective users. There may be lots of GoPiGo3 users, but the only ones I know of are you and Keith. You two are the only ones I care really care about. Shoot me - where is that coat?
The API and utilities are totally separate, non-interfering with all existing programs, designed to not break anything, and are specifically designed to run in a multiple IMU client design (as long as no client changes the hardware mode).
I think there are only two DI IMU examples, compass_bot.py and IMU_Sensor.py, and it is very easy and educational to create a safe_compass_bot.py and a safe_IMU_Sensor.py by:
replace the import of inertial_measurement_unit:
from di_sensors.inertial_measurement_unit import InertialMeasurementUnit
with:
import ros_inertial_measurement_unit as inertial_measurement_unit
BUT I commented out the axis remap in the DI code, and the DI Sensor mount can’t hold the sensor horizontal pointing left, and folks just starting out with GoPiGo3 and an IMU should use the DI code until they start complaining about I2C [Err no 5]. Then if they want to do something more than run the examples, they can investigate an “Unofficial Safe” way to use the IMU.
Thank you. I could probably just gotten it from your GitHub (depending on the dependencies) but this is certainly handier. And you learned how to do add something on pypi - which is impressive.
I was on a conference call and not paying attention and was looking at your GitHub rosbot-on-gopigo3/imu4gopigo3ros/ . You have good documentation - I’m especially impressed by the ascii art in the README.md.
As noted I’m planning to work on Finmark on Saturday and will try the IMU code. If it keeps the node from crashing regularly I’ll be able to keep running the IMU.
When I got the Hands on ROS book and found this forum, I’ll admit that I was hoping that a bit of a community would form around this. That said, I am enjoying the forums and appreciate the input both from you @cyclicalobsessive and from @jimrh.
/K
PS - on a completely unrelated note, as I was poking around GitHub instead of paying attention to my call, I note that @cleoqc has a GitHub badge for contributing code to a repository used by the Ingenuity Mars Helicopter. I knew she had code on the space shuttle, but I think this is even cooler IMHO.
So the first test is try startIMU, and readIMU without the ROS distance sensor node running.
Your distance sensor declares a default distance sensor class which does not use the mutex, so even though readIMU is using the mutex, collisions can still happen. To test if the “safe” IMU is going to nicely co-exist with your distance sensor, you will have to add use_mutex=True to the instantiation in your node:
my_sensor = EasyDistanceSensor()
becomes:
my_sensor = EasyDistanceSensor(use_mutex=True)
With that change your distance_sensor node will be safely accessing the I2C bus, and readIMU will be safely accessing I2C with clock-stretching. I expect the readIMU to report about 8 soft exceptions per hour, but the distance sensor should not see any exceptions.
Once you confirm the IMU lives well with the distance_sensor, either you can convert the ROS IMU_Sensor.py node to use the ros_safe_inertial_measurement_unit and SafeIMUSensor() class, with the data methods prefixed with “safe_”, or I can shoot you a safe_IMU_Sensor.py and you can add a launch config just for the safe_IMU_Sensor node and the distance_sensor node for testing, whichever you prefer.
Ouch - that will be a problem. I built imu4gopigo3ros with Python3 as a requirement. I have the feeling it won’t even install, but certainly will not be found in the Python2 site packages if it will install.
I’ll have to do some more learning how to support both Python2 and 3 in the same package.
At this stage of the game, I’m not sure if that’s even possible as the differences between Python 2 and Python 3 are just too great.
In fact, it may not run well and/or at all, based on the particular version of Python 3 you have.
Because, (unfortunately), Guido has absolutely no problem approving PIPs that totally break backwards compatibility, even within a major version number.
I have already run into problems where DI’s version of Python 3 is too old to run certain other packages I’d like to use and upgrading Python causes older stuff to break. It rapidly becomes a plate of spaghetti.
I’ll go back to something I said on another thread about HP Basic: IMHO, back then HP Basic was what Python should have become today.
I could not figure out how to test the python2 code on my 64-bit Ubuntu Dave, so I copied the project over to Carl, and made the PyPi package imu4gopigo3ros only support Python2.
Dave’s Python3 ROS2 package has been renamed imu4gopigo3ros2 and only supports Python3.
So for ROS and Python2:
Installation:
sudo pip install imu4gopigo3ros
and for ROS2 and Python3:
Installation:
sudo pip3 install imu4gopigo3ros2
@KeithW I apologize for not being able to give you well-tested solution.
Please
uninstall the existing imu4gopigo3ros package,
sudo pip uninstall imu4gopigo3ros
install the latest (v0.5),
sudo pip install imu4gopigo3ros
test the basic interface with startIMU and readIMU
then fire up the ROS Python2 safe_imu_sensor node
Hoping for a miracle (or at least something close!)
Absolutely no apologies necessary - you’ve gone way past above and beyond already.
I don’t think I was clear enough previously - I was able to run the package from the command line with no problems; it installed cleanly. imu.readAndPrint() gave me very plausible values as I manually held Finmark in different orientations.
When I make the leap to ROS2 and Python3 I’ll be all set (actually I do use Python3 now for everything except ROS)
If you have the strength left to try once more - I think I figured out how to get past all the “Python2 is END-OF-LIFE - You are swimming in quick-sand and we aren’t coming to save you!” warnings. They are making it real hard to perform new installs of tools to generate Python2.7 stuff.
Don’t feel too bad, all you have to rip out is software. . . .
Leave the salad for the Martians!
All kidding aside, you’ve done 2000% more than expected or necessary and it’s the rest of us that should be apologizing to you for making you feel like you had to do it for us.
Not the feeling at all - Just a “GoPiGo3 missionary” trying to spread the “Good News”. It won’t get you into heaven, and more than likely is signing up for at least one headache.
No, I saw a bunch of people running in a single direction, started running with them and then decided to ask where are we going. All the folks around me said “no idea. FOMO”