ROS on Raspberry PI...
 
Notifications
Clear all

ROS on Raspberry PI 3B+ progress report.

97 Posts
10 Users
4 Likes
46.4 K Views
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

Okay, now I'm confused again

It's saying that it's rosmaster as well as being a publisher. So, does this mean we're back to needing TWO again ? We can't run this on a single computer ?

I started rosbridge, which should allow me to control the bots movement thru my cell phone, but, it doesn't wanna connect on port 9099 like it says it's supposed to. It DOES show an open port on 80 which brings up an NGINX web page, but, the cell phone app doesn't seem to like port 80 for control. 

I opened a 2nd ssh instance to the "bot" and started roscore, then started rosbridge, then I used the other ssh to look at used ports, and I see 3 rosouts, on ports 45231, 46525, and 35281, and, of course nginx on port 80, but rosbridge doesn't seem to open 9099 nor is there any feedback on the screen to tell me that rosbridge is actually running

How do I tell it about our hardware motor controllers ? (md10c)

How do I tell it about a camera ? (I'd like to use the pixycam, but the logitech or picam should work)

I'm still playing with it, but, it still looks positive. I'm not going to claim that the software doesn't work just because I don't yet understand it, cuz I think it's working


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

Okay. I was launching rosbridge wrong. The command is...

roslaunch rosbridge_server rosbridge_websocket.launch

Once you start roscore, it puts you into roscore mode, from which you can't issue the rosbridge command, and you can't issue the roscore command while you're in the rosbridge screen

The app connects when you start rosbridge, which is cool. It has no idea what motor controller I have, which means that the app actually doesn't do anything helpful at all, although it does say "connected" in a rather satisfying female voice

I'll try opening a 2nd ssh window and starting each from its own window...

Okay. That worked. Now both roscore and rosbridge are running. A bit cumbersome to have to use 2 windows to do it tho

Now, what about my hardware ?

The python program performs properly, propelling the pieces perpendicularly (or something. It goes when I use the python program to make the motors go left, right, forward and backward)

I'll see if I can poke the proper ports pertinent to the positronic personoid's personal predilection (make it go with the robot app)

I gotta figure out where it defines the hardware

 

   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

This looks promising...

http://wiki.ros.org/simple_drive

I'm not using an arduino tho. The motor controller is connected to the Pi. So, I guess if I wanted to use this code, I'd have to send the signals to the arduino, which would then send the signals to the L298N (or the MD10C once I install it in its big brother)

But, isn't that what @dronebot-workshop is planning anyway ?


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @spyder

But, isn't that what @dronebot-workshop is planning anyway ?

I think Professor Bill had some code in episode 11 of the DB1 series.  It could probably be adapted to systems other than just the Arduino.  I'm waiting for him to make the code available so I can get my robots up and running.

I need more code
for my robot a la mode

I'm afraid to code alone
lest I cause an overload

So I'm looking for the Workshop code
that Billy has bestowed

And that's the inspiration
for this little bit of ode

 

 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

@robo-pi

Yea, he posted something. I've got a copy of it here. It's just test code tho. Move. Stop. Spin

/*
DB1 Robot PWM Motor Test
db1_motortest.ino
Uses Arduino Mega to test motors

DroneBot Workshop 2019
https://dronebotworkshop.com
*/

// Left PWM output pin
#define leftpwm 10

// Right PWM output pin
#define rightpwm 11

// Left motor direction pin
#define leftdir 8

// Left motor direction pin
#define rightdir 7

void setup(){

// Define Pins as Outputs
pinMode(leftpwm,OUTPUT);
pinMode(rightpwm,OUTPUT);
pinMode(leftdir,OUTPUT);
pinMode(rightdir,OUTPUT);

//Delay for 2 Seconds
delay(2000);

// Move Forward for 1 second

analogWrite(leftpwm,200);
analogWrite(rightpwm,200);

digitalWrite(leftdir,1);
digitalWrite(rightdir,1);

delay(1000);

// Stop for 1 second

analogWrite(leftpwm,0);
analogWrite(rightpwm,0);

delay(1000);

// Move Reverse for 1 second

analogWrite(leftpwm,200);
analogWrite(rightpwm,200);

digitalWrite(leftdir,0);
digitalWrite(rightdir,0);

delay(1000);

// Stop for 1 second

analogWrite(leftpwm,0);
analogWrite(rightpwm,0);

delay(1000);

// Spin for 2 seconds

analogWrite(leftpwm,255);
analogWrite(rightpwm,255);

digitalWrite(leftdir,0);
digitalWrite(rightdir,1);/*

}


void loop() {

// Nothing in Loop

}

   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @spyder

Yea, he posted something. I've got a copy of it here. It's just test code tho. Move. Stop. Spin

No, that's not the code I'm talking about.   The code I'm talking about starts at 6:00 in episode 11.

I don't have a copy of it to paste in here because I couldn't find a copy of the actual code.  All I saw was the code in the video.   I could probably work with just the video but he was jumping over large blocks of code.   I'm not sure if I could glean the entire thing from the video or not.  I haven't actually tried yet.

But the code I'm talking about sets the I2C addresses for the motor controller cards.   It also includes motor acceleration and deceleration.   He also said that he was going to put the acceleration routines into another function.   So I've been waiting to see what he's going to do with that.    I have my hardware mounted on my little robot cars with a Mega board and two STM32 boards that I'll be using to replace the Nanos Bill's using.

So I'm hoping that in the next DB1 episode he's going to go over this full controller code in more detail and make the code available on his website or GitHub.   

But yeah, the code I'm talking about includes the I2C addressing of the motor controller cards and the acceleration and deceleration of the motors using encoder feedback.   It's not just start, stop, reverse, and spin.  I already have my robots doing that.    But I'm driving them directly from the Mega.  I'm reader to start using the motor encoders now and the two individual STM32 cards addressed via I2C to control the motors.

I hope he covers this in the next DB1 episode.  That's what I'm looking forward to.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 
Posted by: @robo-pi

I'm reader to start using the motor encoders now and the two individual STM32 cards addressed via I2C to control the motors.

He said that the encoders were the function part that he didn't like, so, even if he did post that code, it wouldn't be to his satisfaction, or, probably, yours

Also, if you look at the top of the page where the name of the file is, you'll see that it's just a "motor test", so, not even finished anyway

Personally, I had to watch it again myself cuz I don't think I fully understand the relationship between the arduino and the pi. On my small version, the pi is telling the motor controller to send PWM, and how much and which way, so, other than reading the encoders and i2c, what is the arduino's job in the movement of the robot if the pi can communicate directly with the motor controller ?

Is the reasoning for the arduino to collect more i2c data ?

Does the arduino simply relay the PWM sent from the pi ?

Could I take this small version of my robot and add the arduino and still have it do the same thing ?

I see "define" in his code, but I don't see any "include" for the MD10C, so, is this just sending PWM, and the arduino really doesn't need drivers for the MD10C ?


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

@spyder

I have some idea of what Bill is hoping to achieve, but like you, I'm not clear on the details.

I could be wrong, but I think the code in that video is for the Arduino Nanos.   The Arduino Mega would then have different code on it that tells the Nanos what to do.

I'm not sure but I think the idea behind this is to free the Mega up so that it can also monitor a bunch of I2C sensors that will also be sending interrupts.

How the Raspberry Pi will fit into all this I have no clue.  I'm extremely interested in seeing what he does when it comes to adding the Pi into the mix.   My guess is that the Pi will contain the higher-level code for the robot as a whole.

This is a similar idea that I was already going with prior to Bill starting the DB1 project.   And I'm glad to see Bill doing it this way.  I like the idea of having different controllers dedicated to different tasks.  I think it makes more sense in terms of coding, and less problems with interrupts potentially interfering with each other.   Also, this means that we we finally do get to programming the Raspberry Pi all this low-level stuff will already be out of the way on the Arduino boards.   This will free us up on the Raspberry Pi to just focus on the higher level decisions for the robot.

It's a very interesting project to be sure.   I'm very patiently waiting to see where Bill is going with the DB1.  I'm really curious what he's going to do inside the Raspberry Pi.   I'm hoping he'll use Python, but maybe not.  I'm planning on using Python on the Raspberry Pi, so if he uses some other language I'll need to translate what he's doing into Python.   Or maybe I'll go with the language he uses.  I'll have to wait and see what he does.

What language do use to write programs on your Raspberry Pi?

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

@robo-pi

Well, I'm far from being any good at it, but I use python to directly communicate with the hardware. I haven't used any sensor feedback or anything like that yet, but, I've been able to make the robot go from my phone if I don't use the ROS. I do have a box of ultrasonic distance sensors tho for when I'm ready

I still haven't figured out what kind of data the ROS is sending when it thinks it's telling the robot to move. But that's my ultimate goal, to use the ROS. If I can't tho, I guess that would be okay, cuz I've got the baby robot moving with just python, and it's using PWM thru a L298N for the motors, so, I guess it shouldn't be too hard to translate that for the MD10C. Those are sitting in a box, waiting

It's a shame tho, cuz the ROS has got a nice android interface for teleop. No camera tho on the android app


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @spyder

Well, I'm far from being any good at it, but I use python to directly communicate with the hardware.

I'm not good at it either.  I only started to learn Python last year.  I'm making progress with it.  But I usually need to google every little thing I want to do.   Thankfully it's pretty easy to find example code almost instantly for pretty much anything you might want to do.   Originally I was trying to look things up in a programming book I have.  But I found that it's far quicker to just type into Google what I want to do and find example code.  The key is in learning exactly what to type into Google in order to get the best results.

So instead of becoming an expert at Python, I'm becoming an expert at Google searching. ? 

DroneBot Workshop Robotics Engineer
James


   
Spyder reacted
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 
Posted by: @robo-pi

So instead of becoming an expert at Python, I'm becoming an expert at Google

Ditto


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

All the data I'm reading says that ROS runs on publisher/subscriber, so, should I get a second Pi and install the same version of ROS and just make one publisher and the other subscriber ?

My first thought was to use the Jetson, but, it's not running the same version as the Pi. The Jetson has its own NVIDIA version, however, my thoughts on that are that if it's just collecting data, well, data is universal

If the sensors say that the bot is looking at fiduciary marker 49, and is 10 feet away from it, well, why would different versions even matter ?

Can I just make the Jetson into the publisher (cuz it's more powerful) and the Pi as the subscriber ?

As an aside, I found a piece of code called "fiducial follow", which sounds really cool (well, it's cool to me cuz that's the main thing I want my bot to do)

I tried pasting the code here, but the formatting went away, which made it basically useless, so I created a github thingy, and stuck it in there...

https://github.com/Spyder19/ROS

I'm gonna stick all my other ROS files in there too


   
ReplyQuote
soumitra
(@soumitra)
Member
Joined: 5 years ago
Posts: 61
 

MOTOR driver for cytron 

 

https://github.com/CytronTechnologies/CytronMotorDriver


   
Spyder reacted
ReplyQuote
soumitra
(@soumitra)
Member
Joined: 5 years ago
Posts: 61
 

Finally 

The ros on rpi3 works with the ubiquity robot image 

ssh is working on it through the login of its own wifi.

This image is now reliable for those looking for ubuntu 16.04 with ROS kinetc.

Pasting below 

https://downloads.ubiquityrobotics.com/

 

To ssh from a laptop to rpi3 

1. Logon to rpi3 terminal

2. Command 

ssh ubuntu@ubiquityrobot.local

3. Yes , after command prompt

4.   Type pifi status

5. Pifi list can be seen and you can choose to be with the wifi generated by ubiquityrobot

6. Logon to laptop and ssh ubuntu@ip address you can see screen of rpi3 terminal from laptop now and run ros PACKAGE 

 

All the best

 


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

This seems relevant and on topic for DB1

http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup

rosarduino

   
ReplyQuote
Page 2 / 7