delete(task_3): remove main-ori.py and robot_control_cmd_lcmt copy.py files
- Deleted main-ori.py as it is no longer needed for the project. - Removed robot_control_cmd_lcmt copy.py to clean up unused LCM type definitions and streamline the codebase.
This commit is contained in:
parent
2e71879c25
commit
82bb1056b3
4981
Gait_Params_up_full.toml
Normal file
4981
Gait_Params_up_full.toml
Normal file
File diff suppressed because it is too large
Load Diff
@ -27,13 +27,13 @@ robot_cmd = {
|
||||
'value':0, 'duration':0
|
||||
}
|
||||
|
||||
def main():
|
||||
def task_3_main(file_dir=""):
|
||||
lcm_cmd = lcm.LCM("udpm://239.255.76.67:7671?ttl=255")
|
||||
lcm_usergait = lcm.LCM("udpm://239.255.76.67:7671?ttl=255")
|
||||
usergait_msg = file_send_lcmt()
|
||||
cmd_msg = robot_control_cmd_lcmt()
|
||||
try:
|
||||
steps = toml.load("Gait_Params_up.toml")
|
||||
steps = toml.load(f"{file_dir}/Gait_Params_up.toml")
|
||||
full_steps = {'step':[robot_cmd]}
|
||||
k =0
|
||||
for i in steps['step']:
|
||||
@ -60,13 +60,13 @@ def main():
|
||||
else:
|
||||
full_steps['step'].append(cmd)
|
||||
k=k+1
|
||||
f = open("Gait_Params_up_full.toml", 'w')
|
||||
f = open(f"{file_dir}/Gait_Params_up_full.toml", 'w')
|
||||
f.write("# Gait Params\n")
|
||||
f.writelines(toml.dumps(full_steps))
|
||||
f.close()
|
||||
|
||||
file_obj_gait_def = open("Gait_Def_up.toml",'r')
|
||||
file_obj_gait_params = open("Gait_Params_up_full.toml",'r')
|
||||
file_obj_gait_def = open(f"{file_dir}/Gait_Def_up.toml",'r')
|
||||
file_obj_gait_params = open(f"{file_dir}/Gait_Params_up_full.toml",'r')
|
||||
usergait_msg.data = file_obj_gait_def.read()
|
||||
lcm_usergait.publish("user_gait_file",usergait_msg.encode())
|
||||
time.sleep(0.5)
|
||||
@ -76,7 +76,7 @@ def main():
|
||||
file_obj_gait_def.close()
|
||||
file_obj_gait_params.close()
|
||||
|
||||
user_gait_list = open("Usergait_List.toml",'r')
|
||||
user_gait_list = open(f"{file_dir}/Usergait_List.toml",'r')
|
||||
steps = toml.load(user_gait_list)
|
||||
for step in steps['step']:
|
||||
cmd_msg.mode = step['mode']
|
||||
@ -110,4 +110,4 @@ def main():
|
||||
sys.exit()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
task_3_main()
|
@ -1,149 +0,0 @@
|
||||
# LCM type definitions This file automatically generated by lcm.
|
||||
try:
|
||||
import cStringIO.StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
import struct
|
||||
|
||||
class robot_control_cmd_lcmt(object):
|
||||
__slots__ = ["mode", "gait_id", "contact", "life_count", "vel_des", "rpy_des", "pos_des", "acc_des", "ctrl_point", "foot_pose", "step_height", "value", "duration"]
|
||||
|
||||
__typenames__ = ["int8_t", "int8_t", "int8_t", "int8_t", "float", "float", "float", "float", "float", "float", "float", "int32_t", "int32_t"]
|
||||
|
||||
__dimensions__ = [None, None, None, None, [3], [3], [3], [6], [3], [6], [2], None, None]
|
||||
|
||||
def __init__(self):
|
||||
self.mode = 0
|
||||
self.gait_id = 0
|
||||
self.contact = 0
|
||||
self.life_count = 0
|
||||
self.vel_des = [ 0.0 for dim0 in range(3) ]
|
||||
self.rpy_des = [ 0.0 for dim0 in range(3) ]
|
||||
self.pos_des = [ 0.0 for dim0 in range(3) ]
|
||||
self.acc_des = [ 0.0 for dim0 in range(6) ]
|
||||
self.ctrl_point = [ 0.0 for dim0 in range(3) ]
|
||||
self.foot_pose = [ 0.0 for dim0 in range(6) ]
|
||||
self.step_height = [ 0.0 for dim0 in range(2) ]
|
||||
self.value = 0
|
||||
self.duration = 0
|
||||
|
||||
def encode(self):
|
||||
buf = BytesIO()
|
||||
buf.write(robot_control_cmd_lcmt._get_packed_fingerprint())
|
||||
self._encode_one(buf)
|
||||
return buf.getvalue()
|
||||
|
||||
def _encode_one(self, buf):
|
||||
buf.write(struct.pack(">bbbb", self.mode, self.gait_id, self.contact, self.life_count))
|
||||
buf.write(struct.pack('>3f', *self.vel_des[:3]))
|
||||
buf.write(struct.pack('>3f', *self.rpy_des[:3]))
|
||||
buf.write(struct.pack('>3f', *self.pos_des[:3]))
|
||||
buf.write(struct.pack('>6f', *self.acc_des[:6]))
|
||||
buf.write(struct.pack('>3f', *self.ctrl_point[:3]))
|
||||
buf.write(struct.pack('>6f', *self.foot_pose[:6]))
|
||||
buf.write(struct.pack('>2f', *self.step_height[:2]))
|
||||
buf.write(struct.pack(">ii", self.value, self.duration))
|
||||
|
||||
def decode(data):
|
||||
if hasattr(data, 'read'):
|
||||
buf = data
|
||||
else:
|
||||
buf = BytesIO(data)
|
||||
if buf.read(8) != robot_control_cmd_lcmt._get_packed_fingerprint():
|
||||
raise ValueError("Decode error")
|
||||
return robot_control_cmd_lcmt._decode_one(buf)
|
||||
decode = staticmethod(decode)
|
||||
|
||||
def _decode_one(buf):
|
||||
self = robot_control_cmd_lcmt()
|
||||
self.mode, self.gait_id, self.contact, self.life_count = struct.unpack(">bbbb", buf.read(4))
|
||||
self.vel_des = struct.unpack('>3f', buf.read(12))
|
||||
self.rpy_des = struct.unpack('>3f', buf.read(12))
|
||||
self.pos_des = struct.unpack('>3f', buf.read(12))
|
||||
self.acc_des = struct.unpack('>6f', buf.read(24))
|
||||
self.ctrl_point = struct.unpack('>3f', buf.read(12))
|
||||
self.foot_pose = struct.unpack('>6f', buf.read(24))
|
||||
self.step_height = struct.unpack('>2f', buf.read(8))
|
||||
self.value, self.duration = struct.unpack(">ii", buf.read(8))
|
||||
return self
|
||||
_decode_one = staticmethod(_decode_one)
|
||||
|
||||
def _get_hash_recursive(parents):
|
||||
if robot_control_cmd_lcmt in parents: return 0
|
||||
tmphash = (0x476b61e296af96f5) & 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 robot_control_cmd_lcmt._packed_fingerprint is None:
|
||||
robot_control_cmd_lcmt._packed_fingerprint = struct.pack(">Q", robot_control_cmd_lcmt._get_hash_recursive([]))
|
||||
return robot_control_cmd_lcmt._packed_fingerprint
|
||||
_get_packed_fingerprint = staticmethod(_get_packed_fingerprint)
|
||||
|
||||
def get_hash(self):
|
||||
"""Get the LCM hash of the struct"""
|
||||
return struct.unpack(">Q", robot_control_cmd_lcmt._get_packed_fingerprint())[0]
|
||||
|
||||
class robot_control_response_lcmt(object):
|
||||
__slots__ = ["mode", "gait_id", "contact", "order_process_bar", "switch_status", "ori_error", "footpos_error", "motor_error"]
|
||||
|
||||
__typenames__ = ["int8_t", "int8_t", "int8_t", "int8_t", "int8_t", "int8_t", "int16_t", "int32_t"]
|
||||
|
||||
__dimensions__ = [None, None, None, None, None, None, None, [12]]
|
||||
|
||||
def __init__(self):
|
||||
self.mode = 0
|
||||
self.gait_id = 0
|
||||
self.contact = 0
|
||||
self.order_process_bar = 0
|
||||
self.switch_status = 0
|
||||
self.ori_error = 0
|
||||
self.footpos_error = 0
|
||||
self.motor_error = [ 0 for dim0 in range(12) ]
|
||||
|
||||
def encode(self):
|
||||
buf = BytesIO()
|
||||
buf.write(robot_control_response_lcmt._get_packed_fingerprint())
|
||||
self._encode_one(buf)
|
||||
return buf.getvalue()
|
||||
|
||||
def _encode_one(self, buf):
|
||||
buf.write(struct.pack(">bbbbbbh", self.mode, self.gait_id, self.contact, self.order_process_bar, self.switch_status, self.ori_error, self.footpos_error))
|
||||
buf.write(struct.pack('>12i', *self.motor_error[:12]))
|
||||
|
||||
def decode(data):
|
||||
if hasattr(data, 'read'):
|
||||
buf = data
|
||||
else:
|
||||
buf = BytesIO(data)
|
||||
if buf.read(8) != robot_control_response_lcmt._get_packed_fingerprint():
|
||||
raise ValueError("Decode error")
|
||||
return robot_control_response_lcmt._decode_one(buf)
|
||||
decode = staticmethod(decode)
|
||||
|
||||
def _decode_one(buf):
|
||||
self = robot_control_response_lcmt()
|
||||
self.mode, self.gait_id, self.contact, self.order_process_bar, self.switch_status, self.ori_error, self.footpos_error = struct.unpack(">bbbbbbh", buf.read(8))
|
||||
self.motor_error = struct.unpack('>12i', buf.read(48))
|
||||
return self
|
||||
_decode_one = staticmethod(_decode_one)
|
||||
|
||||
def _get_hash_recursive(parents):
|
||||
if robot_control_response_lcmt in parents: return 0
|
||||
tmphash = (0x485da98216eda8c7) & 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 robot_control_response_lcmt._packed_fingerprint is None:
|
||||
robot_control_response_lcmt._packed_fingerprint = struct.pack(">Q", robot_control_response_lcmt._get_hash_recursive([]))
|
||||
return robot_control_response_lcmt._packed_fingerprint
|
||||
_get_packed_fingerprint = staticmethod(_get_packed_fingerprint)
|
||||
|
||||
def get_hash(self):
|
||||
"""Get the LCM hash of the struct"""
|
||||
return struct.unpack(">Q", robot_control_response_lcmt._get_packed_fingerprint())[0]
|
Loading…
x
Reference in New Issue
Block a user