New project: AR.Drone communication API in Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

Carolina Hernández
Hi Krish
Thanks for all your comments.

About the #initialize method, I think you are right, and some code refactoring would solve it.

Also, about the #takeOff method, maybe the comments are not so explicative, but it just sends the take off command until the drone is actually flying. In practice, it sends it twice and then stops. The logic for the land command is very similar. They are designed that way to ensure the drone will take off or land after only one call of the corresponding method. 

Thanks for your advice on avoiding Float and Integer overrides, it would be cleaner to include the methods in the ARDrone package.

Cheers
Caro

2016-04-09 13:56 GMT-03:00 S Krish <[hidden email]>:

Very interesting and well done.

Observations:  from a 15 min review. beyond the basics .. which really is well done. Hope I can play with it sometime when I get time.. 

Love the commandQueue and UDP handling and this block:

senderProcess := [[ | nextCommand |
"dequeue the next command, enumerate it and send it"
nextCommand := commandsQueue next .
arDrone commandAdapter send: nextCommand 
] repeat ] fork.

I like the comments in #sendMoveCommandLeftRightTilt: lrTilt frontBackTilt: fbTilt verticalSpeed: verticalSpeed angularSpeed: angularSpeed


But the #initialize method is doing too much in one long method.. check other methods too..


Comments: 

     takeOff
"Every 1 second sends the take off command to the drone, until it's state goes from Landed to Flying (ARDState flyMask from 0 to 1)"

               Either the naming can be keepFlying .. not sure if I want to takeOff every second.


Advice avoiding overrides on Integer and Float given its not really needed and you can do that in your own class in the package.

viz: #from32BitArrayWithOnesAt:





On Sat, Apr 9, 2016 at 8:24 AM, Carolina Hernández <[hidden email]> wrote:
Hi, my name is Carolina Hernandez and I'm a Computer Engineering student at the University of Chile.
As part of my final degree project, I'm creating a communication API for controlling the Parrot AR.Drone 2.0 from Pharo. I've just released an early version. The code is hosted in Smalltalkhub:

I also made a video of a test flight, where the AR.Drone is controlled using the API and keyboard:

I couldn't find any direct way to use a joystick in Pharo, if someone knows about one, I'd like to integrate it to my code.

Development and tests have been done in Pharo 4.0 and ubuntu 12.04
Comments are welcome!

Caro


Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

Carolina Hernández
In reply to this post by abergel
Hi Alex, 
I read your comment after I posted a response. I don't have so much experience to ROS, and none to PhaROS. 
But, are you saying that using Gazebo with the API would be somehow straight forward?

2016-04-10 12:15 GMT-03:00 Alexandre Bergel <[hidden email]>:
Hi Hernan,

Gazebo uses ROS somehow, so yes.

Alexandre


> On Apr 9, 2016, at 10:58 AM, Hernán Morales Durand <[hidden email]> wrote:
>
> Hi Carolina,
>
> Thank you for sharing.
> Do you plan to support gazebo or tum_simulator in your API?
>
> Hernán
>
> http://gazebosim.org/
> http://wiki.ros.org/tum_simulator
>
>
> 2016-04-09 10:24 GMT-03:00 Carolina Hernández <[hidden email]>:
> Hi, my name is Carolina Hernandez and I'm a Computer Engineering student at the University of Chile.
> As part of my final degree project, I'm creating a communication API for controlling the Parrot AR.Drone 2.0 from Pharo. I've just released an early version. The code is hosted in Smalltalkhub:
> http://smalltalkhub.com/#!/~CaroHernandez/ArDronePharo
>
> I also made a video of a test flight, where the AR.Drone is controlled using the API and keyboard:
> https://www.youtube.com/watch?v=d8rERiBoD0o
>
> I couldn't find any direct way to use a joystick in Pharo, if someone knows about one, I'd like to integrate it to my code.
>
> Development and tests have been done in Pharo 4.0 and ubuntu 12.04
> Comments are welcome!
>
> Caro
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

hernanmd
In reply to this post by Carolina Hernández
Thanks for the reply Carolina, Alex and Serge.

Cheers,

Hernán

2016-04-12 0:27 GMT-03:00 Carolina Hernández <[hidden email]>:
Hi Hernán, not for now, since my main goal is to make possible to program behaviors for the drone using the language LRP (Live Robot Programming). However, since I am using a spiral development method, I may consider it in a further stage. Thanks for the suggestion!

Caro

About LRP:

2016-04-09 10:58 GMT-03:00 Hernán Morales Durand <[hidden email]>:
Hi Carolina,

Thank you for sharing.
Do you plan to support gazebo or tum_simulator in your API?

Hernán

http://gazebosim.org/
http://wiki.ros.org/tum_simulator


2016-04-09 10:24 GMT-03:00 Carolina Hernández <[hidden email]>:
Hi, my name is Carolina Hernandez and I'm a Computer Engineering student at the University of Chile.
As part of my final degree project, I'm creating a communication API for controlling the Parrot AR.Drone 2.0 from Pharo. I've just released an early version. The code is hosted in Smalltalkhub:

I also made a video of a test flight, where the AR.Drone is controlled using the API and keyboard:

I couldn't find any direct way to use a joystick in Pharo, if someone knows about one, I'd like to integrate it to my code.

Development and tests have been done in Pharo 4.0 and ubuntu 12.04
Comments are welcome!

Caro



Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

Carolina Hernández
In reply to this post by stepharo
Hi Stef, 
All communications with the AR.Drone are done via exchage of UDP and TCP packages between the drone's firmware and the client. 
Packages are sent by a Wifi network, which is managed by the drone's firmware. In addition to this, the firmware automates the flight manouvers (take off, roll, pitch, hover etc.), sends a navigation data stream, and a video stream. The client can control the drone's movement and configuration by sending 'AT commands', whose structure is specified in the AR.Drone developer guide.

I'm now sure if I answered your question. If I didn't please let me know. 

Thanks for your interest




2016-04-09 15:12 GMT-03:00 stepharo <[hidden email]>:
Hi

Good work.
Can you tell us more what is the principle to communicate with the Parrot.

Stef

Le 9/4/16 15:24, Carolina Hernández a écrit :
Hi, my name is Carolina Hernandez and I'm a Computer Engineering student at the University of Chile.
As part of my final degree project, I'm creating a communication API for controlling the Parrot AR.Drone 2.0 from Pharo. I've just released an early version. The code is hosted in Smalltalkhub:
http://smalltalkhub.com/#!/~CaroHernandez/ArDronePharo <http://smalltalkhub.com/#%21/%7ECaroHernandez/ArDronePharo>

I also made a video of a test flight, where the AR.Drone is controlled using the API and keyboard:
https://www.youtube.com/watch?v=d8rERiBoD0o

I couldn't find any direct way to use a joystick in Pharo, if someone knows about one, I'd like to integrate it to my code.

Development and tests have been done in Pharo 4.0 and ubuntu 12.04
Comments are welcome!

Caro



Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

SergeStinckwich
In reply to this post by Carolina Hernández
Gazebo/PlayerStage define a common API to control robots. This API is also implement in the Gazebo simulation engine.
Please have a look to my PlayerST code.

Sent from my iPhone

On 12 avr. 2016, at 06:04, Carolina Hernández <[hidden email]> wrote:

Hi Alex, 
I read your comment after I posted a response. I don't have so much experience to ROS, and none to PhaROS. 
But, are you saying that using Gazebo with the API would be somehow straight forward?

2016-04-10 12:15 GMT-03:00 Alexandre Bergel <[hidden email]>:
Hi Hernan,

Gazebo uses ROS somehow, so yes.

Alexandre


> On Apr 9, 2016, at 10:58 AM, Hernán Morales Durand <[hidden email]> wrote:
>
> Hi Carolina,
>
> Thank you for sharing.
> Do you plan to support gazebo or tum_simulator in your API?
>
> Hernán
>
> http://gazebosim.org/
> http://wiki.ros.org/tum_simulator
>
>
> 2016-04-09 10:24 GMT-03:00 Carolina Hernández <[hidden email]>:
> Hi, my name is Carolina Hernandez and I'm a Computer Engineering student at the University of Chile.
> As part of my final degree project, I'm creating a communication API for controlling the Parrot AR.Drone 2.0 from Pharo. I've just released an early version. The code is hosted in Smalltalkhub:
> http://smalltalkhub.com/#!/~CaroHernandez/ArDronePharo
>
> I also made a video of a test flight, where the AR.Drone is controlled using the API and keyboard:
> https://www.youtube.com/watch?v=d8rERiBoD0o
>
> I couldn't find any direct way to use a joystick in Pharo, if someone knows about one, I'd like to integrate it to my code.
>
> Development and tests have been done in Pharo 4.0 and ubuntu 12.04
> Comments are welcome!
>
> Caro
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

Carolina Hernández
In reply to this post by Ronie Salgado
Hi Ronnie, that's is really nice!

I'm talking to you in private 

2016-04-10 7:05 GMT-03:00 Ronie Salgado <[hidden email]>:
Ok, I made a cleanup on the OSWindow joystick support. I also added the OSWindowGenericRenderer interface which is implemented by a thin wrapper around the SDL2 renderer interface. I have tested this on Linux using a XBox 360 controller (using SDL2 GameController interface) and a PS2 controller via an USB adapter (using SDL2 Joystick interface). Later I will test it on Windows and Mac.

=============================
Here is the demo: https://www.youtube.com/watch?v=lABfEmToHLQ&feature=youtu.be

OSWindowJoystickExample new open.

Xbox 360/mapped controls
Left stick: move character
X button: shoot
Start: reset

=============================

I also added a simple examples using the OSWindowGenericRenderer:

OSWindowGenericRendererDrawingExample new open.

=============================

I also modified the OSSDL2Driver >> #isSuitable method to not call the hasPlugin method. The plugin seems to be unnecessary according to several posts, and I am too lazy for fixing it. I guess that this should be eventually integrated into Pharo 5 after some reviewing. Before that, the latest version of OSWindow should be loaded manually. For that, the packages should be loaded in the following order:

OSWindow-Core
OSWindow-SDL2
OSWindow-SDL2-Examples

After that, the following doIt is required in a playground to start receiving events:

SDL2Constants initialize.
SDL_Event initialize

Best regards,
Ronie

2016-04-10 3:15 GMT-03:00 [hidden email] <[hidden email]>:
There is joystick support in 4.0, but not in Unix (plugin looks pretty empty).

Smalltalk vm listBuiltinModules select: [ :each | each beginsWith: 'Joystick' ].

JoystickTabletPlugin VMMaker-oscog-nice13154.314

So, it is all in the InputEventSensor

Check for senders of primReadJoystick:

--> joystickXY:, joystickButtons: ...

Phil


On Sun, Apr 10, 2016 at 1:18 AM, Stephan Eggermont <[hidden email]> wrote:
On 09-04-16 15:24, Carolina Hernández wrote:
I couldn't find any direct way to use a joystick in Pharo, if someone knows
about one, I'd like to integrate it to my code.
https://github.com/Geal/Squeak-VM/tree/master/platforms/Mac%20OS/plugins/JoystickTabletPlugin

Refers to a joystick plugin for squeak. I don't know if that is in the current distribution
(it doesn't seem to be), so you might ask on the vm-dev list about it. I haven't looked
at it, so it could be for a RS-232 based joystick instead of something more useful with
a modern pc.

Can't SDL2 be used with a joystick?

Stephan








Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

Carolina Hernández
In reply to this post by abergel
I did! Thanks a lot

2016-04-10 12:16 GMT-03:00 Alexandre Bergel <[hidden email]>:
This is really cool!

Ronie (from the DCC as well :-) has been working on a joystick support. Ronie will travel end of next week. So I suggest to talk to him very soon

Alexandre


> On Apr 9, 2016, at 10:24 AM, Carolina Hernández <[hidden email]> wrote:
>
> Hi, my name is Carolina Hernandez and I'm a Computer Engineering student at the University of Chile.
> As part of my final degree project, I'm creating a communication API for controlling the Parrot AR.Drone 2.0 from Pharo. I've just released an early version. The code is hosted in Smalltalkhub:
> http://smalltalkhub.com/#!/~CaroHernandez/ArDronePharo
>
> I also made a video of a test flight, where the AR.Drone is controlled using the API and keyboard:
> https://www.youtube.com/watch?v=d8rERiBoD0o
>
> I couldn't find any direct way to use a joystick in Pharo, if someone knows about one, I'd like to integrate it to my code.
>
> Development and tests have been done in Pharo 4.0 and ubuntu 12.04
> Comments are welcome!
>
> Caro

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

stepharo
In reply to this post by Ronie Salgado
Ronie

There is no configurationOfOSWindow? Because loading package one by one does not work and we have the solution.
A configuration. Then if you do not do it. Who will do it? Me without knowing what you did?

If you want that people review the code then it should be easy for them to review it.

Can you enter a bug entry?

Stef


Le 10/4/16 12:05, Ronie Salgado a écrit :
Ok, I made a cleanup on the OSWindow joystick support. I also added the OSWindowGenericRenderer interface which is implemented by a thin wrapper around the SDL2 renderer interface. I have tested this on Linux using a XBox 360 controller (using SDL2 GameController interface) and a PS2 controller via an USB adapter (using SDL2 Joystick interface). Later I will test it on Windows and Mac.

=============================
Here is the demo: https://www.youtube.com/watch?v=lABfEmToHLQ&feature=youtu.be

OSWindowJoystickExample new open.

Xbox 360/mapped controls
Left stick: move character
X button: shoot
Start: reset

=============================

I also added a simple examples using the OSWindowGenericRenderer:

OSWindowGenericRendererDrawingExample new open.

=============================

I also modified the OSSDL2Driver >> #isSuitable method to not call the hasPlugin method. The plugin seems to be unnecessary according to several posts, and I am too lazy for fixing it. I guess that this should be eventually integrated into Pharo 5 after some reviewing. Before that, the latest version of OSWindow should be loaded manually. For that, the packages should be loaded in the following order:

OSWindow-Core
OSWindow-SDL2
OSWindow-SDL2-Examples

After that, the following doIt is required in a playground to start receiving events:

SDL2Constants initialize.
SDL_Event initialize

Best regards,
Ronie

2016-04-10 3:15 GMT-03:00 [hidden email] <[hidden email]>:
There is joystick support in 4.0, but not in Unix (plugin looks pretty empty).

Smalltalk vm listBuiltinModules select: [ :each | each beginsWith: 'Joystick' ].

JoystickTabletPlugin VMMaker-oscog-nice13154.314

So, it is all in the InputEventSensor

Check for senders of primReadJoystick:

--> joystickXY:, joystickButtons: ...

Phil


On Sun, Apr 10, 2016 at 1:18 AM, Stephan Eggermont <[hidden email]> wrote:
On 09-04-16 15:24, Carolina Hernández wrote:
I couldn't find any direct way to use a joystick in Pharo, if someone knows
about one, I'd like to integrate it to my code.
https://github.com/Geal/Squeak-VM/tree/master/platforms/Mac%20OS/plugins/JoystickTabletPlugin

Refers to a joystick plugin for squeak. I don't know if that is in the current distribution
(it doesn't seem to be), so you might ask on the vm-dev list about it. I haven't looked
at it, so it could be for a RS-232 based joystick instead of something more useful with
a modern pc.

Can't SDL2 be used with a joystick?

Stephan








Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

jfabry
In reply to this post by Carolina Hernández
Hola Hernan,

Carolina is doing cool work, which is why I pushed her to make this announcement and video :-) 

I first want to get LRP working with the drone (more on LRP also on http://pleiad.cl/LRP ). The philosophy of LRP is to do as much as possible on real hardware for a fast development cycle, so simulation of the drone is a very low priority right now.

Carolina told me there are more features inside the drone, for augmented reality stuff if I remember correctly. So we will first investigate that to see if we can get more features inside LRP, because that sounds really cool.

On Apr 12, 2016, at 00:27, Carolina Hernández <[hidden email]> wrote:

Hi Hernán, not for now, since my main goal is to make possible to program behaviors for the drone using the language LRP (Live Robot Programming). However, since I am using a spiral development method, I may consider it in a further stage. Thanks for the suggestion!

Caro

About LRP:

2016-04-09 10:58 GMT-03:00 Hernán Morales Durand <[hidden email]>:
Hi Carolina,

Thank you for sharing.
Do you plan to support gazebo or tum_simulator in your API?

Hernán

http://gazebosim.org/
http://wiki.ros.org/tum_simulator


2016-04-09 10:24 GMT-03:00 Carolina Hernández <[hidden email]>:
Hi, my name is Carolina Hernandez and I'm a Computer Engineering student at the University of Chile.
As part of my final degree project, I'm creating a communication API for controlling the Parrot AR.Drone 2.0 from Pharo. I've just released an early version. The code is hosted in Smalltalkhub:

I also made a video of a test flight, where the AR.Drone is controlled using the API and keyboard:

I couldn't find any direct way to use a joystick in Pharo, if someone knows about one, I'd like to integrate it to my code.

Development and tests have been done in Pharo 4.0 and ubuntu 12.04
Comments are welcome!

Caro





---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

jfabry
In reply to this post by Carolina Hernández

On Apr 12, 2016, at 00:52, Carolina Hernández <[hidden email]> wrote:

Hi Krish
Thanks for all your comments.

I agree with Krish that the code is well done, plus the documentation is very complete, I like that a lot!

About the #initialize method, I think you are right, and some code refactoring would solve it.

Yes, I would move both block definitions to their separate methods, that should make the code more readable. 

Also, about the #takeOff method, maybe the comments are not so explicative, but it just sends the take off command until the drone is actually flying. In practice, it sends it twice and then stops. The logic for the land command is very similar. They are designed that way to ensure the drone will take off or land after only one call of the corresponding method. 

For me at least the comment in takeOff is clear.

Thanks for your advice on avoiding Float and Integer overrides, it would be cleaner to include the methods in the ARDrone package.

Indeed, I think it would be better to have these on ARDCommandManager, as it is the only place they are used and furthermore don’t rely on private state of Float or Integer.

---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

Reply | Threaded
Open this post in threaded view
|

Re: New project: AR.Drone communication API in Pharo

jfabry
In reply to this post by Carolina Hernández

I forgot to ask, will this work with a PS2 joystick? We have one available in the robotics lab that we can use for that.

On Apr 12, 2016, at 02:41, Carolina Hernández <[hidden email]> wrote:

Hi Ronnie, that's is really nice!

I'm talking to you in private 

2016-04-10 7:05 GMT-03:00 Ronie Salgado <[hidden email]>:
Ok, I made a cleanup on the OSWindow joystick support. I also added the OSWindowGenericRenderer interface which is implemented by a thin wrapper around the SDL2 renderer interface. I have tested this on Linux using a XBox 360 controller (using SDL2 GameController interface) and a PS2 controller via an USB adapter (using SDL2 Joystick interface). Later I will test it on Windows and Mac.

=============================
Here is the demo: https://www.youtube.com/watch?v=lABfEmToHLQ&feature=youtu.be

OSWindowJoystickExample new open.

Xbox 360/mapped controls
Left stick: move character
X button: shoot
Start: reset

=============================

I also added a simple examples using the OSWindowGenericRenderer:

OSWindowGenericRendererDrawingExample new open.

=============================

I also modified the OSSDL2Driver >> #isSuitable method to not call the hasPlugin method. The plugin seems to be unnecessary according to several posts, and I am too lazy for fixing it. I guess that this should be eventually integrated into Pharo 5 after some reviewing. Before that, the latest version of OSWindow should be loaded manually. For that, the packages should be loaded in the following order:

OSWindow-Core
OSWindow-SDL2
OSWindow-SDL2-Examples

After that, the following doIt is required in a playground to start receiving events:

SDL2Constants initialize.
SDL_Event initialize

Best regards,
Ronie

2016-04-10 3:15 GMT-03:00 [hidden email] <[hidden email]>:
There is joystick support in 4.0, but not in Unix (plugin looks pretty empty).

Smalltalk vm listBuiltinModules select: [ :each | each beginsWith: 'Joystick' ].

JoystickTabletPlugin VMMaker-oscog-nice13154.314

So, it is all in the InputEventSensor

Check for senders of primReadJoystick:

--> joystickXY:, joystickButtons: ...

Phil


On Sun, Apr 10, 2016 at 1:18 AM, Stephan Eggermont <[hidden email]> wrote:
On 09-04-16 15:24, Carolina Hernández wrote:
I couldn't find any direct way to use a joystick in Pharo, if someone knows
about one, I'd like to integrate it to my code.
https://github.com/Geal/Squeak-VM/tree/master/platforms/Mac%20OS/plugins/JoystickTabletPlugin

Refers to a joystick plugin for squeak. I don't know if that is in the current distribution
(it doesn't seem to be), so you might ask on the vm-dev list about it. I haven't looked
at it, so it could be for a RS-232 based joystick instead of something more useful with
a modern pc.

Can't SDL2 be used with a joystick?

Stephan











---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

12