mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-05-30 00:39:32 +00:00
Client: modify move_start function
This commit is contained in:
@@ -41,7 +41,7 @@ def get_id(filepath="animation.csv"):
|
||||
print("No animation id in file")
|
||||
return anim_id
|
||||
|
||||
def get_start_xy(filepath="animation.csv"):
|
||||
def get_start_xy(filepath="animation.csv", x_ratio=1, y_ratio=1):
|
||||
try:
|
||||
animation_file = open(filepath)
|
||||
except IOError:
|
||||
@@ -71,7 +71,7 @@ def get_start_xy(filepath="animation.csv"):
|
||||
frame_number, x, y, z, yaw, red, green, blue = row_0
|
||||
except:
|
||||
return float('nan'), float('nan')
|
||||
return float(x), float(y)
|
||||
return float(x)*x_ratio, float(y)*y_ratio
|
||||
|
||||
|
||||
def load_animation(filepath="animation.csv", x0=0, y0=0, z0=0, x_ratio=1, y_ratio=1, z_ratio=1):
|
||||
|
||||
@@ -21,7 +21,6 @@ from tf.transformations import quaternion_from_euler, euler_from_quaternion, qua
|
||||
import tf2_ros
|
||||
|
||||
static_bloadcaster = tf2_ros.StaticTransformBroadcaster()
|
||||
|
||||
# logging.basicConfig( # TODO all prints as logs
|
||||
# level=logging.DEBUG, # INFO
|
||||
# format="%(asctime)s [%(name)-7.7s] [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s",
|
||||
@@ -95,7 +94,7 @@ class CopterClient(client.Client):
|
||||
trans.child_frame_id = self.FRAME_ID
|
||||
static_bloadcaster.sendTransform(trans)
|
||||
start_subscriber()
|
||||
# print(check_state_topic())
|
||||
|
||||
super(CopterClient, self).start()
|
||||
|
||||
|
||||
@@ -331,19 +330,10 @@ def _command_test(*args, **kwargs):
|
||||
|
||||
@messaging.message_callback("move_start")
|
||||
def _command_move_start_to_current_position(*args, **kwargs):
|
||||
# Load animation
|
||||
frames = animation.load_animation(os.path.abspath("animation.csv"),
|
||||
x_start, y_start = animation.get_start_xy(os.path.abspath("animation.csv"),
|
||||
x_ratio=client.active_client.X_RATIO,
|
||||
y_ratio=client.active_client.Y_RATIO,
|
||||
z_ratio=client.active_client.Z_RATIO,
|
||||
)
|
||||
# Correct start and land frames in animation
|
||||
# corrected_frames, start_action, start_delay = animation.correct_animation(frames,
|
||||
# check_takeoff=client.active_client.TAKEOFF_CHECK,
|
||||
# check_land=client.active_client.LAND_CHECK,
|
||||
# )
|
||||
x_start = frames[0]['x']
|
||||
y_start = frames[0]['y']
|
||||
print("x_start = {}, y_start = {}".format(x_start, y_start))
|
||||
telem = FlightLib.get_telemetry(client.active_client.FRAME_ID)
|
||||
print("x_telem = {}, y_telem = {}".format(telem.x, telem.y))
|
||||
@@ -596,8 +586,6 @@ def _play_animation(*args, **kwargs):
|
||||
},
|
||||
)
|
||||
#print(task_manager.task_queue)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
copter_client = CopterClient()
|
||||
|
||||
Reference in New Issue
Block a user