Jump to content


Change in driving servo's from ground


  • Please log in to reply
5 replies to this topic

#1 FredericG

FredericG

    Developer

  • Members
  • PipPipPip
  • 462 posts
  • LocationBelgium
  • Country: flag of Belgium Belgium


Posted 20 June 2011 - 07:27 PM

With the recent CC code, it seems I need to set ActuatorCommand and ManualControlCommand to readonly in order to get control.
Before only ActuatorCommand needed to be readonly.

def driveServo(self):
		print "Taking control of self.actuatorCmd"
		self.objMan.ActuatorCommand.metadata.access.value = UAVMetaDataObject.Access.READONLY
		self.objMan.ActuatorCommand.metadata.updated()   
		self.objMan.ManualControlCommand.metadata.access.value = UAVMetaDataObject.Access.READONLY <<<<<<<<===
		self.objMan.ManualControlCommand.metadata.updated() 	<<<<<<===
		
		while True:
			self.objMan.ActuatorCommand.Channel.value[0] = 1000
			self.objMan.ActuatorCommand.updated()
			time.sleep(1)
			
			self.objMan.ActuatorCommand.Channel.value[0] = 2000
			self.objMan.ActuatorCommand.updated()
			time.sleep(1)
Is this intentional?


Frederic

#2 peabody124

peabody124

    Crash Dummy

  • Administrators
  • 4095 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 20 June 2011 - 08:59 PM

No, it's not intentional.  However I think I know why.  Probably if the input module is in the error condition (no input detected) then there won't be any updates on ActuatorDesired so actuator.c goes into the error condition and doesn't process ActuatorDesired.

I'm not sure this is really a bad thing though since you normally wouldn't want to enable the outputs without a transmitter or gcs control.  However I can see the argument of adding a ActuatorCommandSet / ActuatorCommandGet in actuator.c:474 to fix this.

#3 FredericG

FredericG

    Developer

  • Members
  • PipPipPip
  • 462 posts
  • LocationBelgium
  • Country: flag of Belgium Belgium


Posted 21 June 2011 - 08:20 AM

I did not analyze the code so why this has changed.

For what I am doing, this does not need fixing, the workaround is very simple. One could however argue that this is a bug... when setting  ActuatorCommand to READONLY, it should just work IMHO.

Quote

However I can see the argument of adding a ActuatorCommandSet / ActuatorCommandGet in actuator.c:474 to fix this.
I would propose that we introduce a completely separate code-path for this feature so that all other (normal) code does not have any influence, at the beginning of the big while-loop, before the xQueueReceive.

Frederic

#4 peabody124

peabody124

    Crash Dummy

  • Administrators
  • 4095 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 21 June 2011 - 05:18 PM

I really don't like code before the failsafe check.  Ick ick.  Failsafe is most important.  I feel like that whole code needs a big of reorganization though looking at it.  There are enough control paths and things like that I don't think it's easy to be sure it's safe (I think it is, but the code could make it more obvious).

I'd also almost like to know the failsafe overrides even that readonly myself, but I agree it's a bug in the sense of not expected outcome.

#5 jes1111

jes1111

    Key Member

  • Members
  • PipPipPip
  • 712 posts
  • Country: flag of Portugal Portugal


Posted 27 June 2011 - 05:10 PM

View Postpeabody124, on 21 June 2011 - 05:18 PM, said:

I really don't like code before the failsafe check.  Ick ick.  Failsafe is most important.  I feel like that whole code needs a big of reorganization though looking at it.  There are enough control paths and things like that I don't think it's easy to be sure it's safe (I think it is, but the code could make it more obvious).

I'd also almost like to know the failsafe overrides even that readonly myself, but I agree it's a bug in the sense of not expected outcome.

I know it's the dullest part of programming, but Unit testing would confirm the safety, wouldn't it? :unsure:

#6 peabody124

peabody124

    Crash Dummy

  • Administrators
  • 4095 posts
  • LocationHouston, TX
  • Country: flag of United States United States


Posted 27 June 2011 - 05:37 PM

View Postjes1111, on 27 June 2011 - 05:10 PM, said:

I know it's the dullest part of programming, but Unit testing would confirm the safety, wouldn't it? :unsure:

This is more like defining the expected behavior, so your unit testing always tests for that.  Fred is working on a unit testing framework though.