Dawn Robotics Forum Support and community forums for Dawn Robotics Ltd 2015-11-17T20:08:47+01:00 http://forum.dawnrobotics.co.uk/feed.php?f=10 2015-11-17T20:08:47+01:00 2015-11-17T20:08:47+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1404&p=2000#p2000 <![CDATA[Software • Dawn Robotics Closing Down - Support Implications]]>
Some people may already know this based on this blog post, and the fact that we're running a closing down sale, but if not, unfortunately we're closing down, and indeed may already be closed, depending upon when you read this.

For people who have bought our products, please don't worry that you're going to be hung out to dry, support wise. I'll keep monitoring these forums periodically to try to answer any questions people may have. If you post here and don't get a reponse within a couple of days, please email helpdesk@dawnrobotics.co.uk, as notifications from the forum don't always seem to come through. Also please send me an email if parts you've bought recently, break or are faulty in some way, as I've held back some components to deal with this.

Many thanks to all of Dawn Robotics' customers over the last couple of years. It's been fun. :)

Regards

Alan

Statistics: Posted by Alan — Tue Nov 17, 2015 8:08 pm


]]>
2015-11-17T19:54:39+01:00 2015-11-17T19:54:39+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1275&p=1999#p1999 <![CDATA[Software • Re: Explanation of the code]]>
Is this a different sensor beyond the claw you mention here?

If so, then if you're just passivley reading the sensor then you may be able to get away with the sensor reading approach shown in this tutorial. To actively control a sensor, the approach I outline in your other post should hopefully get you started. :)

Regards

Alan

Statistics: Posted by Alan — Tue Nov 17, 2015 7:54 pm


]]>
2015-11-17T19:50:24+01:00 2015-11-17T19:50:24+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1403&p=1998#p1998 <![CDATA[Software • Re: Raspberry Pi Camera Robot Modification]]>
Welcome to the forums. :)

You will probably need to modify a number of files to get this working, but there are a couple of different approaches which will affect that precise number needed.

First off, do you think that perhaps you could get away with disabling one of the neck servos and using the connector for the claw servo instead? The pan servo for example (you can always turn the robot if you want to look left or right). If you were ok to do this then you could get away with just modifying the web interface.

Anyway, the first file to modify would be the web interface index.html. If you're changing the function of the pan servo then I'd suggest providing seperate sliders for the tilt servo, and the claw (pan) servo and using the command

socket.send( "SetNeckAngles " + clawAngle + " " + tiltAngle );

whenever one changes.

Otherwise, if you're adding an extra servo, you'd need to define an extra command, something like SetClawAngle and use it like this

socket.send( "SetClawAngle " + clawAngle );

Moving onto the Python code, you'd first need to modify robot_web_server.py to handle the SetClawAngle command. See line 184 for how the SetNeckAngle command is handled.

At this point, you're faced with a choice. If you can attach the signal line of the servo motor to one of the Pi GPIO pins, you can write Python code in robot_web_server.py to set the claw angle, using code similar to that given in this tutorial.

If on the otherhand you'd like to attach the servo to the mini driver, you still have a way to go... Basically you'd need to follow the path of a command like robot.setNeckAngles( panAngle, tiltAngle ) (line 200 of robot_web_server.py) into robot_controller.py, then into mini_driver.py before the angle is sent over USB to the mini_driver_firmware.ino sketch, at this point you'd need to receive the angle and modify the update loop of the sketch to output the claw angle.

So hopefully that gives you some ideas on how you can approach this. My advice would be to try the simple method of co-opting the pan servo first and then maybe move onto one of the more involved approaches if you want a bit more control. If there's any further information you need, please let me know.

Regards

Alan

Statistics: Posted by Alan — Tue Nov 17, 2015 7:50 pm


]]>
2015-11-16T17:00:03+01:00 2015-11-16T17:00:03+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1275&p=1995#p1995 <![CDATA[Software • Re: Explanation of the code]]> What files would i need to look at to add control of a further sensor via the web streamer...?

Statistics: Posted by adamrobots — Mon Nov 16, 2015 5:00 pm


]]>
2015-11-16T16:55:44+01:00 2015-11-16T16:55:44+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1403&p=1994#p1994 <![CDATA[Software • Raspberry Pi Camera Robot Modification]]>
Many thanks
adamrobots :mrgreen:

Statistics: Posted by adamrobots — Mon Nov 16, 2015 4:55 pm


]]>
2015-05-20T11:09:19+01:00 2015-05-20T11:09:19+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1365&p=1796#p1796 <![CDATA[Software • Re: get_sensor_readings]]>

Thanks for the vote!

Regards

Alan

Statistics: Posted by Alan — Wed May 20, 2015 11:09 am


]]>
2015-05-18T23:24:17+01:00 2015-05-18T23:24:17+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1365&p=1795#p1795 <![CDATA[Software • Re: get_sensor_readings]]>
I've cast the vote, good luck!

Statistics: Posted by Puma — Mon May 18, 2015 11:24 pm


]]>
2015-05-15T12:47:15+01:00 2015-05-15T12:47:15+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1365&p=1792#p1792 <![CDATA[Software • Re: get_sensor_readings]]>
Sorry about the mistake in my code. That's what comes of trying to write code without having a physical system to hand. ;)

As a bit of explanation, my mistake arose because on the Python code that is running on the robot, the sensor reading object does have a member called 'data'. However, when it's transferred over the network, all of the sensor readings are converted to a string in a format called JSON. Then when it gets to the py_websockets_bot library (i.e. your script), the JSON string is converted into a Python dictionary so that you can easily access the values.

Hope that makes a bit of sense. One thing you can do when learning about Python and dictionaries is to print them out, as this can make their structure a lot easier to understand. So for example try

Code:
print sensor_dict


Also, one thing I found very useful when learning Python was just to open up the interpreter by running 'python' on the command line and typing stuff in based on the documentation and the excellent official tutorial. I found Python quite a fun language to learn. :)

On a completely separate note, could I be cheeky and ask for you to vote for us in this competition. Basically it's a chance to win £20,000 in funding which we're hoping to use to create freely available educational materials for schools giving lesson plans for the Raspberry Pi robot (although it should also be applicable to other Raspberry Pi robots as well). We need to reach 250 votes to make it to the next round, so any help is much appreciated.

Regards

Alan

Statistics: Posted by Alan — Fri May 15, 2015 12:47 pm


]]>
2015-05-14T08:28:09+01:00 2015-05-14T08:28:09+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1365&p=1791#p1791 <![CDATA[Software • Re: get_sensor_readings]]>
ain0 = sensor_dict["analog"]["data"][0]

ain1 = sensor_dict["analog"]["data"][1]


ain2 =

Don't ask me why it works, I'm still trying to figure Python out, but it definitely works.

Entire script looks like this currently, this of course is just for testing purposes, only function is to read the analogue inputs, additions will be made later to control the motors, the signals I'm reading are coming from a pair of infrared distance measuring devices that use triangulation, this means type of reflected surface has little affect on the measurement.
Code:
#! /usr/bin/python

# This example shows how to configure, and read from, the robot's sensors
import os
import sys
import time
import argparse
import py_websockets_bot
import py_websockets_bot.mini_driver
import py_websockets_bot.robot_config
   
#---------------------------------------------------------------------------------------------------       
if __name__ == "__main__":

    # Set up a parser for command line arguments
    parser = argparse.ArgumentParser( "Gets sensor readings from the robot and displays them" )
    parser.add_argument( "hostname", default="localhost", nargs='?', help="The ip address of the robot" )

    args = parser.parse_args()
 
    # Connect to the robot
    bot = py_websockets_bot.WebsocketsBot( args.hostname )

    # Estimate the offset between our system clock, and the robot's system clock. You only need
    # to do this if you're interested in the age of the sensor readings. If you're not interested
    # then you can leave it out of your own programs
    #print "Estimating robot time offset (this will take about 10 seconds)..."
    #robot_time_offset = bot.estimate_robot_time_offset()
   
    # Configure the sensors on the robot
    sensorConfiguration = py_websockets_bot.mini_driver.SensorConfiguration(
        configD12=py_websockets_bot.mini_driver.PIN_FUNC_ULTRASONIC_READ,
        configD13=py_websockets_bot.mini_driver.PIN_FUNC_DIGITAL_READ,
        configA0=py_websockets_bot.mini_driver.PIN_FUNC_ANALOG_READ,
        configA1=py_websockets_bot.mini_driver.PIN_FUNC_ANALOG_READ,
        configA2=py_websockets_bot.mini_driver.PIN_FUNC_ANALOG_READ,
        configA3=py_websockets_bot.mini_driver.PIN_FUNC_DIGITAL_READ,
        configA4=py_websockets_bot.mini_driver.PIN_FUNC_ANALOG_READ,
        configA5=py_websockets_bot.mini_driver.PIN_FUNC_ANALOG_READ,
        leftEncoderType=py_websockets_bot.mini_driver.ENCODER_TYPE_QUADRATURE,
        rightEncoderType=py_websockets_bot.mini_driver.ENCODER_TYPE_QUADRATURE )
   
    # We set the sensor configuration by getting the current robot configuration and modifying it.
    # In this way we don't trample on any other configuration settings
    robot_config = bot.get_robot_config()
    robot_config.miniDriverSensorConfiguration = sensorConfiguration
   
    bot.set_robot_config( robot_config )
   
    # Run in a loop until the user presses Ctrl+C to quit
while True:
   try:
   
       
      bot.update()

            # The sensor readings are returned as part of the status of the robot
      status_dict, read_time = bot.get_robot_status_dict()
           

               
               
      sensor_dict = status_dict[ "sensors" ]
 
                   
      #data = sensor_dict[ sensor_name ][ "data" ]
         
      ain0 = int(sensor_dict["analog"]["data"][0])

      ain1 = int(sensor_dict["analog"]["data"][1])
                   
         
                   
                    # Print out information about the reading
                    #print sensor_name, ":"
      print ain0
      print ain1
                   
            #print "\r"
           
      time.sleep( 0.040 )
      os.system("clear")

   
   except KeyboardInterrupt:
      bot.disconnect()
      print "\r"
      print "Program terminated.\r"
      sys.exit()    # Catch Ctrl+C

Statistics: Posted by Puma — Thu May 14, 2015 8:28 am


]]>
2015-05-14T01:32:54+01:00 2015-05-14T01:32:54+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1365&p=1790#p1790 <![CDATA[Software • Re: get_sensor_readings]]>
data = sensor_dict[ sensor_name ][ "data" ]
ain0=sensor_dict["analog"].data[0]
ain1=sensor_dict["analog"].data[1]

The error reads as follows...

File "get_sensor_readings.py", line 81, in <module>
ain0=sensor_dict["analog"].data[0]
AttributeError: 'dict' object has no attribute 'data'

Statistics: Posted by Puma — Thu May 14, 2015 1:32 am


]]>
2015-05-14T01:08:10+01:00 2015-05-14T01:08:10+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1365&p=1789#p1789 <![CDATA[Software • Re: get_sensor_readings]]>
I think that the code you want looks something like this

A0 = sensor_dict[ "analog" ].data[ 0 ]
A1 = sensor_dict[ "analog" ].data[ 1 ]

(although I can't check it right now as I'm at home). This should work because the sensor dictionary contains an entry called analog for the analog readings. All sensor readings are returned as an object which contains a data field and a timestamp field (indicating when it was read). The data field for the analog pins should be an array of 6 numbers with values in the range 0 to 1023 (I hope) where 1023 corresponds to 5V and 0 corresponds to 0V.

Hope that helps.

Regards

Alan

Statistics: Posted by Alan — Thu May 14, 2015 1:08 am


]]>
2015-05-13T23:40:03+01:00 2015-05-13T23:40:03+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1365&p=1788#p1788 <![CDATA[Software • get_sensor_readings]]>
My understanding of Python is still pretty bad, what I would like to do is get each value independently as numeric values, example I'd like to read A0 and A1, but I don't know how to extract them as numerals from "data"; any help would be appreciated, thanks in advance.

Statistics: Posted by Puma — Wed May 13, 2015 11:40 pm


]]>
2015-04-16T21:35:02+01:00 2015-04-16T21:35:02+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1350&p=1733#p1733 <![CDATA[Software • Re: Accessing the OS via galaxy tab 10.1?]]> Statistics: Posted by Puma — Thu Apr 16, 2015 9:35 pm


]]>
2015-04-16T19:46:49+01:00 2015-04-16T19:46:49+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1350&p=1731#p1731 <![CDATA[Software • Re: Accessing the OS via galaxy tab 10.1?]]>
There are a number of Android SSH apps that might serve which you can find in thep lay store. JuiceSSH is the one I've used (although not extensively).

Hope that helps.

Regards

Alan

Statistics: Posted by Alan — Thu Apr 16, 2015 7:46 pm


]]>
2015-04-16T01:20:56+01:00 2015-04-16T01:20:56+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1350&p=1729#p1729 <![CDATA[Software • Accessing the OS via galaxy tab 10.1?]]> Statistics: Posted by Puma — Thu Apr 16, 2015 1:20 am


]]>