I am going thru the notebook step by step, and am the point where I have to start taking the pictures
So far everything is working as it should for me
I'm not sure how much help I can be, as I only just barely understand what I'm doing, however, if you're going thru the notebook step by step, you should start with "basic motion", then go to "teleoperation"
You have a different joystick than I do, so I can't answer you precisely, but, on mine, I had to change this setting...
From a "1" to a "0". And the documentation was sketchy, so I basically guessed what to put in. After that the robot reacted precisely to my joystick commands
Thanks for reply. I can move the robot by putting correct index value - (as indicated by Gamepad Tester)
But the movement of robot with respect to joystick is so fast. Motors runs at full speed even though I just touch momentarily to the joystick axis.
but in "teleoperation traitlets" I dont know which methods to use to control the speed. Like in following code
left_link = traitlets.dlink((controller.axes[0], 'value'), (robot.left_motor, 'value'), transform=lambda x: -x) right_link = traitlets.dlink((controller.axes[1], 'value'), (robot.right_motor, 'value'), transform=lambda x: -x)
If you did not changed any settings like above. Does your robot moves very precisely as you move joystick?
for time being I have used another python GUI button interface (given in notebook) which simulates the joystick buttons and modified the speed of the motors using basic methods like
robot.left_motor.value = 0.3
robot.right_motor.value = 0.6
then attached the motor to the button and created interface to capture the images for training model of obstacle avoidance. But its just workaround, I want to use gamepad instead but this motor speed control problem not solved yet!
I see what you're doing, you're using the gui from the notebook. Did you get the slider traitlet working ?
I just had a thought. I'm at work ao i can't test it, but see if you can follow my logic cuz i have no idea what im talking about...
What if you use the sliders merely as an indicator ?
What if the fact that the bot moves when you hit the joystick doesnt mean that you've got the right index number ?
What if you try another index number, and that gives you the digital proportional that youre looking for ?
Just because mine works on 0 doesnt mean 0 is correct for yours because you've got a different joystick
I think I need to get myself a Jetbot.
soon..... it’s on the list. Or should I first get a 3D printer and print the parts? Owwww. I’ll figure it out tomorrow.
I think I need to get myself a Jetbot.
soon..... it’s on the list. Or should I first get a 3D printer and print the parts? Owwww. I’ll figure it out tomorrow.
My choice would be to opt for a really nice 3D printer. That would require a lot more time and effort to print out a Jetbot, but my reasoning would be that I could then continue to use the 3D printer for other things.
But that's just me. I almost always opt to buy tools to make things rather than buying the things the tools can make. ?
My approach is good for someone who has the room for the tools, and plans on using them for other things. Obviously, if space is limited and the main goal is to just get a Jetbot, then just buying a Jetbot straight out would clearly be the better choice.
DroneBot Workshop Robotics Engineer
James
Well, I like the way you think. And your response is close to what I expected. So now I am continuing down the research curve of best printer to buy. I think my budget will be ~$400 US. Should include everything needed. No rush. After all better options arise over time.
@stven - have just printed out a switch box for a water pump, some brackets to hold an insect curtain rail and a nice round cover for an external airline I'm with @robo-pi in saying just how useful my 3d printer is proving to be for all sorts of things, beside electronic boxes or robot parts. I'm jolly glad I got mine. I see that Prusa have just put a very nice new 3d printer on the market which is in your budget and very nice it looks too.
I wanna try to focus on the programming for the Jetbot for a bit here. gathering up the parts, and physically building the hardware is just a bunch of parts. You don't even have to build the Jetbot with its suggested body parts, because, it's just a place to house wheels, batteries, the Jetson and a camera
All that aside, if you've got the updated Jetbot image, the thing works perfectly (for me anyway, it seems that not all joysticks are created equal). I haven't gotten to the "follow me" portion of testing yet, but that's coming
Anyway, the Jetbot is written with a specific motor controller in mind, the Adafruit Feather Wing
https://www.adafruit.com/product/2927
And, I tried connecting the thing without using the also suggested PioLED display
https://www.adafruit.com/product/3527
For some reason, the bot wouldn't work unless I had both parts installed. I found the spot (2 spots actually) in the Jetbot where it assigns the hardware for the motor controller
The code is as follows...
motor.py
import atexit
from Adafruit_MotorHAT import Adafruit_MotorHAT
import traitlets
from traitlets.config.configurable import Configurable
class Motor(Configurable):
value = traitlets.Float()
# config
alpha = traitlets.Float(default_value=1.0).tag(config=True)
beta = traitlets.Float(default_value=0.0).tag(config=True)
def __init__(self, driver, channel, *args, **kwargs):
super(Motor, self).__init__(*args, **kwargs) # initializes traitlets
self._driver = driver
self._motor = self._driver.getMotor(channel)
atexit.register(self._release)
@traitlets.observe('value')
def _observe_value(self, change):
self._write_value(change['new'])
def _write_value(self, value):
"""Sets motor value between [-1, 1]"""
mapped_value = int(255.0 * (self.alpha * value + self.beta))
speed = min(max(abs(mapped_value), 0), 255)
self._motor.setSpeed(speed)
if mapped_value < 0:
self._motor.run(Adafruit_MotorHAT.FORWARD)
else:
self._motor.run(Adafruit_MotorHAT.BACKWARD)
def _release(self):
"""Stops motor by releasing control"""
self._motor.run(Adafruit_MotorHAT.RELEASE)
robot.py
import time
import traitlets
from traitlets.config.configurable import SingletonConfigurable
from Adafruit_MotorHAT import Adafruit_MotorHAT
from .motor import Motor
class Robot(SingletonConfigurable):
left_motor = traitlets.Instance(Motor)
right_motor = traitlets.Instance(Motor)
# config
i2c_bus = traitlets.Integer(default_value=1).tag(config=True)
left_motor_channel = traitlets.Integer(default_value=1).tag(config=True)
left_motor_alpha = traitlets.Float(default_value=1.0).tag(config=True)
right_motor_channel = traitlets.Integer(default_value=2).tag(config=True)
right_motor_alpha = traitlets.Float(default_value=1.0).tag(config=True)
def __init__(self, *args, **kwargs):
super(Robot, self).__init__(*args, **kwargs)
self.motor_driver = Adafruit_MotorHAT(i2c_bus=self.i2c_bus)
self.left_motor = Motor(self.motor_driver, channel=self.left_motor_channel, alpha=self.left_motor_alpha)
self.right_motor = Motor(self.motor_driver, channel=self.right_motor_channel, alpha=self.right_motor_alpha)
def set_motors(self, left_speed, right_speed):
self.left_motor.value = left_speed
self.right_motor.value = right_speed
def forward(self, speed=1.0, duration=None):
self.left_motor.value = speed
self.right_motor.value = speed
def backward(self, speed=1.0):
self.left_motor.value = -speed
self.right_motor.value = -speed
def left(self, speed=1.0):
self.left_motor.value = -speed
self.right_motor.value = speed
def right(self, speed=1.0):
self.left_motor.value = speed
self.right_motor.value = -speed
def stop(self):
self.left_motor.value = 0
self.right_motor.value = 0
Now, since the DB1 project could conceivably be using ROS and the Jetson Nano as well as the MD10C motor controller, I'm posting this stuff in the hopes that somebody, who knows enough about programming, might be able to get a head start on the programming for this thing. Somehow, the Adafruit has to be replaced with the MD10C, and I have no idea how to go about doing that
Right now I'm taking a Udemy course in ROS, but, so far, there's nothing about specifying hardware yet. I'm still working on compiling, and which IDE to use, which version of which IDE, and how to work the IDE.
To be honest, I'm not finding the class very helpful as of yet. The course is using Ubuntu and ROS Kinetic, as well as using a VM instead of actual hardware, but, I'm using a RPi3B and an SB motor board as well as an Adfruit Crikit Hat which I probably will never get to work thru ROS, but, I'm going to try anyway, even if I have to skip the ROS part and just use python and a handheld remote control because I have another project that isn't part of the DB1, which, if it works, will be one of the coolest things I've ever made
And now the I2C appears to have failed on the Nano
First I saw that the SSD1306 had stopped displaying the IP, or, in fact anything at all. I also tried the motor controller, and it wasn't working either. I thought that the display board had failed, which the motor controller is connected to, so as a test I installed it on one of my Pi's, and, sadly, it worked fine, so then I reinstalled it on the Nano, and reinstalled the Jetbot OS, which also didn't make the thing start displaying. So I ran the I2C scanner to identify I2C devices, and it told me that it couldn't scan I2C devices
So now I'm in negotiations with Nvidia to see if I can get this thing warranty replaced, but, it isn't looking good just yet
I hope I don't have any problems with my Jetson Nano. I haven't even used the GPIO pins yet. I also haven't even tested to see if the Raspberry Pi Camera works yet. I have it connected, but I never even tried to see if it works. I've been too busy with other things. I'm also waiting for Paul McWhorter to do his video on accessing the Pi Camera with OpenCV. That will probably be the first time I use mine as well.
So far all I've been doing with the Jeston Nano is using it as a desktop computer running Kdenlive video editor. So far it's be working for that without any problems. But I'm not using it to record any actual video. I just take video with external video cameras and then upload the videos to the Jetson Nano via a USB port. So far that much has been working seamlessly. All the Jetson Nano has to do is edit the videos with Kdenlive and then render them back out again. And thus far that's been working just fine.
DroneBot Workshop Robotics Engineer
James
And now the I2C appears to have failed on the Nano
By the way. Do you have another system OS card you could try testing the I2C on that system? Could it be a possible software problem?
This is one reason I like to have back up OS cards. If something goes drastically wrong I can always boot up on a previous version that I know was working and see if that version still works. If not, then you know it's a hardware problem. On the other hand, if a clean OS works, then you know it's got to be something associated with the software or configuration parameters.
DroneBot Workshop Robotics Engineer
James
Do you have another system OS card you could try testing the I2C on that system?
I have other ones, with different OS builds, but, not ready made backup sd cards. If I want to go back to an earlier version, I have to create them from a backup file. In this case, I didn't do that, I just reloaded the original Jetbot package load, which was built to work with that hardware
if a clean OS works, then you know it's got to be something associated with the software
I did try that. A fresh load didn't work. I'm convinced it's the Nano, but I'm having a problem with getting Nvidia to acknowledge that. They sent me an email saying "We see that you contacted us about a problem, if your problem was resolved, and we don't hear from you in 72 hours, we will consider this case closed"
So I responded to their obviously artificial unintelleigence saying that "No, my problem has, in fact, not been resolved, which is the reason I am responding within your 72 hour time limit to explain to you that since nothing has been done to resolve my problem, logically, my problem still exists"
I'll be looking forward to seeing how you make out with Nvidia. In the meantime I just thought of something else that might be worth a shot. The Jetson Nano is two modules. One is the CPU board and the other is the development board. Have you tried unplugging the CPU module, inspecting the connection pin, and they plugging it back into the development board. Chances of this helping are slim I agree. But you never know, it could be something as simple as a bad connection between the CPU board and the development module.
Highly unlikely I know. But you never know about these things. One day my laptop computer wouldn't boot. It just came up to a blank screen and stopped. I couldn't even get into the BIOS. I figured it was shot. The good news is that it wasn't giving me the "Can't find Boot Disk" error.
Anyway, I took it outside and blew it off with compressed air. I just wanted to clean the dust out of it before I started to do some serious troubleshooting. But to my surprise and amazement when I brought it back in it booted up normally and has been working just fine ever since. That was several months ago. So apparently there must have been some dust causing the problem? I have no clue what fixed it, all I did was blow it all out with compressed air and now it works just fine.
DroneBot Workshop Robotics Engineer
James
Have you tried unplugging the CPU module, inspecting the connection pin, and they plugging it back into the development board
Yup. I had that same thought, so I did that when I took out the SD card to replace it
It's a good thought tho. It must be, cuz I had the same idea ?