How do I get my animation to play inside OnCollisionEnter() function

I’m making a game where the character is continuously jumping up and down. I use OnCollisionEnter() to make him jump every time he hits the ground. I am trying to invoke an animation that make the characters arms wiggle inside the function as well, like this:

void OnCollisionEnter(Collision collision){

	foreach(ContactPoint contact in collision.contacts){
		rigidbody.velocity = transform.up*10;
		audio.Play();
		animation.Play ("JumpAnimation");
	}
}

When I run the game I get the following error:

MissingComponentException: There is no ‘Animation’ attached to the “Green Bot” game object, but a script is trying to access it.
You probably need to add a Animation to the game object “Green Bot”. Or your script needs to check if the component is attached before using it.

I have an animator component attached to my “Green Bot” and the animation plays if I click Loop, but I only want it to play inside the above function. How can I check if the component is attached inside the script, as the error suggests?

UPDATE:

Full Robot script:

public class RobotController : MonoBehaviour
{
	public float speed;
	public float tiltX;
	public float tiltY;
	public float tiltZ;

	Animator animator;
	int jumpHash = Animator.StringToHash ("Jump");

	void Start ()
	{
		animator = GetComponent<Animator>();
	}

	void FixedUpdate (){
		
		Vector3 pos = transform.position;
		pos.z = -2;
		transform.position = pos;

		Vector3 direction = Vector3.zero;
		direction.x = -Input.acceleration.x*2f;
		
		if ( direction.sqrMagnitude > 1 ){
			direction.Normalize();
		}
		
		direction *= Time.deltaTime;
		transform.Translate( direction * speed );

		// Smoothes the rotation when touching Box collider... not sure why
		rigidbody.constraints = RigidbodyConstraints.FreezeRotation;

	}

	void OnCollisionEnter(Collision collision){
	
		foreach(ContactPoint contact in collision.contacts){
			rigidbody.velocity = transform.up*10;
			audio.Play();
			animator.SetTrigger(jumpHash);
		}
	}
}

Animator window:

Inspector:

25995-inspector.png

The animation component is not the same as the animator component.
Remove the animator component and add the animation component instead.

You check if a component is attached to a gameObject by calling:

Animation animation = gameObject.GetComponent<Animation>();

if (animation == null) {
  // animation is not attached to gameObject
}

To make the animation work I had to Create another state called Idle, label it default state, and then I had to click on the transition from Idle to JumpAnimation and set the Conditions in the Inspector = to ‘Jump’. I had it set to ‘Exit Time’ initially and that was screwing everything up.