Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcc47c3
commit 037c79a
Showing
7 changed files
with
97 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
"""LCM type definitions | ||
This file automatically generated by lcm. | ||
DO NOT MODIFY BY HAND!!!! | ||
""" | ||
|
||
try: | ||
import cStringIO.StringIO as BytesIO | ||
except ImportError: | ||
from io import BytesIO | ||
import struct | ||
|
||
class crazyflie_positioninput_t(object): | ||
__slots__ = ["timestamp", "input"] | ||
|
||
def __init__(self): | ||
self.timestamp = 0 | ||
self.input = [ 0.0 for dim0 in range(7) ] | ||
|
||
def encode(self): | ||
buf = BytesIO() | ||
buf.write(crazyflie_positioninput_t._get_packed_fingerprint()) | ||
self._encode_one(buf) | ||
return buf.getvalue() | ||
|
||
def _encode_one(self, buf): | ||
buf.write(struct.pack(">q", self.timestamp)) | ||
buf.write(struct.pack('>7d', *self.input[:7])) | ||
|
||
def decode(data): | ||
if hasattr(data, 'read'): | ||
buf = data | ||
else: | ||
buf = BytesIO(data) | ||
if buf.read(8) != crazyflie_positioninput_t._get_packed_fingerprint(): | ||
raise ValueError("Decode error") | ||
return crazyflie_positioninput_t._decode_one(buf) | ||
decode = staticmethod(decode) | ||
|
||
def _decode_one(buf): | ||
self = crazyflie_positioninput_t() | ||
self.timestamp = struct.unpack(">q", buf.read(8))[0] | ||
self.input = struct.unpack('>7d', buf.read(56)) | ||
return self | ||
_decode_one = staticmethod(_decode_one) | ||
|
||
_hash = None | ||
def _get_hash_recursive(parents): | ||
if crazyflie_positioninput_t in parents: return 0 | ||
tmphash = (0x3fafe4f164026262) & 0xffffffffffffffff | ||
tmphash = (((tmphash<<1)&0xffffffffffffffff) + (tmphash>>63)) & 0xffffffffffffffff | ||
return tmphash | ||
_get_hash_recursive = staticmethod(_get_hash_recursive) | ||
_packed_fingerprint = None | ||
|
||
def _get_packed_fingerprint(): | ||
if crazyflie_positioninput_t._packed_fingerprint is None: | ||
crazyflie_positioninput_t._packed_fingerprint = struct.pack(">Q", crazyflie_positioninput_t._get_hash_recursive([])) | ||
return crazyflie_positioninput_t._packed_fingerprint | ||
_get_packed_fingerprint = staticmethod(_get_packed_fingerprint) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
clear cf; | ||
cf = Crazyflie(); | ||
ctvlqr = cf.getTvlqr(xtraj,utraj,false); | ||
%ctvlqr = cf.getTvlqr(xtraj,utraj,false); | ||
ctvlqr = cf.getPositionControlTvlqr(xtraj,utraj); | ||
cf.runController(ctvlqr); |